fix(ui/accounts): fix welcome banner wrapping and unify account section layout
This commit is contained in:
2 files changed
+23
-23
No files matched your search
@@ -28,24 +28,28 @@ const change=()=>run(async()=>{await api.changePassword(current.value,next.value
|
||||
<template>
|
||||
<div class="mx-auto max-w-[80ch]">
|
||||
<PageHeader title="Your account"><span class="text-label text-fg-muted">{{accounts.status?.user?.display_name}}</span></PageHeader>
|
||||
<Alert v-if="$route.query.welcome" class="mb-4">Your organisation and admin account are ready. Add a passkey below, <RouterLink class="underline" to="/org/members">add members</RouterLink>, or <RouterLink class="underline" to="/settings/authentication">configure OIDC</RouterLink>.</Alert>
|
||||
<Alert v-if="$route.query.welcome" class="mb-4">
|
||||
<AlertDescription>
|
||||
<p>Your organisation and admin account are ready. Add a passkey below, <RouterLink class="underline" to="/org/members">add members</RouterLink>, or <RouterLink class="underline" to="/settings/authentication">configure OIDC</RouterLink>.</p>
|
||||
</AlertDescription>
|
||||
</Alert>
|
||||
<Alert v-if="error" variant="destructive" class="mb-4"><AlertDescription>{{error}}<a v-if="sessionExpired" class="underline" href="/?reauth=1"> Sign in again</a></AlertDescription></Alert>
|
||||
<LinkedChannels :welcome="Boolean($route.query.welcome)" />
|
||||
<Section title="Passkeys">
|
||||
<Section title="Passkeys" description="Sign in without a password using a hardware key or device biometrics.">
|
||||
<ItemGroup v-if="keys.length" class="mb-3"><Item v-for="key in keys" :key="key.id" as="li" variant="outline" size="xs"><ItemContent class="min-w-0 truncate"><span class="truncate">{{key.name}}</span></ItemContent><ItemActions><Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = key">Remove</Button></ItemActions></Item></ItemGroup>
|
||||
<form v-if="eligible" class="flex flex-wrap gap-2" @submit.prevent="enroll"><Input v-model="keyName" aria-label="Passkey name" placeholder="Passkey name (optional)" maxlength="200" class="min-w-40 flex-1"/><Button type="submit" :disabled="busy">Add passkey</Button></form>
|
||||
<p v-else class="text-fg-muted">Passkeys need an HTTPS domain or localhost. Set the instance URL in <RouterLink class="underline" to="/settings/authentication">Authentication settings</RouterLink>.</p>
|
||||
<form v-if="eligible" class="flex flex-wrap items-center gap-2" @submit.prevent="enroll"><Input v-model="keyName" aria-label="Passkey name" placeholder="Passkey name (optional)" maxlength="200" class="min-w-40 flex-1"/><Button type="submit" size="sm" :disabled="busy">Add passkey</Button></form>
|
||||
<p v-else class="text-label text-fg-muted">Passkeys need an HTTPS domain or localhost. Set the instance URL in <RouterLink class="underline" to="/settings/authentication">Authentication settings</RouterLink>.</p>
|
||||
</Section>
|
||||
<PersonalTokensCard />
|
||||
<Section title="Recovery code" description="Shown once. Use it to reset your password if you lose access. A new code replaces the old one.">
|
||||
<template #action><Button size="sm" :disabled="busy" @click="makeRecovery">Generate</Button></template>
|
||||
<template #action><Button variant="outline" size="sm" :disabled="busy" @click="makeRecovery">Generate</Button></template>
|
||||
<Card v-if="recovery" size="sm"><p class="break-all font-mono" role="status">{{recovery}}</p></Card>
|
||||
</Section>
|
||||
<Section title="Change password" description="Changing your password signs out all your sessions.">
|
||||
<form @submit.prevent="change">
|
||||
<SettingRow label="Current password" for="current-password"><Input id="current-password" v-model="current" type="password" autocomplete="current-password" required class="max-w-sm" /></SettingRow>
|
||||
<SettingRow label="New password" for="new-password"><Input id="new-password" v-model="next" type="password" autocomplete="new-password" required minlength="15" maxlength="1024" class="max-w-sm" /></SettingRow>
|
||||
<div class="flex justify-end border-t border-border pt-3"><Button type="submit" :disabled="busy">Change password</Button></div>
|
||||
<div class="flex justify-end border-t border-border pt-3"><Button type="submit" size="sm" :disabled="busy">Change password</Button></div>
|
||||
</form>
|
||||
</Section>
|
||||
</div>
|
||||
|
||||
@@ -7,7 +7,6 @@ import { Copy, Plus, X } from "@lucide/vue";
|
||||
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { Card } from "@/components/ui/card";
|
||||
import { Empty, EmptyHeader, EmptyTitle } from "@/components/ui/empty";
|
||||
import { Input } from "@/components/ui/input";
|
||||
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from "@/components/ui/select";
|
||||
import { api, describeError } from "@/lib/api";
|
||||
@@ -83,20 +82,8 @@ onMounted(load);
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<Section title="API tokens">
|
||||
<template v-if="available" #action>
|
||||
<form class="flex flex-wrap items-center gap-2" @submit.prevent="create">
|
||||
<Input v-model="name" class="w-40 min-w-0 flex-1 sm:flex-none" maxlength="40" required placeholder="Name" aria-label="Token name" />
|
||||
<Select :model-value="String(days)" @update:model-value="(v) => (days = Number(v))">
|
||||
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option in lifetimes" :key="option.days" :value="String(option.days)">{{ option.label }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button type="submit" size="sm" :disabled="busy || !name.trim()"><Plus data-icon="inline-start" />New token</Button>
|
||||
</form>
|
||||
</template>
|
||||
<p v-if="!available && !busy && !error" class="text-fg-subtle">Personal tokens need a signed-in person.</p>
|
||||
<Section title="API tokens" description="Personal bearer tokens for CLI and API access.">
|
||||
<p v-if="!available && !busy && !error" class="text-label text-fg-subtle">Personal tokens need a signed-in person.</p>
|
||||
<ReadError v-if="error" :message="error" retry-label="Retry" class="mb-3" @retry="load" />
|
||||
<Card v-if="created" size="sm" class="mb-3">
|
||||
<p class="text-caption text-fg-subtle">Copy this token now. It cannot be shown again.</p>
|
||||
@@ -106,8 +93,7 @@ onMounted(load);
|
||||
<Button variant="ghost" size="sm" aria-label="Dismiss" @click="created = ''"><X /></Button>
|
||||
</div>
|
||||
</Card>
|
||||
<Empty v-if="available && !tokens.length && !busy && !error"><EmptyHeader><EmptyTitle>No tokens yet.</EmptyTitle></EmptyHeader></Empty>
|
||||
<ItemGroup v-if="tokens.length" aria-label="API tokens">
|
||||
<ItemGroup v-if="tokens.length" aria-label="API tokens" class="mb-3">
|
||||
<Item v-for="token in tokens" :key="token.id" as="li" variant="outline" size="xs">
|
||||
<span class="flex-1 truncate text-label">{{ token.name || token.id.slice(0, 12) }}</span>
|
||||
<span class="text-caption text-fg-subtle">Created <Timestamp :at="token.created_at" /></span>
|
||||
@@ -116,6 +102,16 @@ onMounted(load);
|
||||
<Button variant="ghost" size="sm" class="text-danger" :disabled="busy" @click="pending = token; dialogOpen = true">Revoke</Button>
|
||||
</Item>
|
||||
</ItemGroup>
|
||||
<form v-if="available" class="flex flex-wrap items-center gap-2" @submit.prevent="create">
|
||||
<Input v-model="name" class="min-w-40 flex-1" maxlength="40" required placeholder="Token name" aria-label="Token name" />
|
||||
<Select :model-value="String(days)" @update:model-value="(v) => (days = Number(v))">
|
||||
<SelectTrigger size="sm" class="w-28" aria-label="Lifetime"><SelectValue /></SelectTrigger>
|
||||
<SelectContent>
|
||||
<SelectItem v-for="option in lifetimes" :key="option.days" :value="String(option.days)">{{ option.label }}</SelectItem>
|
||||
</SelectContent>
|
||||
</Select>
|
||||
<Button type="submit" size="sm" :disabled="busy || !name.trim()"><Plus data-icon="inline-start" />New token</Button>
|
||||
</form>
|
||||
</Section>
|
||||
<AlertDialog :open="dialogOpen" @update:open="(v: boolean) => { dialogOpen = v; }">
|
||||
<AlertDialogContent>
|
||||
|
||||
Reference in new issue
Block a user