feat(redesign): re-skin auth + account views to DS (Phase D batch 1)
All checks were successful
Test Asgard Runner / test (push) Successful in 3s

Auth (Login/Register/ForgotPassword/SetupWizard) + account cluster (Settings/Team/Notifications) re-skinned onto design-system components + tokens. JPEG login banner replaced with the C-gauge mark + Oxanium wordmark. All logic/store/router/handlers preserved (TOTP flow, validators, save handlers, API endpoints). Build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Vantz Stockwell
2026-06-11 02:21:14 -04:00
parent f91ef84832
commit 560d023250
7 changed files with 1357 additions and 847 deletions

View File

@@ -1,9 +1,13 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useApi } from '@/composables/useApi'
import { useToastStore } from '@/stores/toast'
import type { NotificationConfig } from '@/types'
import { Bell, Save, Loader2 } from 'lucide-vue-next'
import Panel from '@/components/ds/data/Panel.vue'
import Button from '@/components/ds/core/Button.vue'
import Input from '@/components/ds/forms/Input.vue'
import Switch from '@/components/ds/forms/Switch.vue'
const api = useApi()
const toast = useToastStore()
@@ -26,12 +30,12 @@ const saving = ref(false)
const isLoading = ref(false)
const eventToggles = [
{ key: 'notify_wipe_start' as const, label: 'Wipe Started', desc: 'When a wipe begins' },
{ key: 'notify_wipe_complete' as const, label: 'Wipe Complete', desc: 'When a wipe finishes successfully' },
{ key: 'notify_wipe_failed' as const, label: 'Wipe Failed', desc: 'When a wipe fails or rolls back' },
{ key: 'notify_server_crash' as const, label: 'Server Crash', desc: 'When the server process crashes' },
{ key: 'notify_server_offline' as const, label: 'Server Offline', desc: 'When the server goes unreachable' },
{ key: 'notify_store_purchase' as const, label: 'Store Purchase', desc: 'When a player buys from the store' },
{ key: 'notify_wipe_start' as const, label: 'Wipe started', desc: 'When a wipe begins' },
{ key: 'notify_wipe_complete' as const, label: 'Wipe complete', desc: 'When a wipe finishes successfully' },
{ key: 'notify_wipe_failed' as const, label: 'Wipe failed', desc: 'When a wipe fails or rolls back' },
{ key: 'notify_server_crash' as const, label: 'Server crash', desc: 'When the server process crashes' },
{ key: 'notify_server_offline' as const, label: 'Server offline', desc: 'When the server goes unreachable' },
{ key: 'notify_store_purchase' as const, label: 'Store purchase', desc: 'When a player buys from the store' },
]
async function fetchConfig() {
@@ -58,129 +62,114 @@ async function saveConfig() {
}
}
// Coerce nullable string fields to string for DS Input (which expects string, not string|null)
const discordWebhookUrl = computed<string>({
get: () => config.value.discord_webhook_url ?? '',
set: (v) => { config.value.discord_webhook_url = v || null },
})
const pushbulletApiKey = computed<string>({
get: () => config.value.pushbullet_api_key ?? '',
set: (v) => { config.value.pushbullet_api_key = v || null },
})
onMounted(() => {
fetchConfig()
})
</script>
<template>
<div class="p-6 space-y-6">
<!-- Header -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<Bell class="w-5 h-5 text-oxide-500" />
<h1 class="text-2xl font-bold text-neutral-100">Notifications</h1>
<div class="notifs">
<!-- Page head -->
<div class="page__head">
<div>
<div class="t-eyebrow">Monitoring</div>
<h1 class="page__title">Notifications</h1>
</div>
<button
<Button
size="sm"
icon="save"
:loading="saving"
@click="saveConfig"
:disabled="saving"
class="flex items-center gap-2 px-4 py-2 bg-oxide-600 hover:bg-oxide-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors"
>
<Loader2 v-if="saving" class="w-4 h-4 animate-spin" />
<Save v-else class="w-4 h-4" />
{{ saving ? 'Saving...' : 'Save Changes' }}
</button>
{{ saving ? 'Saving...' : 'Save changes' }}
</Button>
</div>
<!-- Discord -->
<div class="bg-neutral-900 border border-neutral-800 rounded-lg p-5">
<div class="flex items-center justify-between mb-4">
<div>
<h2 class="text-sm font-medium text-neutral-200">Discord Webhook</h2>
<p class="text-xs text-neutral-500 mt-0.5">Send notifications to a Discord channel</p>
</div>
<button
@click="config.discord_enabled = !config.discord_enabled"
class="w-9 h-5 rounded-full transition-colors"
:class="config.discord_enabled ? 'bg-oxide-500' : 'bg-neutral-700'"
>
<div
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
:class="config.discord_enabled ? 'translate-x-4.5' : 'translate-x-0.5'"
/>
</button>
</div>
<input
v-model="config.discord_webhook_url"
<!-- Discord webhook -->
<Panel title="Discord webhook" subtitle="Send notifications to a Discord channel" eyebrow="Channel">
<template #actions>
<Switch v-model="config.discord_enabled" />
</template>
<Input
v-model="discordWebhookUrl"
type="url"
placeholder="https://discord.com/api/webhooks/..."
:disabled="!config.discord_enabled"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors disabled:opacity-40"
:mono="true"
/>
</div>
</Panel>
<!-- Pushbullet -->
<div class="bg-neutral-900 border border-neutral-800 rounded-lg p-5">
<div class="flex items-center justify-between mb-4">
<div>
<h2 class="text-sm font-medium text-neutral-200">Pushbullet</h2>
<p class="text-xs text-neutral-500 mt-0.5">Push notifications to your devices</p>
</div>
<button
@click="config.pushbullet_enabled = !config.pushbullet_enabled"
class="w-9 h-5 rounded-full transition-colors"
:class="config.pushbullet_enabled ? 'bg-oxide-500' : 'bg-neutral-700'"
>
<div
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
:class="config.pushbullet_enabled ? 'translate-x-4.5' : 'translate-x-0.5'"
/>
</button>
</div>
<input
v-model="config.pushbullet_api_key"
type="text"
<Panel title="Pushbullet" subtitle="Push notifications to your devices" eyebrow="Channel">
<template #actions>
<Switch v-model="config.pushbullet_enabled" />
</template>
<Input
v-model="pushbulletApiKey"
placeholder="Pushbullet API key"
:disabled="!config.pushbullet_enabled"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors disabled:opacity-40"
:mono="true"
/>
</div>
</Panel>
<!-- Email -->
<div class="bg-neutral-900 border border-neutral-800 rounded-lg p-5">
<div class="flex items-center justify-between">
<div>
<h2 class="text-sm font-medium text-neutral-200">Email Alerts</h2>
<p class="text-xs text-neutral-500 mt-0.5">Send critical alerts to your registered email</p>
</div>
<button
@click="config.email_alerts_enabled = !config.email_alerts_enabled"
class="w-9 h-5 rounded-full transition-colors"
:class="config.email_alerts_enabled ? 'bg-oxide-500' : 'bg-neutral-700'"
>
<div
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
:class="config.email_alerts_enabled ? 'translate-x-4.5' : 'translate-x-0.5'"
/>
</button>
</div>
</div>
<!-- Email alerts -->
<Panel title="Email alerts" subtitle="Send critical alerts to your registered email" eyebrow="Channel">
<template #actions>
<Switch v-model="config.email_alerts_enabled" />
</template>
<!-- No additional fields for email toggle only -->
</Panel>
<!-- Event Toggles -->
<div class="bg-neutral-900 border border-neutral-800 rounded-lg p-5">
<h2 class="text-sm font-medium text-neutral-400 uppercase tracking-wider mb-4">Event Triggers</h2>
<div class="space-y-4">
<!-- Event triggers -->
<Panel title="Event triggers" subtitle="Choose which events fire notifications" eyebrow="Routing">
<div class="triggers">
<div
v-for="toggle in eventToggles"
:key="toggle.key"
class="flex items-center justify-between"
class="trigger-row"
>
<div>
<p class="text-sm text-neutral-200">{{ toggle.label }}</p>
<p class="text-xs text-neutral-500">{{ toggle.desc }}</p>
<div class="trigger-text">
<span class="trigger-label">{{ toggle.label }}</span>
<span class="trigger-desc">{{ toggle.desc }}</span>
</div>
<button
@click="config[toggle.key] = !config[toggle.key]"
class="w-9 h-5 rounded-full transition-colors"
:class="config[toggle.key] ? 'bg-oxide-500' : 'bg-neutral-700'"
>
<div
class="w-4 h-4 bg-white rounded-full shadow transition-transform mt-0.5"
:class="config[toggle.key] ? 'translate-x-4.5' : 'translate-x-0.5'"
/>
</button>
<Switch v-model="config[toggle.key]" />
</div>
</div>
</div>
</Panel>
</div>
</template>
<style scoped>
.notifs { max-width: 780px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page__head {
display: flex; align-items: flex-end; justify-content: space-between;
gap: 16px; flex-wrap: wrap;
}
.page__title {
font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em;
color: var(--text-primary); margin-top: 5px;
}
/* Event triggers */
.triggers { display: flex; flex-direction: column; gap: 2px; }
.trigger-row {
display: flex; align-items: center; justify-content: space-between; gap: 16px;
padding: 11px 4px;
border-bottom: 1px solid var(--border-subtle);
}
.trigger-row:last-child { border-bottom: 0; }
.trigger-text { display: flex; flex-direction: column; gap: 2px; }
.trigger-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.trigger-desc { font-size: var(--text-xs); color: var(--text-tertiary); }
</style>

View File

@@ -3,14 +3,20 @@ import { ref, onMounted } from 'vue'
import { useAuthStore } from '@/stores/auth'
import { useToastStore } from '@/stores/toast'
import { useApi } from '@/composables/useApi'
import { Settings, Key, Globe, User, Save, Loader2, Eye } from 'lucide-vue-next'
import Panel from '@/components/ds/data/Panel.vue'
import Button from '@/components/ds/core/Button.vue'
import Badge from '@/components/ds/core/Badge.vue'
import Tabs from '@/components/ds/navigation/Tabs.vue'
import Input from '@/components/ds/forms/Input.vue'
import Switch from '@/components/ds/forms/Switch.vue'
const auth = useAuthStore()
const toast = useToastStore()
const api = useApi()
const saving = ref(false)
const section = ref<'account' | 'license' | 'domain' | 'public'>('account')
const section = ref<string>('account')
const accountForm = ref({
username: '',
@@ -86,209 +92,225 @@ async function savePublicSite() {
onMounted(() => {
loadForms()
})
const tabItems = [
{ value: 'account', label: 'Account', icon: 'user' },
{ value: 'license', label: 'License', icon: 'key' },
{ value: 'domain', label: 'Domain', icon: 'globe' },
{ value: 'public', label: 'Public status', icon: 'eye' },
]
</script>
<template>
<div class="p-6 space-y-6">
<!-- Header -->
<div class="flex items-center gap-3">
<Settings class="w-5 h-5 text-oxide-500" />
<h1 class="text-2xl font-bold text-neutral-100">Settings</h1>
<div class="settings">
<!-- Page head -->
<div class="page__head">
<div>
<div class="t-eyebrow">Management</div>
<h1 class="page__title">Settings</h1>
</div>
</div>
<!-- Section tabs -->
<div class="flex bg-neutral-800 rounded-lg border border-neutral-700 overflow-hidden w-fit">
<button
v-for="tab in ([
{ key: 'account', label: 'Account', icon: User },
{ key: 'license', label: 'License', icon: Key },
{ key: 'domain', label: 'Domain', icon: Globe },
{ key: 'public', label: 'Public Status', icon: Eye },
] as const)"
:key="tab.key"
@click="section = tab.key"
class="flex items-center gap-2 px-4 py-2 text-sm font-medium transition-colors"
:class="section === tab.key
? 'bg-oxide-500/15 text-oxide-400'
: 'text-neutral-400 hover:text-neutral-200'"
>
<component :is="tab.icon" class="w-4 h-4" />
{{ tab.label }}
</button>
</div>
<Tabs v-model="section" :items="tabItems" />
<!-- Account -->
<div v-if="section === 'account'" class="bg-neutral-900 border border-neutral-800 rounded-lg p-5 space-y-4">
<h2 class="text-sm font-medium text-neutral-400 uppercase tracking-wider">Account Details</h2>
<div class="grid grid-cols-2 gap-4">
<div>
<label class="block text-xs text-neutral-500 mb-1">Username</label>
<input
v-model="accountForm.username"
type="text"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
/>
</div>
<div>
<label class="block text-xs text-neutral-500 mb-1">Email</label>
<input
v-model="accountForm.email"
type="email"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
/>
</div>
<Panel v-if="section === 'account'" title="Account details" eyebrow="Identity">
<template #actions>
<Button size="sm" :loading="saving" icon="save" @click="saveAccount">Save</Button>
</template>
<div class="form-grid">
<Input
v-model="accountForm.username"
label="Username"
placeholder="your-handle"
:required="true"
/>
<Input
v-model="accountForm.email"
label="Email"
type="email"
placeholder="you@example.com"
:required="true"
/>
</div>
<div class="flex items-center gap-3">
<p class="text-xs text-neutral-500">
2FA: <span :class="auth.user?.totp_enabled ? 'text-green-400' : 'text-yellow-400'">
{{ auth.user?.totp_enabled ? 'Enabled' : 'Not configured' }}
</span>
</p>
<div class="totp-row">
<span class="field-label">2FA status</span>
<Badge
:tone="auth.user?.totp_enabled ? 'online' : 'warn'"
:dot="true"
>
{{ auth.user?.totp_enabled ? 'Enabled' : 'Not configured' }}
</Badge>
</div>
<button
@click="saveAccount"
:disabled="saving"
class="flex items-center gap-2 px-4 py-2 bg-oxide-600 hover:bg-oxide-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors"
>
<Loader2 v-if="saving" class="w-4 h-4 animate-spin" />
<Save v-else class="w-4 h-4" />
Save
</button>
</div>
</Panel>
<!-- License -->
<div v-if="section === 'license'" class="bg-neutral-900 border border-neutral-800 rounded-lg p-5 space-y-4">
<h2 class="text-sm font-medium text-neutral-400 uppercase tracking-wider">License Information</h2>
<div class="grid grid-cols-2 lg:grid-cols-3 gap-6">
<div>
<p class="text-xs text-neutral-500 mb-1">License Key</p>
<p class="text-sm font-mono text-neutral-300">{{ auth.license?.license_key || '\u2014' }}</p>
<Panel v-if="section === 'license'" title="License information" eyebrow="Subscription">
<div class="lic-grid">
<div class="lic-field">
<span class="field-label">License key</span>
<span class="field-mono">{{ auth.license?.license_key ?? '—' }}</span>
</div>
<div>
<p class="text-xs text-neutral-500 mb-1">Status</p>
<span
class="text-xs font-medium px-2 py-0.5 rounded-full"
:class="{
'bg-green-500/10 text-green-400': auth.license?.status === 'active',
'bg-yellow-500/10 text-yellow-400': auth.license?.status === 'suspended',
'bg-red-500/10 text-red-400': auth.license?.status === 'expired' || auth.license?.status === 'revoked',
}"
<div class="lic-field">
<span class="field-label">Status</span>
<Badge
:tone="auth.license?.status === 'active' ? 'online' : auth.license?.status === 'suspended' ? 'warn' : 'offline'"
>
{{ auth.license?.status || 'Unknown' }}
{{ auth.license?.status ?? 'Unknown' }}
</Badge>
</div>
<div class="lic-field">
<span class="field-label">Expires</span>
<span class="field-value">
{{ auth.license?.expires_at ? new Date(auth.license.expires_at).toLocaleDateString() : 'Never' }}
</span>
</div>
<div>
<p class="text-xs text-neutral-500 mb-1">Expires</p>
<p class="text-sm text-neutral-300">
{{ auth.license?.expires_at ? new Date(auth.license.expires_at).toLocaleDateString() : 'Never' }}
</p>
<div class="lic-field">
<span class="field-label">Server name</span>
<span class="field-value">{{ auth.license?.server_name ?? 'Not set' }}</span>
</div>
<div>
<p class="text-xs text-neutral-500 mb-1">Server Name</p>
<p class="text-sm text-neutral-300">{{ auth.license?.server_name || 'Not set' }}</p>
<div class="lic-field">
<span class="field-label">Webstore</span>
<Badge :tone="auth.license?.webstore_active ? 'online' : 'neutral'">
{{ auth.license?.webstore_active ? 'Active' : 'Inactive' }}
</Badge>
</div>
<div>
<p class="text-xs text-neutral-500 mb-1">Webstore</p>
<p class="text-sm text-neutral-300">{{ auth.license?.webstore_active ? 'Active' : 'Inactive' }}</p>
</div>
<div>
<p class="text-xs text-neutral-500 mb-1">Modules</p>
<p class="text-sm text-neutral-300">{{ auth.license?.modules_enabled?.length ?? 0 }} enabled</p>
<div class="lic-field">
<span class="field-label">Modules</span>
<span class="field-mono">{{ auth.license?.modules_enabled?.length ?? 0 }} enabled</span>
</div>
</div>
</div>
</Panel>
<!-- Domain -->
<div v-if="section === 'domain'" class="bg-neutral-900 border border-neutral-800 rounded-lg p-5 space-y-4">
<h2 class="text-sm font-medium text-neutral-400 uppercase tracking-wider">Domain & Subdomain</h2>
<div class="space-y-4">
<div>
<label class="block text-xs text-neutral-500 mb-1">Subdomain</label>
<div class="flex items-center gap-0">
<input
<Panel v-if="section === 'domain'" title="Domain &amp; subdomain" eyebrow="Routing">
<template #actions>
<Button size="sm" :loading="saving" icon="save" @click="saveDomain">Save</Button>
</template>
<div class="domain-stack">
<div class="cc-field">
<span class="cc-field__label">Subdomain</span>
<div class="subdomain-row">
<Input
v-model="domainForm.subdomain"
type="text"
placeholder="my-server"
class="flex-1 px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-l-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
style="flex: 1"
/>
<span class="px-3 py-2 bg-neutral-700 border border-l-0 border-neutral-700 rounded-r-lg text-sm text-neutral-400">
.corrosionmgmt.com
</span>
<span class="subdomain-suffix">.corrosionmgmt.com</span>
</div>
</div>
<div>
<label class="block text-xs text-neutral-500 mb-1">Custom Domain (optional)</label>
<input
v-model="domainForm.custom_domain"
type="text"
placeholder="panel.myserver.com"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
/>
<p class="text-xs text-neutral-600 mt-1">Point a CNAME record to panel.corrosionmgmt.com</p>
</div>
<Input
v-model="domainForm.custom_domain"
label="Custom domain"
placeholder="panel.myserver.com"
hint="Point a CNAME record to panel.corrosionmgmt.com"
/>
</div>
<button
@click="saveDomain"
:disabled="saving"
class="flex items-center gap-2 px-4 py-2 bg-oxide-600 hover:bg-oxide-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors"
>
<Loader2 v-if="saving" class="w-4 h-4 animate-spin" />
<Save v-else class="w-4 h-4" />
Save
</button>
</div>
</Panel>
<!-- Public Status Page -->
<div v-if="section === 'public'" class="bg-neutral-900 border border-neutral-800 rounded-lg p-5 space-y-4">
<h2 class="text-sm font-medium text-neutral-400 uppercase tracking-wider">Public Status Page</h2>
<p class="text-xs text-neutral-500">
Showcase your server on the public Corrosion status page at
<a href="https://status.corrosionmgmt.com" target="_blank" class="text-oxide-400 hover:text-oxide-300">
status.corrosionmgmt.com
</a>
</p>
<!-- Public status page -->
<Panel v-if="section === 'public'" title="Public status page" eyebrow="Visibility">
<template #actions>
<Button size="sm" :loading="saving" icon="save" @click="savePublicSite">Save</Button>
</template>
<div class="public-stack">
<p class="section-note">
Showcase your server on the public Corrosion status page at
<a href="https://status.corrosionmgmt.com" target="_blank" class="link">status.corrosionmgmt.com</a>.
</p>
<div class="space-y-4">
<!-- Toggle -->
<div class="flex items-center justify-between p-4 bg-neutral-800 rounded-lg border border-neutral-700">
<div class="toggle-row">
<div>
<p class="text-sm font-medium text-neutral-200">Show on status page</p>
<p class="text-xs text-neutral-500 mt-1">Display your server publicly with live stats</p>
<p class="toggle-label">Show on status page</p>
<p class="toggle-desc">Display your server publicly with live stats</p>
</div>
<button
@click="publicSiteForm.show_on_status_page = !publicSiteForm.show_on_status_page"
:class="publicSiteForm.show_on_status_page ? 'bg-oxide-600' : 'bg-neutral-700'"
class="relative inline-flex h-6 w-11 items-center rounded-full transition-colors focus:outline-none focus:ring-2 focus:ring-oxide-500 focus:ring-offset-2 focus:ring-offset-neutral-900"
>
<span
:class="publicSiteForm.show_on_status_page ? 'translate-x-6' : 'translate-x-1'"
class="inline-block h-4 w-4 transform rounded-full bg-white transition-transform"
></span>
</button>
<Switch v-model="publicSiteForm.show_on_status_page" />
</div>
<!-- Description -->
<div>
<label class="block text-xs text-neutral-500 mb-1">Description (optional)</label>
<div class="cc-field">
<span class="cc-field__label">Description <span class="optional">(optional)</span></span>
<textarea
v-model="publicSiteForm.status_page_description"
placeholder="Friendly 10x modded server with custom plugins..."
rows="3"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors resize-none"
></textarea>
<p class="text-xs text-neutral-600 mt-1">Brief description shown on the status page</p>
class="cc-textarea"
/>
<span class="cc-field__hint">Brief description shown on the status page</span>
</div>
</div>
<button
@click="savePublicSite"
:disabled="saving"
class="flex items-center gap-2 px-4 py-2 bg-oxide-600 hover:bg-oxide-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors"
>
<Loader2 v-if="saving" class="w-4 h-4 animate-spin" />
<Save v-else class="w-4 h-4" />
Save
</button>
</div>
</Panel>
</div>
</template>
<style scoped>
.settings {
max-width: 860px;
margin: 0 auto;
display: flex;
flex-direction: column;
gap: 18px;
}
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.page__title { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); margin-top: 5px; }
/* Account tab */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.totp-row { display: flex; align-items: center; gap: 10px; margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--border-subtle); }
/* License tab */
.lic-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px 24px; }
.lic-field { display: flex; flex-direction: column; gap: 5px; }
/* Domain tab */
.domain-stack { display: flex; flex-direction: column; gap: 14px; }
.subdomain-row { display: flex; align-items: center; gap: 0; }
.subdomain-suffix {
display: flex; align-items: center;
height: var(--control-h-md); padding: 0 11px;
background: var(--surface-raised-2); color: var(--text-muted);
font-family: var(--font-mono); font-size: var(--text-xs);
border-radius: 0 var(--radius-md) var(--radius-md) 0;
box-shadow: var(--ring-default);
white-space: nowrap; flex: none;
}
/* Remove the right-radius from the preceding Input's inner element */
.subdomain-row :deep(.cc-input) { border-radius: var(--radius-md) 0 0 var(--radius-md); }
/* Public status tab */
.public-stack { display: flex; flex-direction: column; gap: 16px; }
.section-note { font-size: var(--text-sm); color: var(--text-tertiary); margin: 0; }
.link { color: var(--accent-text); text-decoration: none; }
.link:hover { text-decoration: underline; }
.toggle-row {
display: flex; align-items: center; justify-content: space-between; gap: 16px;
padding: 13px 14px;
background: var(--surface-raised-2); border-radius: var(--radius-md); box-shadow: var(--ring-default);
}
.toggle-label { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); margin: 0; }
.toggle-desc { font-size: var(--text-xs); color: var(--text-tertiary); margin: 3px 0 0; }
/* Shared field helpers */
.field-label { font-size: var(--text-xs); font-weight: 600; color: var(--text-secondary); }
.field-mono { font-family: var(--font-mono); font-size: var(--text-sm); color: var(--text-primary); font-variant-numeric: tabular-nums; }
.field-value { font-size: var(--text-sm); color: var(--text-primary); }
.optional { font-weight: 400; color: var(--text-muted); }
/* Textarea (no DS component for textarea — minimal consistent styling) */
.cc-textarea {
width: 100%; padding: 9px 11px; resize: vertical;
background: var(--surface-inset); color: var(--text-primary);
border: 0; border-radius: var(--radius-md); box-shadow: var(--ring-default);
font-family: var(--font-sans); font-size: var(--text-sm); line-height: 1.5;
outline: 0; transition: var(--transition-colors);
box-sizing: border-box;
}
.cc-textarea::placeholder { color: var(--text-muted); }
.cc-textarea:focus { box-shadow: inset 0 0 0 1px var(--accent), var(--glow-accent-sm); }
@media (max-width: 680px) {
.form-grid { grid-template-columns: 1fr; }
.lic-grid { grid-template-columns: 1fr 1fr; }
}
</style>

View File

@@ -1,9 +1,14 @@
<script setup lang="ts">
import { ref, onMounted } from 'vue'
import { ref, computed, onMounted } from 'vue'
import { useApi } from '@/composables/useApi'
import { useToastStore } from '@/stores/toast'
import type { TeamMember, Role } from '@/types'
import { UserPlus, Shield, Mail, Trash2, RefreshCw } from 'lucide-vue-next'
import Panel from '@/components/ds/data/Panel.vue'
import Button from '@/components/ds/core/Button.vue'
import Badge from '@/components/ds/core/Badge.vue'
import Input from '@/components/ds/forms/Input.vue'
import Select from '@/components/ds/forms/Select.vue'
import EmptyState from '@/components/ds/feedback/EmptyState.vue'
const api = useApi()
const toast = useToastStore()
@@ -16,12 +21,11 @@ const inviteEmail = ref('')
const inviteRole = ref('')
const inviting = ref(false)
function roleBadgeClass(roleName: string): string {
function roleTone(roleName: string): 'accent' | 'info' | 'neutral' {
switch (roleName.toLowerCase()) {
case 'owner': return 'bg-oxide-500/15 text-oxide-400'
case 'admin': return 'bg-purple-500/15 text-purple-400'
case 'moderator': return 'bg-blue-500/15 text-blue-400'
default: return 'bg-neutral-700/50 text-neutral-400'
case 'owner': return 'accent'
case 'admin': return 'info'
default: return 'neutral'
}
}
@@ -72,135 +76,173 @@ async function removeMember(member: TeamMember) {
onMounted(() => {
fetchTeam()
})
const roleOptions = computed(() =>
roles.value.map((r) => ({ value: r.id, label: r.role_name }))
)
</script>
<template>
<div class="p-6 space-y-6">
<!-- Header -->
<div class="flex items-center justify-between">
<div class="flex items-center gap-3">
<UserPlus class="w-5 h-5 text-oxide-500" />
<div>
<h1 class="text-2xl font-bold text-neutral-100">Team Management</h1>
<p class="text-sm text-neutral-500 mt-0.5">{{ members.length }} members</p>
</div>
<div class="team">
<!-- Page head -->
<div class="page__head">
<div>
<div class="t-eyebrow">Management</div>
<h1 class="page__title">Team</h1>
</div>
<div class="flex items-center gap-3">
<button
<div class="page__actions">
<Button
variant="secondary"
size="sm"
icon="refresh-cw"
:loading="isLoading"
@click="fetchTeam"
:disabled="isLoading"
class="flex items-center gap-2 px-3 py-2 text-sm text-neutral-400 hover:text-neutral-200 bg-neutral-800 hover:bg-neutral-700 rounded-lg transition-colors"
>
<RefreshCw class="w-4 h-4" :class="{ 'animate-spin': isLoading }" />
</button>
<button
Refresh
</Button>
<Button
size="sm"
icon="mail"
@click="showInvite = !showInvite"
class="flex items-center gap-2 px-4 py-2 bg-oxide-600 hover:bg-oxide-700 text-white text-sm font-medium rounded-lg transition-colors"
>
<Mail class="w-4 h-4" />
Invite Member
</button>
Invite member
</Button>
</div>
</div>
<!-- Invite form -->
<div v-if="showInvite" class="bg-neutral-900 border border-oxide-500/20 rounded-lg p-5">
<h3 class="text-sm font-medium text-neutral-200 mb-3">Invite a Team Member</h3>
<form @submit.prevent="sendInvite" class="flex items-end gap-3">
<div class="flex-1">
<label class="block text-xs text-neutral-500 mb-1">Email Address</label>
<input
v-model="inviteEmail"
type="email"
required
placeholder="team@example.com"
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 placeholder-neutral-500 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
<!-- Invite panel -->
<Panel v-if="showInvite" title="Invite a team member" eyebrow="New invite">
<form @submit.prevent="sendInvite" class="invite-form">
<Input
v-model="inviteEmail"
label="Email address"
type="email"
placeholder="team@example.com"
:required="true"
style="flex: 1"
/>
<div class="invite-role">
<span class="cc-field__label">Role</span>
<Select
v-model="inviteRole"
:options="[{ value: '', label: 'Select role...' }, ...roleOptions]"
/>
</div>
<div class="w-48">
<label class="block text-xs text-neutral-500 mb-1">Role</label>
<select
v-model="inviteRole"
required
class="w-full px-3 py-2 bg-neutral-800 border border-neutral-700 rounded-lg text-sm text-neutral-100 focus:outline-none focus:ring-2 focus:ring-oxide-500/50 focus:border-oxide-500 transition-colors"
>
<option value="" disabled>Select role...</option>
<option v-for="role in roles" :key="role.id" :value="role.id">
{{ role.role_name }}
</option>
</select>
<div class="invite-action">
<!-- spacer to align with inputs -->
<span class="cc-field__label">&nbsp;</span>
<Button type="submit" size="md" :loading="inviting">
{{ inviting ? 'Sending...' : 'Send invite' }}
</Button>
</div>
<button
type="submit"
:disabled="inviting"
class="px-4 py-2 bg-oxide-600 hover:bg-oxide-700 disabled:opacity-50 text-white text-sm font-medium rounded-lg transition-colors"
>
{{ inviting ? 'Sending...' : 'Send Invite' }}
</button>
</form>
</div>
</Panel>
<!-- Team table -->
<div class="bg-neutral-900 border border-neutral-800 rounded-lg overflow-hidden">
<table class="w-full">
<Panel :flush-body="true" title="Members" :subtitle="members.length + ' total'">
<!-- Empty state -->
<EmptyState
v-if="!isLoading && members.length === 0"
icon="users"
title="No team members"
description="Invite someone to get started."
>
<template #action>
<Button size="sm" icon="mail" @click="showInvite = true">Invite member</Button>
</template>
</EmptyState>
<!-- Loading skeleton -->
<div v-else-if="isLoading" class="table-loading">
<div v-for="i in 3" :key="i" class="skeleton-row" />
</div>
<!-- Table -->
<table v-else class="cc-table">
<thead>
<tr class="border-b border-neutral-800 text-left">
<th class="px-4 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">Member</th>
<th class="px-4 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">Email</th>
<th class="px-4 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">Role</th>
<th class="px-4 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider">Status</th>
<th class="px-4 py-3 text-xs font-medium text-neutral-500 uppercase tracking-wider text-right">Actions</th>
<tr>
<th>Member</th>
<th>Email</th>
<th>Role</th>
<th>Status</th>
<th class="col-actions">Actions</th>
</tr>
</thead>
<tbody class="divide-y divide-neutral-800">
<tr v-if="members.length === 0">
<td colspan="5" class="px-4 py-12 text-center text-neutral-500 text-sm">
<template v-if="isLoading">Loading team...</template>
<template v-else>No team members yet. Invite someone to get started.</template>
</td>
</tr>
<tr
v-for="member in members"
:key="member.id"
class="hover:bg-neutral-800/50 transition-colors"
>
<td class="px-4 py-3">
<div class="flex items-center gap-2">
<Shield class="w-4 h-4 text-neutral-600" />
<span class="text-sm font-medium text-neutral-100">{{ member.username }}</span>
<tbody>
<tr v-for="member in members" :key="member.id">
<td>
<div class="member-id">
<span class="member-avatar">{{ (member.username ?? '?')[0]?.toUpperCase() ?? '?' }}</span>
<span class="member-name">{{ member.username }}</span>
</div>
</td>
<td class="px-4 py-3 text-sm text-neutral-400">{{ member.email }}</td>
<td class="px-4 py-3">
<span
class="text-xs font-medium px-2 py-0.5 rounded-full"
:class="roleBadgeClass(member.role_name)"
>
{{ member.role_name }}
</span>
<td class="cell-mono">{{ member.email }}</td>
<td>
<Badge :tone="roleTone(member.role_name)">{{ member.role_name }}</Badge>
</td>
<td class="px-4 py-3">
<span
class="text-xs font-medium px-2 py-0.5 rounded-full"
:class="member.accepted_at
? 'bg-green-500/10 text-green-400'
: 'bg-yellow-500/10 text-yellow-400'"
>
<td>
<Badge :tone="member.accepted_at ? 'online' : 'warn'" :dot="true">
{{ member.accepted_at ? 'Active' : 'Pending' }}
</span>
</Badge>
</td>
<td class="px-4 py-3 text-right">
<button
@click="removeMember(member)"
class="p-1.5 text-neutral-500 hover:text-red-400 rounded transition-colors"
<td class="col-actions">
<Button
variant="ghost"
size="sm"
icon="trash-2"
title="Remove member"
>
<Trash2 class="w-4 h-4" />
</button>
@click="removeMember(member)"
/>
</td>
</tr>
</tbody>
</table>
</div>
</Panel>
</div>
</template>
<style scoped>
.team { max-width: 1100px; margin: 0 auto; display: flex; flex-direction: column; gap: 18px; }
.page__head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; row-gap: 10px; }
.page__title { font-size: var(--text-3xl); font-weight: 700; letter-spacing: -0.02em; color: var(--text-primary); margin-top: 5px; }
.page__actions { display: flex; align-items: center; gap: 9px; flex-wrap: wrap; }
/* Invite form */
.invite-form { display: flex; align-items: flex-end; gap: 12px; flex-wrap: wrap; }
.invite-role { display: flex; flex-direction: column; gap: 6px; min-width: 180px; }
.invite-action { display: flex; flex-direction: column; gap: 6px; }
/* Table */
.cc-table { width: 100%; border-collapse: collapse; }
.cc-table th {
padding: 10px 16px;
text-align: left;
font-size: var(--text-xs); font-weight: 600; color: var(--text-tertiary);
text-transform: uppercase; letter-spacing: var(--tracking-wider);
border-bottom: 1px solid var(--border-subtle);
}
.cc-table td {
padding: 11px 16px;
font-size: var(--text-sm); color: var(--text-secondary);
border-bottom: 1px solid var(--border-subtle);
}
.cc-table tbody tr:last-child td { border-bottom: 0; }
.cc-table tbody tr:hover td { background: var(--surface-hover); }
.col-actions { text-align: right; width: 56px; }
.member-id { display: flex; align-items: center; gap: 10px; }
.member-avatar {
width: 28px; height: 28px; border-radius: var(--radius-sm);
display: flex; align-items: center; justify-content: center; flex: none;
background: var(--accent-soft); color: var(--accent-text);
font-size: var(--text-xs); font-weight: 700;
}
.member-name { font-size: var(--text-sm); font-weight: 500; color: var(--text-primary); }
.cell-mono { font-family: var(--font-mono); font-size: var(--text-xs) !important; color: var(--text-tertiary) !important; }
/* Loading skeleton */
.table-loading { padding: 16px; display: flex; flex-direction: column; gap: 10px; }
.skeleton-row { height: 40px; border-radius: var(--radius-md); background: var(--surface-raised-2); animation: cc-skeleton 1.4s ease-in-out infinite; }
@keyframes cc-skeleton { 0%, 100% { opacity: 1; } 50% { opacity: 0.4; } }
</style>