commit 462ae32006ef37a7731fcbb236b89eb6e05c3a53 parent a355d9d1252903f9a081a69cbe9c3c350bd6e856 Author: finwo <finwo@pm.me> Date: Fri, 23 Oct 2026 00:41:01 +0200 Restyled account and reorganized mockups Diffstat:
15 files changed, 620 insertions(+), 419 deletions(-)
diff --git a/app/account/src/assets/account.css b/app/account/src/assets/account.css @@ -1,300 +1,155 @@ -.account-app, -.account-status-page { - --account-canvas: #ededed; - --account-surface: #ffffff; - --account-topbar: #151515; - --account-border: #d2d2d2; - --account-text: #151515; - --account-muted: #6a6e73; - --account-accent: #25a; - --account-accent-hover: #2a66cc; - --account-accent-active: #1b468c; - --account-danger: #c9190b; - font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell, "Open Sans", "Helvetica Neue", sans-serif; -} - -*, -*::before, -*::after { - box-sizing: border-box; -} - -html, -body { +.summary-list { + display: grid; + gap: 0.25rem; margin: 0; padding: 0; + list-style: none; } -.account-app { - min-height: 100vh; - background: var(--account-canvas); - color: var(--account-text); - font-size: 1rem; -} - -.account-topbar { - display: flex; +.summary-row { + display: grid; + grid-template-columns: 1.5rem minmax(0, 1fr); align-items: center; - justify-content: space-between; gap: 1rem; - min-height: 3.5rem; - padding: 0 2rem; - background: var(--account-topbar); - color: #fff; -} - -.account-brand { - color: #fff; - font-size: 0.9375rem; + padding: 0.875rem 0.75rem; + color: inherit; text-decoration: none; -} - -.account-signout { - padding: 0.5rem 0.75rem; - border: 1pt solid rgba(255, 255, 255, 0.42); - border-radius: 0; - background: transparent; - color: #fff; - font: inherit; - font-size: 0.875rem; cursor: pointer; + user-select: none; } -.account-signout:hover { - border-color: #fff; -} - -.account-signout:disabled { - opacity: 0.5; - cursor: default; -} - -.account-page-header { - padding: 1.25rem 2rem; - border-bottom: 1pt solid var(--account-border); - background: var(--account-surface); -} - -.account-page-header h1 { - margin: 0; - font-size: 1.5rem; - font-weight: 400; - line-height: 1.3; -} - -.account-page-header p { - margin: 0.25rem 0 0; - color: var(--account-muted); - font-size: 0.875rem; - line-height: 1.5; +.summary-row:hover { + background: var(--row-hover); } -.account-content { - max-width: 72rem; - margin: 0 auto; - padding: 1.5rem 2rem 3rem; +.summary-row svg { + width: 1.25rem; + height: 1.25rem; } -.account-grid { +.summary-body { display: grid; - grid-template-columns: repeat(2, minmax(0, 1fr)); - gap: 1.5rem; -} - -.account-card { + gap: 0.125rem; min-width: 0; - padding: 1.5rem; - border: 1pt solid var(--account-border); - background: var(--account-surface); - box-shadow: 0 1pt 2pt rgba(0, 0, 0, 0.06); } -.account-card-wide { - grid-column: 1 / -1; +.summary-title { + font-size: 0.9375rem; + font-weight: 500; + line-height: 1.4; } -.account-card h2 { - margin: 0 0 1rem; - font-size: 1.25rem; - font-weight: 400; - line-height: 1.3; +.summary-meta { + color: var(--muted); + font-size: 0.8125rem; + line-height: 1.4; } -.account-definition { - margin: 0; +.summary-arrow { + display: none; + color: var(--muted); + font-size: 1.125rem; + line-height: 1; } -.account-definition > div { +.security-stack, +.apps-stack { display: grid; - grid-template-columns: 9rem minmax(0, 1fr); gap: 1rem; - padding: 0.75rem 0; - border-bottom: 1pt solid var(--account-border); + max-width: 56rem; + margin: 0 auto; } -.account-definition > div:last-child { - border-bottom: 0; - padding-bottom: 0; +.surface-row { + display: grid; + grid-template-columns: 1.5rem minmax(0, 1fr); + align-items: center; + gap: 1rem; + padding: 1rem 0.75rem; + background: var(--row); } -.account-definition dt { - color: var(--account-muted); - font-size: 0.875rem; - line-height: 1.5; +.surface-row svg { + width: 1.25rem; + height: 1.25rem; } -.account-definition dd { - margin: 0; - overflow-wrap: anywhere; +.surface-row strong { + display: block; font-size: 0.9375rem; - line-height: 1.5; -} - -.account-note { - margin: 0; - color: var(--account-muted); - font-size: 0.875rem; - line-height: 1.5; -} - -.account-alert { - margin: 0 0 1.5rem; - padding: 0.75rem 1rem; - border: 1pt solid var(--account-border); - border-left: 3pt solid var(--account-danger); - background: var(--account-surface); - font-size: 0.875rem; - line-height: 1.5; + font-weight: 500; + line-height: 1.4; } -.account-loading { - padding: 1rem 0; - color: var(--account-muted); - font-size: 0.875rem; +.surface-row span { + color: var(--muted); + font-size: 0.8125rem; + line-height: 1.4; } -.account-notice { - margin: 0 0 1.5rem; - padding: 0.75rem 1rem; - border: 1pt solid var(--account-border); - border-left: 3pt solid var(--account-accent); - background: var(--account-surface); - font-size: 0.875rem; - line-height: 1.5; -} - -.account-card-note { - margin-top: 1rem; -} - -.account-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 1rem; - margin-top: 1.5rem; +.status { + display: none; + color: var(--muted); + font-size: 0.8125rem; + line-height: 1.4; } -.account-danger { - padding: 0.5rem 0.75rem; - border: 1pt solid var(--account-danger); - border-radius: 0; - background: transparent; - color: var(--account-danger); +.danger-link { + padding: 0.5rem 0; + border: 0; + background: none; + color: var(--danger); font: inherit; font-size: 0.875rem; cursor: pointer; } -.account-danger:hover:not(:disabled) { - background: var(--account-danger); - color: var(--account-surface); +.danger-link:hover:not(:disabled) { + filter: brightness(1.1); } -.account-danger:disabled { - opacity: 0.5; +.danger-link:disabled { cursor: default; + opacity: 0.55; } -.account-status-page { - display: grid; - place-items: center; - min-height: 100vh; - padding: 2rem; - background: var(--account-canvas); - color: var(--account-text); -} - -.account-status-panel { - width: 30rem; - max-width: calc(100vw - 2rem); - padding: 2rem; - border: 1pt solid var(--account-border); - border-left: 3pt solid var(--account-accent); - background: var(--account-surface); -} - -.account-status-panel h1 { - margin: 0 0 1rem; - font-size: 1.5rem; - font-weight: 400; +.details + .note { + margin-top: 1rem; } -.account-link { - display: inline-block; +.note + .note { margin-top: 1rem; - color: var(--account-accent); - font-size: 0.875rem; } -.account-link:hover { - text-decoration: none; +.panel-heading { + display: flex; + align-items: center; + gap: 0.75rem; + margin-bottom: 1rem; } -.account-app a:focus-visible, -.account-app button:focus-visible, -.account-status-page a:focus-visible { - outline: 2pt solid var(--account-accent); - outline-offset: 2pt; +.panel-heading svg { + flex: none; + width: 1.25rem; + height: 1.25rem; } -@media (max-width: 60em) { - .account-content { - padding: 1rem 1rem 2rem; - } - - .account-page-header, - .account-topbar { - padding-left: 1rem; - padding-right: 1rem; - } - - .account-grid { - grid-template-columns: minmax(0, 1fr); - gap: 1rem; - } +.panel-heading h2 { + margin: 0; } -@media (max-width: 30em) { - .account-definition > div { - grid-template-columns: minmax(0, 1fr); - gap: 0.25rem; - } +.skeleton-medium { + width: 62%; } -@media (prefers-color-scheme: dark) { - .account-app, - .account-status-page { - --account-canvas: #1b1d1f; - --account-surface: #242628; - --account-topbar: #111315; - --account-border: #3a3d40; - --account-text: #e7e7e7; - --account-muted: #a0a4a8; - --account-danger: #f28b82; +@media (min-width: 40em) { + .summary-row, + .surface-row { + grid-template-columns: 1.5rem minmax(0, 1fr) auto; } - .account-app { - color-scheme: dark; + .summary-arrow, + .status { + display: inline; } } diff --git a/app/account/src/main.ts b/app/account/src/main.ts @@ -2,12 +2,19 @@ import m from 'mithril'; import { Account, AccountCallback } from './screen/account'; import { getBasePath } from './util/api'; +import '@style/global.css'; import './assets/account.css'; const routes: m.RouteDefs = { '/': { render: () => m(Account, {}), }, + '/security': { + render: () => m(Account, {}), + }, + '/apps': { + render: () => m(Account, {}), + }, '/callback': { render: () => m(AccountCallback, {}), }, diff --git a/app/account/src/screen/account.tsx b/app/account/src/screen/account.tsx @@ -1,4 +1,11 @@ +import { AppWindow, LayoutGrid, ShieldCheck } from 'lucide'; import m from 'mithril'; +import { AppShell } from '@component/app-shell'; +import { Nav, type NavItem } from '@component/nav'; +import { StatusPage } from '@component/status-page'; +import { Topbar } from '@component/topbar'; +import { UserMenu } from '@component/user-menu'; +import { applyTheme, cycleTheme, getTheme, type Theme } from '@util/theme'; import { appUrl, getClientConsent, @@ -7,6 +14,7 @@ import { getFullAccountUrl, revokeClientConsent, type ClientConsentInfo, + type Discovery, type SessionInfo, type UserInfo, } from '../util/api'; @@ -16,18 +24,24 @@ import { getAccountTokens, loadAccountUser, startAccountLogin, + type AccountTokens, } from '../util/auth'; -import { formatTime } from '@util/format'; +import { AppsPage } from './apps'; +import { ClientOverviewPage, LoadingOverview, OverviewPage } from './overview'; +import { SecurityPage } from './security'; type Mode = 'oidc' | 'client'; +type Page = 'overview' | 'security' | 'apps'; -function PageHeader(title: string, subtitle: string) { - return ( - <div class="account-page-header"> - <h1>{title}</h1> - <p>{subtitle}</p> - </div> - ); +function currentPath() { + return (m.route.get() || '/').split('?')[0]; +} + +function currentPage(): Page { + const path = currentPath(); + if (path === '/security') return 'security'; + if (path === '/apps') return 'apps'; + return 'overview'; } export const Account: m.Component = { @@ -35,36 +49,48 @@ export const Account: m.Component = { user: null as UserInfo | null, session: null as SessionInfo | null, consent: null as ClientConsentInfo | null, + discovery: null as Discovery | null, fullAccountUrl: null as string | null, notice: null as string | null, error: null as Error | null, pending: false, revokePending: false, + signedOut: false, + theme: getTheme() as Theme, oninit(this: any) { + applyTheme(this.theme); this.load(); }, + onupdate(this: any) { + this.updateTitle(); + }, + async load(this: any) { try { const discovery = await getDiscovery(); + this.discovery = discovery; + if (!discovery) { this.mode = 'client'; + if (currentPage() !== 'overview') { + m.route.set('/', null, { replace: true }); + } this.session = await getClientSession(); const clientId = this.session.scope.client_id; if (clientId) { this.consent = await getClientConsent(clientId); } this.fullAccountUrl = this.consent?.account_url || (await getFullAccountUrl()); - document.title = 'Account'; } else if (!getAccountTokens()) { await startAccountLogin(); return; } else { this.mode = 'oidc'; this.user = await loadAccountUser(); - document.title = 'Account'; } + this.updateTitle(); } catch (e) { const error = e as any; if (this.mode === 'oidc' && (error?.status === 401 || error?.status === 400)) { @@ -82,6 +108,7 @@ export const Account: m.Component = { }, async signOut(this: any) { + if (this.pending) return; this.pending = true; this.error = null; if (this.mode === 'client') { @@ -91,6 +118,7 @@ export const Account: m.Component = { credentials: 'same-origin', }); this.session = null; + this.signedOut = true; this.pending = false; m.redraw(); } catch (e) { @@ -119,165 +147,137 @@ export const Account: m.Component = { m.redraw(); }, - view(this: any) { - const tokens = getAccountTokens(); - const user = this.user; - const session = this.session; - const name = user?.name || session?.user.display_name || session?.user.username; + updateTitle(this: any) { + const page = currentPage(); + if (this.mode === 'client') { + document.title = 'Account'; + return; + } + document.title = + page === 'security' + ? 'Security · Account' + : page === 'apps' + ? 'Apps · Account' + : 'Account'; + }, - return ( - <div class="account-app"> - <header class="account-topbar"> - <a class="account-brand" href={appUrl('/')}> - Account - </a> - <button - class="account-signout" - type="button" - disabled={this.pending || (!user && !session)} - onclick={() => this.signOut()} - > - {this.pending ? 'Signing out' : 'Sign out'} - </button> - </header> + cycleTheme(this: any) { + this.theme = cycleTheme(); + }, - {PageHeader('Account', 'Identity and access settings')} + view(this: any) { + const page = currentPage(); + const activePage = this.mode === 'client' ? 'overview' : page; + const tokens = getAccountTokens() as AccountTokens | null; + const name = + this.user?.name || this.session?.user.display_name || this.session?.user.username; + const meta = + this.user?.email || + this.user?.preferred_username || + this.session?.user.username || + 'Loading account'; - <main class="account-content"> - {this.error ? ( - <div class="account-alert" role="alert"> - {this.error.message} - </div> - ) : null} + const navItems: NavItem[] = [ + { + href: appUrl('/'), + label: 'Overview', + icon: LayoutGrid, + active: activePage === 'overview', + onclick: (event: Event) => { + event.preventDefault(); + m.route.set('/'); + }, + }, + ]; - {this.notice ? ( - <div class="account-notice" role="status"> - {this.notice} - </div> - ) : null} + if (this.mode !== 'client') { + navItems.push( + { + href: appUrl('/security'), + label: 'Security', + icon: ShieldCheck, + active: activePage === 'security', + onclick: (event: Event) => { + event.preventDefault(); + m.route.set('/security'); + }, + }, + { + href: appUrl('/apps'), + label: 'Apps', + icon: AppWindow, + active: activePage === 'apps', + onclick: (event: Event) => { + event.preventDefault(); + m.route.set('/apps'); + }, + } + ); + } - {!name ? ( - <div class="account-loading">Loading account</div> - ) : ( - <div class="account-grid"> - <section class="account-card"> - <h2>Identity</h2> - <dl class="account-definition"> - <div> - <dt>Name</dt> - <dd>{name}</dd> - </div> - <div> - <dt>Username</dt> - <dd>{user?.preferred_username || session?.user.username}</dd> - </div> - <div> - <dt>Email</dt> - <dd>{user?.email || 'Not set'}</dd> - </div> - <div> - <dt>Session</dt> - <dd>{session ? session.scope.type : 'account client'}</dd> - </div> - </dl> - </section> + return ( + <AppShell + topbar={ + <Topbar + href={appUrl('/')} + label="Auth account" + onclick={(event: Event) => { + event.preventDefault(); + m.route.set('/'); + }} + > + <UserMenu + name={name || 'Account'} + meta={meta} + theme={this.theme} + onCycleTheme={() => this.cycleTheme()} + onSignOut={() => { + this.signOut().catch((error: Error) => { + this.error = error; + m.redraw(); + }); + }} + /> + </Topbar> + } + nav={<Nav label="Account" ariaLabel="Account" items={navItems} />} + > + {this.error ? ( + <div class="alert" role="alert"> + {this.error.message} + </div> + ) : null} - <section class="account-card"> - <h2>Access</h2> - <dl class="account-definition"> - <div> - <dt>Client</dt> - <dd>{session?.scope.client_id || 'account'}</dd> - </div> - <div> - <dt>Realm</dt> - <dd>{session?.realm?.display_name || 'Global'}</dd> - </div> - <div> - <dt>Expires</dt> - <dd>{formatTime(session?.expires_at || tokens?.expires_at)}</dd> - </div> - <div> - <dt>Permissions</dt> - <dd> - {session - ? this.consent?.active - ? 'Granted' - : 'Not granted' - : 'Full account'} - </dd> - </div> - </dl> - </section> + {this.notice ? ( + <div class="notice" role="status"> + {this.notice} + </div> + ) : null} - {this.mode === 'client' ? ( - <section class="account-card account-card-wide"> - <h2>App access</h2> - <dl class="account-definition"> - <div> - <dt>App</dt> - <dd>{this.consent?.client.name || session?.scope.client_id}</dd> - </div> - <div> - <dt>Scopes</dt> - <dd> - {this.consent?.scopes.length - ? this.consent.scopes.join(', ') - : 'None'} - </dd> - </div> - <div> - <dt>Granted</dt> - <dd> - {this.consent?.consent - ? formatTime(this.consent.consent.created_at) - : 'Not granted'} - </dd> - </div> - <div> - <dt>Revoked</dt> - <dd> - {this.consent?.consent?.revoked_at - ? formatTime(this.consent.consent.revoked_at) - : 'Not revoked'} - </dd> - </div> - </dl> - <p class="account-note account-card-note"> - {this.consent?.active - ? `${this.consent.client.name} can use the access above. Revoking it does not sign you out here.` - : `${session?.scope.client_id || 'This app'} no longer has access to your account.`} - </p> - <div class="account-actions"> - {this.consent?.active ? ( - <button - class="account-danger" - type="button" - disabled={this.revokePending} - onclick={() => this.revokeConsent()} - > - {this.revokePending ? 'Revoking' : 'Revoke access'} - </button> - ) : null} - {this.fullAccountUrl ? ( - <a class="account-link" href={this.fullAccountUrl}> - Open full account - </a> - ) : null} - </div> - </section> - ) : ( - <section class="account-card account-card-wide"> - <h2>Permissions</h2> - <p class="account-note"> - App permissions and consent management arrive in the next account slice. - </p> - </section> - )} - </div> - )} - </main> - </div> + {this.signedOut ? ( + <div class="empty"> + <p>You are signed out.</p> + </div> + ) : !name ? ( + this.error ? null : ( + <LoadingOverview /> + ) + ) : this.mode === 'client' ? ( + <ClientOverviewPage + session={this.session!} + consent={this.consent} + fullAccountUrl={this.fullAccountUrl} + revokePending={this.revokePending} + onRevoke={() => this.revokeConsent()} + /> + ) : activePage === 'security' ? ( + <SecurityPage /> + ) : activePage === 'apps' ? ( + <AppsPage /> + ) : ( + <OverviewPage user={this.user!} discovery={this.discovery} tokens={tokens} /> + )} + </AppShell> ); }, }; @@ -302,23 +302,20 @@ export const AccountCallback: m.Component = { view(this: any) { return ( - <div class="account-status-page"> - <div class="account-status-panel"> - <h1>{this.error ? 'Sign-in failed' : 'Completing sign-in'}</h1> - {this.error ? ( - <p class="account-alert" role="alert"> - {this.error.message} - </p> - ) : ( - <p class="account-note">Establishing the account session.</p> - )} - {this.error ? ( - <a class="account-link" href={appUrl('/')}> - Return to account - </a> - ) : null} - </div> - </div> + <StatusPage + title={this.error ? 'Sign-in failed' : 'Completing sign-in'} + message={ + this.error + ? this.error.message + : 'Establishing the account session.' + } + error={Boolean(this.error)} + action={ + this.error + ? { href: appUrl('/'), label: 'Return to account' } + : undefined + } + /> ); }, }; diff --git a/app/account/src/screen/apps.tsx b/app/account/src/screen/apps.tsx @@ -0,0 +1,22 @@ +import m from 'mithril'; +import { PageHeader } from '@component/page-header'; + +export const AppsPage: m.Component = { + view() { + return ( + <div> + <PageHeader + title="Apps" + subtitle="Applications with access to this account." + /> + + <div class="apps-stack"> + <section class="panel"> + <h2>Authorized apps</h2> + <p class="note">App permission management arrives in a later slice.</p> + </section> + </div> + </div> + ); + }, +}; diff --git a/app/account/src/screen/overview.tsx b/app/account/src/screen/overview.tsx @@ -0,0 +1,257 @@ +import { AppWindow, ShieldCheck } from 'lucide'; +import m from 'mithril'; +import { Icon } from '@component/icon'; +import { PageHeader } from '@component/page-header'; +import type { AccountTokens } from '../util/auth'; +import type { ClientConsentInfo, Discovery, SessionInfo, UserInfo } from '../util/api'; + +interface OverviewAttrs { + user: UserInfo; + discovery: Discovery | null; + tokens: AccountTokens | null; +} + +interface ClientOverviewAttrs { + session: SessionInfo; + consent: ClientConsentInfo | null; + fullAccountUrl: string | null; + revokePending: boolean; + onRevoke: () => void; +} + +export const OverviewPage: m.Component<OverviewAttrs> = { + view({ attrs }) { + const { user, discovery, tokens } = attrs; + const account = discovery?.realm || 'Global'; + + return ( + <div> + <PageHeader + title="Overview" + subtitle="Identity and access settings for this account." + /> + + <div class="grid"> + <section class="panel"> + <h2>Identity</h2> + <dl class="details"> + <div> + <dt>Name</dt> + <dd>{user.name}</dd> + </div> + <div> + <dt>Username</dt> + <dd>{user.preferred_username}</dd> + </div> + <div> + <dt>Email</dt> + <dd>{user.email || 'Not set'}</dd> + </div> + <div> + <dt>Account</dt> + <dd>{account}</dd> + </div> + </dl> + </section> + + <section class="panel"> + <h2>Access</h2> + <dl class="details"> + <div> + <dt>Client</dt> + <dd>account</dd> + </div> + <div> + <dt>Realm</dt> + <dd>{account}</dd> + </div> + <div> + <dt>Scope</dt> + <dd>{tokens?.scope || 'openid'}</dd> + </div> + <div> + <dt>Session</dt> + <dd>Active</dd> + </div> + </dl> + </section> + </div> + + <section class="panel panel-wide"> + <h2>Manage</h2> + <ul class="summary-list"> + <li> + <a + class="summary-row" + href="#" + onclick={(event: Event) => { + event.preventDefault(); + m.route.set('/security'); + }} + > + {Icon(ShieldCheck)} + <span class="summary-body"> + <span class="summary-title">Security</span> + <span class="summary-meta"> + Password, multi-factor authentication and sessions. + </span> + </span> + <span class="summary-arrow" aria-hidden="true"> + › + </span> + </a> + </li> + <li> + <a + class="summary-row" + href="#" + onclick={(event: Event) => { + event.preventDefault(); + m.route.set('/apps'); + }} + > + {Icon(AppWindow)} + <span class="summary-body"> + <span class="summary-title">Apps</span> + <span class="summary-meta"> + Applications with access to this account. + </span> + </span> + <span class="summary-arrow" aria-hidden="true"> + › + </span> + </a> + </li> + </ul> + </section> + </div> + ); + }, +}; + +export const ClientOverviewPage: m.Component<ClientOverviewAttrs> = { + view({ attrs }) { + const { session, consent, fullAccountUrl, revokePending, onRevoke } = attrs; + const name = session.user.display_name || session.user.username; + const clientName = consent?.client.name || session.scope.client_id || 'This app'; + const realm = session.realm?.display_name || 'Global'; + + return ( + <div> + <PageHeader title="Overview" subtitle={`Signed in through ${clientName}.`} /> + + <div class="grid"> + <section class="panel"> + <h2>Identity</h2> + <dl class="details"> + <div> + <dt>Name</dt> + <dd>{name}</dd> + </div> + <div> + <dt>Username</dt> + <dd>{session.user.username}</dd> + </div> + <div> + <dt>Account</dt> + <dd>{realm}</dd> + </div> + </dl> + </section> + + <section class="panel"> + <h2>This app</h2> + <dl class="details"> + <div> + <dt>Client</dt> + <dd>{clientName}</dd> + </div> + <div> + <dt>Client ID</dt> + <dd>{session.scope.client_id || 'None'}</dd> + </div> + <div> + <dt>Realm</dt> + <dd>{realm}</dd> + </div> + <div> + <dt>Scopes</dt> + <dd>{consent?.scopes.length ? consent.scopes.join(', ') : 'None'}</dd> + </div> + </dl> + </section> + </div> + + <section class="panel panel-wide"> + <h2>Access</h2> + <dl class="details"> + <div> + <dt>Consent</dt> + <dd>{consent?.active ? 'Granted' : 'Not granted'}</dd> + </div> + <div> + <dt>Session</dt> + <dd>Active</dd> + </div> + </dl> + <p class="note"> + {consent?.active + ? `Revoking access removes ${clientName}'s consent. The app must ask again the next time it signs you in.` + : `${clientName} no longer has access to this account.`} + </p> + {consent?.active ? ( + <p class="note"> + <button + class="danger-link" + type="button" + disabled={revokePending} + onclick={onRevoke} + > + {revokePending ? 'Revoking' : 'Revoke access'} + </button> + </p> + ) : null} + </section> + + <section class="panel panel-wide"> + <h2>Full account management</h2> + <p class="note"> + Manage your identity, security and app permissions on the account host. + </p> + {fullAccountUrl ? ( + <p class="note"> + <a class="button" href={fullAccountUrl}> + Open full account + </a> + </p> + ) : null} + </section> + </div> + ); + }, +}; + +export const LoadingOverview: m.Component = { + view() { + return ( + <div> + <PageHeader title="Overview" subtitle="Loading account." /> + + <div class="grid"> + <section class="panel"> + <div class="skeleton skeleton-title"></div> + <div class="skeleton"></div> + <div class="skeleton skeleton-medium"></div> + <div class="skeleton skeleton-short"></div> + </section> + <section class="panel"> + <div class="skeleton skeleton-title"></div> + <div class="skeleton"></div> + <div class="skeleton skeleton-short"></div> + <div class="skeleton skeleton-medium"></div> + </section> + </div> + </div> + ); + }, +}; diff --git a/app/account/src/screen/security.tsx b/app/account/src/screen/security.tsx @@ -0,0 +1,61 @@ +import { FileKey, KeyRound, Monitor, ShieldCheck, Smartphone } from 'lucide'; +import m from 'mithril'; +import { Icon, type IconNode } from '@component/icon'; +import { PageHeader } from '@component/page-header'; + +function PanelHeading(icon: IconNode, title: string) { + return ( + <div class="panel-heading"> + {Icon(icon)} + <h2>{title}</h2> + </div> + ); +} + +export const SecurityPage: m.Component = { + view() { + return ( + <div> + <PageHeader + title="Security" + subtitle="Manage how you sign in and where this account is active." + /> + + <div class="security-stack"> + <section class="panel"> + {PanelHeading(KeyRound, 'Password')} + <p class="note">Password management arrives in a later slice.</p> + </section> + + <section class="panel"> + {PanelHeading(Smartphone, 'OTP app')} + <p class="note">Authenticator apps are not available yet.</p> + </section> + + <section class="panel"> + {PanelHeading(ShieldCheck, 'Security keys')} + <p class="note">Security keys and YubiKeys are not available yet.</p> + </section> + + <section class="panel"> + {PanelHeading(FileKey, 'Recovery codes')} + <p class="note">Recovery codes are not available yet.</p> + </section> + + <section class="panel"> + {PanelHeading(Monitor, 'Sessions')} + <div class="surface-row"> + {Icon(Monitor)} + <span> + <strong>Current session</strong> + <span>account · This device · Active</span> + </span> + <span class="status">Read-only</span> + </div> + <p class="note">Session revocation arrives in a later slice.</p> + </section> + </div> + </div> + ); + }, +}; diff --git a/app/shared/component/user-menu.tsx b/app/shared/component/user-menu.tsx @@ -6,7 +6,7 @@ import { Icon } from '@component/icon'; interface UserMenuAttrs { name: string; meta: string; - accountHref: string; + accountHref?: string; theme: Theme; onCycleTheme: () => void; onSignOut: () => void; @@ -35,10 +35,12 @@ export const UserMenu: m.Component<UserMenuAttrs> = { <span class="user-meta">{attrs.meta}</span> </div> <div class="user-menu-list"> - <a class="user-menu-item" href={attrs.accountHref}> - {Icon(Settings)} - <span>Account settings</span> - </a> + {attrs.accountHref ? ( + <a class="user-menu-item" href={attrs.accountHref}> + {Icon(Settings)} + <span>Account settings</span> + </a> + ) : null} <button class="user-menu-item" type="button" diff --git a/mockup/account.html b/mockup/plain/account.html diff --git a/mockup/admin-dashboard.html b/mockup/plain/admin-dashboard.html diff --git a/mockup/consent.html b/mockup/plain/consent.html diff --git a/mockup/error-pages.html b/mockup/plain/error-pages.html diff --git a/mockup/global.css b/mockup/plain/global.css diff --git a/mockup/hex-grid-dark.svg b/mockup/plain/hex-grid-dark.svg diff --git a/mockup/hex-grid-light.svg b/mockup/plain/hex-grid-light.svg diff --git a/server/test/http.test.js b/server/test/http.test.js @@ -2141,7 +2141,7 @@ test('HTTP realm, login, OIDC and logout flows', async (t) => { const accountCanonical = await identity({ path: '/app/account' }); assert.equal(accountCanonical.status, 200); - assert.match(accountCanonical.text, /account-app/); + assert.match(accountCanonical.text, /app-shell/); const accountRealm = await acme({ path: '/app/account' }); assert.equal(accountRealm.status, 200);