auth

Main authentication module for my projects
git clone git://git.finwo.net/app/auth
Log | Files | Refs

commit 2daf9ab8eb7f387cb54723b9c887304ff1739cba
parent e467c58535e9c1bde755b8efefe0374039666018
Author: finwo <finwo@pm.me>
Date:   Wed, 18 Nov 2026 02:01:21 +0100

admin: migrate SPA screens onto CSS framework classes

Diffstat:
Dapp/admin/src/assets/admin.css | 587-------------------------------------------------------------------------------
Mapp/admin/src/component/client-form.tsx | 48++++++++++++++++++++++++------------------------
Mapp/admin/src/component/client-hosts.tsx | 104+++++++++++++++++++++++++++++++++++++------------------------------------------
Mapp/admin/src/component/realm-selector.tsx | 8++++----
Mapp/admin/src/main.ts | 2+-
Mapp/admin/src/screen/admin.tsx | 2+-
Mapp/admin/src/screen/client-edit.tsx | 34+++++++++++++++++-----------------
Mapp/admin/src/screen/clients.tsx | 157++++++++++++++++++++++++++++++++++++++++---------------------------------------
Mapp/admin/src/screen/global-user.tsx | 108+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mapp/admin/src/screen/hosts.tsx | 106+++++++++++++++++++++++++++++++++++++------------------------------------------
Mapp/admin/src/screen/realms.tsx | 245++++++++++++++++++++++++++++++++++++++-----------------------------------------
Mapp/admin/src/screen/sessions.tsx | 40++++++++++++++++++++--------------------
Mapp/admin/src/screen/settings.tsx | 30+++++++++++++++---------------
Mapp/admin/src/screen/system-settings.tsx | 12++++++------
Mapp/admin/src/screen/user.tsx | 255+++++++++++++++++++++++++++++++++++++++----------------------------------------
Mapp/admin/src/screen/users.tsx | 197++++++++++++++++++++++++++++++++++++++++---------------------------------------
Aapp/admin/src/style/admin.css | 137+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
17 files changed, 797 insertions(+), 1275 deletions(-)

diff --git a/app/admin/src/assets/admin.css b/app/admin/src/assets/admin.css @@ -1,587 +0,0 @@ -.realm-select { - min-width: 0; - max-width: 100%; - display: grid; - gap: 0.25rem; -} - -.realm-select > span { - color: var(--muted); - font-size: 0.75rem; - line-height: 1.15; -} - -.realm-current { - color: var(--muted); - font-size: 0.875rem; - line-height: 1.5; -} - -.realm-meta { - display: block; - color: var(--muted); - font-size: 0.8125rem; - line-height: 1.4; -} - -.realm-meta > * { - display: inline; - margin-right: 0.75rem; -} - -.realm-meta > *:last-child { - margin-right: 0; -} - -.realm-count-link { - color: var(--accent-text); - cursor: pointer; - text-decoration: none; -} - -.realm-count-link:hover { - color: var(--accent-text-hover); -} - -.action-button { - display: inline-flex; - align-items: center; - min-height: 2rem; - padding: 0.25rem 0.625rem; - border: 0; - border-radius: 0.25rem; - background: transparent; - color: var(--muted); - font: inherit; - font-size: 0.8125rem; - font-weight: 500; - line-height: 1.4; - white-space: nowrap; - cursor: pointer; -} - -.action-button:hover { - background: var(--row-hover); - color: var(--text); -} - -.action-button:first-child { - margin-left: -0.625rem; -} - -.action-button.is-primary { - color: var(--accent-text); -} - -.action-button.is-primary:hover { - background: color-mix(in oklch, var(--accent) 12%, transparent); - color: var(--accent-text-hover); -} - -.action-button.is-danger { - color: var(--danger-text); -} - -.action-button.is-danger:hover { - background: color-mix(in oklch, var(--danger) 12%, transparent); - color: var(--danger-text); -} - -.host-name { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 0.8125rem; - overflow-wrap: anywhere; -} - -.host-added { - color: var(--muted); - font-size: 0.8125rem; -} - -.host-row-action { - display: flex; - align-items: center; -} - -.host-table td.host-action-column:not(:empty) { - padding-bottom: 0.75rem; -} - -.verify-record-name, -.verify-record-value { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; - font-size: 0.8125rem; -} - -.verify-copy-row { - display: flex; - justify-content: flex-end; - margin-top: 0.5rem; -} - -.realm-display { - color: inherit; - text-decoration: none; -} - -.realm-display:hover { - color: var(--accent-text-hover); -} - -.realm-slug, -.realm-owner-meta { - font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace; -} - -.realm-owner-name { - display: block; - font-weight: 500; - line-height: 1.4; -} - -.realm-owner-meta { - display: block; - margin-top: 0.125rem; - color: var(--muted); - font-size: 0.8125rem; - line-height: 1.4; - overflow-wrap: anywhere; -} - -.realm-table td.realm-action-column:not(:empty) { - padding-bottom: 0.75rem; -} - -.realm-row-action { - display: flex; - align-items: center; -} - -.realm-table-panel .table-actions { - width: 100%; - flex-direction: column; - align-items: stretch; -} - -.realm-table-panel .table-actions .button { - width: 100%; -} - -.realm-create-form .field-grid { - margin-top: 1rem; -} - -.realm-create-form .branding-preview { - margin-bottom: 1rem; -} - -.session-stack { - display: grid; - gap: 1rem; -} - -.session-header { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - justify-content: space-between; - gap: 1rem; -} - -.session-header h2 { - margin: 0; -} - -.session-user { - margin: 0.25rem 0 0; - color: var(--muted); - font-size: 0.8125rem; - line-height: 1.4; -} - -.session-badge { - color: var(--danger-text); - font-size: 0.75rem; - line-height: 1.4; -} - -.session-details { - margin-top: 1.25rem; -} - -.session-agent { - margin: 0.75rem 0 0; - color: var(--muted); - font-size: 0.75rem; - line-height: 1.5; - overflow-wrap: anywhere; -} - -.session-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0.5rem; - margin-top: 1.25rem; -} - -.confirm { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0.5rem; - color: var(--muted); - font-size: 0.875rem; - line-height: 1.5; -} - -.section-header { - display: flex; - flex-wrap: wrap; - align-items: center; - justify-content: space-between; - gap: 1rem; - margin-bottom: 1.25rem; -} - -.section-header h2 { - margin: 0; -} - -.client-stack { - display: grid; - gap: 1rem; -} - -.breadcrumb { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0.5rem; - margin-bottom: 1rem; - color: var(--muted); - font-size: 0.8125rem; - line-height: 1.4; -} - -.breadcrumb a { - color: var(--accent-text); - text-decoration: none; -} - -.client-header { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - justify-content: space-between; - gap: 1rem; -} - -.client-header h2 { - margin: 0; -} - -.client-title, -.user-title { - color: inherit; - text-decoration: none; -} - -.client-title:hover, -.user-title:hover { - color: var(--accent-text-hover); -} - -.client-id { - margin: 0.25rem 0 0; - color: var(--muted); - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 0.8125rem; - line-height: 1.4; - overflow-wrap: anywhere; -} - -.client-badge { - color: var(--muted); - font-size: 0.75rem; - line-height: 1.4; - text-transform: uppercase; -} - -.client-details { - margin-top: 1.25rem; -} - -.client-actions { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0.5rem; - margin-top: 1.25rem; -} - -.client-form { - display: grid; - gap: 1rem; - margin-top: 1rem; -} - -.modal-body .client-form { - margin-top: 0; -} - -.settings-stack { - min-width: 0; - display: grid; - grid-template-columns: minmax(0, 1fr); - gap: 1rem; -} - -.settings-form { - min-width: 0; - display: grid; - grid-template-columns: minmax(0, 1fr); - width: 100%; - max-width: 100%; - gap: 1rem; - margin-top: 1rem; -} - -.settings-form .form-field { - margin-bottom: 0; -} - -.settings-actions { - display: flex; - flex-wrap: wrap; - justify-content: flex-start; - gap: 0.5rem; - margin-top: 1rem; -} - -.settings-actions .button { - max-width: 100%; -} - -.branding-preview { - display: flex; - flex-wrap: wrap; - align-items: center; - gap: 0.75rem; - margin-top: 0.25rem; -} - -.branding-logo-preview, -.branding-color-preview { - width: 2rem; - height: 2rem; - overflow: hidden; - background: var(--row); -} - -.branding-logo-preview { - display: inline-flex; - align-items: center; - justify-content: center; - color: var(--muted); -} - -.branding-logo-preview img { - width: 100%; - height: 100%; - object-fit: contain; -} - -.branding-color-preview { - border-radius: 0.25rem; - background: var(--field-line); -} - -.branding-logo-preview.is-empty, -.branding-color-preview.is-empty { - border-bottom: 1pt solid var(--field-line); -} - -.field-grid { - display: grid; - grid-template-columns: minmax(0, 1fr); - gap: 1rem; -} - -.form-field { - min-width: 0; - max-width: 100%; - display: grid; - gap: 0.25rem; -} - -.field-label { - color: var(--muted); - font-size: 0.75rem; - line-height: 1.4; -} - -.field-control, -.field-textarea { - width: 100%; - min-width: 0; - max-width: 100%; - padding: 0.5rem 0.75rem; - border: 0; - border-bottom: 1pt solid var(--field-line); - border-radius: 0; - background: var(--surface); - color: inherit; - font: inherit; - font-size: 0.875rem; - line-height: 1.5; -} - -.field-textarea { - min-height: 6rem; - resize: vertical; -} - -@media (pointer: coarse) { - .field-control, - .field-textarea { - font-size: 1rem; - } -} - -.field-control:focus, -.field-textarea:focus { - outline: 2pt solid var(--accent); - outline-offset: 2pt; -} - -.field-control:disabled { - color: var(--muted); - opacity: 1; -} - -.role-field { - margin: 0; - padding: 0; - border: 0; -} - -.role-field legend { - margin-bottom: 0.5rem; - padding: 0; - color: var(--muted); - font-size: 0.75rem; - line-height: 1.4; -} - -.branding-field { - margin: 0; - padding: 0; - border: 0; -} - -.branding-field legend { - margin-bottom: 0.5rem; - padding: 0; - color: var(--muted); - font-size: 0.75rem; - line-height: 1.4; -} - -.checkbox-list { - display: grid; - gap: 0.5rem; -} - -.checkbox-row { - display: flex; - align-items: center; - gap: 0.5rem; - font-size: 0.875rem; - line-height: 1.5; -} - -.checkbox-row input { - width: 1rem; - height: 1rem; -} - -.secret-panel { - display: grid; - gap: 0.75rem; -} - -.secret-header { - display: flex; - flex-wrap: wrap; - align-items: flex-start; - justify-content: space-between; - gap: 1rem; -} - -.secret-header h2 { - margin: 0; -} - -.danger-zone h2 { - color: var(--danger-text); -} - -.secret-value { - display: block; - margin-top: 1rem; - padding: 0.75rem; - background: var(--row); - color: inherit; - font-family: ui-monospace, SFMono-Regular, Menlo, monospace; - font-size: 0.8125rem; - line-height: 1.5; - overflow-wrap: anywhere; - white-space: pre-wrap; -} - -@media (min-width: 40em) { - .field-grid { - grid-template-columns: repeat(2, minmax(0, 1fr)); - } - - .realm-meta { - display: flex; - flex-wrap: wrap; - gap: 0.25rem 0.75rem; - } - - .realm-meta > span { - margin-right: 0; - } - - .realm-table { - table-layout: fixed; - } - - .realm-table .table-icon-column { - width: 4rem; - } - - .realm-table .realm-owner-column { - width: 13rem; - } - - .realm-table .realm-action-column { - width: 12rem; - } - - .realm-row-action { - justify-content: flex-start; - } - - .realm-table-panel .table-actions { - width: auto; - flex-direction: row; - align-items: center; - } - - .realm-table-panel .table-actions .button { - width: auto; - } -} diff --git a/app/admin/src/component/client-form.tsx b/app/admin/src/component/client-form.tsx @@ -110,7 +110,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { return ( <form - class="client-form" + class="stack-tight" onsubmit={(event: Event) => { event.preventDefault(); attrs.onsubmit(); @@ -123,7 +123,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { ) : null} <div class="field-grid"> - <div class="form-field"> + <div class="field"> <span class="field-label">Client ID</span> <input class="field-control" @@ -136,7 +136,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Name</span> <input class="field-control" @@ -147,7 +147,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label" id="client-access-mode-label">Access mode</span> <SelectMenu labelledBy="client-access-mode-label" @@ -164,7 +164,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label" id="client-consent-mode-label">Consent</span> <SelectMenu labelledBy="client-consent-mode-label" @@ -180,7 +180,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label" id="client-token-auth-label">Token authentication</span> <SelectMenu labelledBy="client-token-auth-label" @@ -198,7 +198,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <label class="checkbox-row"> + <label class="checkbox"> <input type="checkbox" checked={value.enabled} @@ -209,7 +209,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { <span>Enabled</span> </label> - <label class="checkbox-row"> + <label class="checkbox"> <input type="checkbox" checked={requirePkce} @@ -222,7 +222,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { </label> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Scopes</span> <input class="field-control" @@ -233,10 +233,10 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Redirect URIs</span> <textarea - class="field-control field-textarea" + class="field-textarea" value={value.redirect_uris} placeholder="https://app.example.test/callback" oninput={(event: Event) => { @@ -245,10 +245,10 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Post-logout redirect URIs</span> <textarea - class="field-control field-textarea" + class="field-textarea" value={value.post_logout_redirect_uris} placeholder="https://app.example.test/" oninput={(event: Event) => { @@ -257,11 +257,11 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <fieldset class="branding-field"> - <legend>Branding</legend> + <fieldset class="fieldset stack-tight"> + <legend class="field-label">Branding</legend> <p class="note">Optional client overrides. Empty values use this realm's branding.</p> <div class="field-grid"> - <div class="form-field"> + <div class="field"> <span class="field-label">Logo URL</span> <input class="field-control" @@ -278,7 +278,7 @@ export const ClientForm: m.Component<ClientFormAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Primary color</span> <input class="field-control" @@ -315,16 +315,16 @@ export const ClientForm: m.Component<ClientFormAttrs> = { </div> </fieldset> - <fieldset class="role-field"> - <legend>Required roles</legend> + <fieldset class="fieldset stack-tight"> + <legend class="field-label">Required roles</legend> {attrs.roles.length === 0 ? ( <p class="note">No realm roles are available.</p> ) : ( - <div class="checkbox-list"> + <div class="stack-tight"> {attrs.roles.map((role) => { const checked = value.required_roles.includes(role.slug); return ( - <label class="checkbox-row"> + <label class="checkbox"> <input type="checkbox" checked={checked} @@ -347,13 +347,13 @@ export const ClientForm: m.Component<ClientFormAttrs> = { )} </fieldset> - <div class="client-actions"> - <button class="button" type="submit" disabled={attrs.pending}> + <div class="action-row"> + <button class="button button-primary" type="submit" disabled={attrs.pending}> {attrs.pending ? 'Saving' : attrs.submitLabel} </button> {attrs.oncancel ? ( <button - class="button-secondary" + class="button button-secondary" type="button" disabled={attrs.pending} onclick={attrs.oncancel} diff --git a/app/admin/src/component/client-hosts.tsx b/app/admin/src/component/client-hosts.tsx @@ -190,7 +190,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { const visible = hosts ? hosts.filter((entry) => !term || entry.host.includes(term)) : []; return ( - <section class="panel" aria-label="Client hosts"> + <section class="panel stack-tight" aria-label="Client hosts"> <h2>Hosts</h2> <p class="note">Hostnames that resolve to this client.</p> @@ -204,7 +204,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => this.load(this.attrs.realmSlug, this.attrs.clientId)} > @@ -221,8 +221,8 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { </div> ) : ( <div> - <div class="table-toolbar"> - <div class="table-search"> + <div class="toolbar toolbar-panel"> + <div class="toolbar-search"> <input type="search" value={this.search} @@ -234,59 +234,53 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { /> </div> {canEdit ? ( - <div class="table-actions"> - <button class="button" type="button" onclick={() => this.openAdd()}> + <div class="toolbar-actions"> + <button class="button button-primary" type="button" onclick={() => this.openAdd()}> Add host </button> </div> ) : null} </div> - <div class="data-table-wrap"> - <table class="data-table data-table-static host-table"> - <thead> + <table class="table"> + <thead> + <tr> + <th scope="col">Hostname</th> + <th scope="col">Added</th> + {canEdit ? <th scope="col">Actions</th> : null} + </tr> + </thead> + <tbody> + {visible.map((entry: AdminClientHost) => ( <tr> - <th class="data-table-primary host-name-column" scope="col">Hostname</th> - <th class="host-added-column" scope="col">Added</th> - {canEdit ? <th class="host-action-column" scope="col">Actions</th> : null} - </tr> - </thead> - <tbody> - {visible.map((entry: AdminClientHost) => ( - <tr> - <td class="data-table-primary host-name-column" data-label="Hostname"> - <span class="host-name">{entry.host}</span> - </td> - <td class="host-added-column" data-label="Added"> - <span class="host-added">{formatDate(entry.created_at)}</span> + <td data-label="Hostname"> + <span class="table-mono">{entry.host}</span> + </td> + <td data-label="Added" class="table-meta u-nowrap">{formatDate(entry.created_at)}</td> + {canEdit ? ( + <td data-label="Actions"> + <button + class="button-inline button-danger" + type="button" + onclick={() => this.openRemove(entry.host)} + > + Remove + </button> </td> - {canEdit ? ( - <td class="host-action-column" data-label="Actions"> - <div class="host-row-action"> - <button - class="action-button is-danger" - type="button" - onclick={() => this.openRemove(entry.host)} - > - Remove - </button> - </div> - </td> - ) : null} - </tr> - ))} - </tbody> - </table> - {hosts.length > 0 && visible.length === 0 ? ( - <div class="empty"> - <p>No hosts match this search.</p> - </div> - ) : hosts.length === 0 ? ( - <div class="empty"> - <p>No hosts are assigned to this client.</p> - </div> - ) : null} - </div> + ) : null} + </tr> + ))} + </tbody> + </table> + {hosts.length > 0 && visible.length === 0 ? ( + <div class="empty"> + <p>No hosts match this search.</p> + </div> + ) : hosts.length === 0 ? ( + <div class="empty"> + <p>No hosts are assigned to this client.</p> + </div> + ) : null} </div> )} @@ -304,7 +298,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Hostname</span> <input class="field-control" @@ -330,14 +324,14 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.creating} onclick={() => this.resetAdd()} > Cancel </button> - <button class="button" type="submit" disabled={this.creating}> + <button class="button button-primary" type="submit" disabled={this.creating}> {this.creating ? 'Adding' : 'Add host'} </button> </div> @@ -358,7 +352,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Confirm hostname</span> <input class="field-control" @@ -380,7 +374,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.removing} onclick={() => this.resetRemove()} @@ -388,7 +382,7 @@ export const ClientHostsPanel: m.Component<ClientHostsAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={ this.removing || diff --git a/app/admin/src/component/realm-selector.tsx b/app/admin/src/component/realm-selector.tsx @@ -21,8 +21,8 @@ export const RealmSelector: m.Component<RealmSelectorAttrs> = { ]; return ( - <div class="realm-select"> - <span>Realm</span> + <div class="field"> + <span class="field-label">Realm</span> <SelectMenu autoWidth ariaLabel="Realm" @@ -35,11 +35,11 @@ export const RealmSelector: m.Component<RealmSelectorAttrs> = { } if (selected) { - return <span class="realm-current">{selected.display_name}</span>; + return <span class="u-muted">{selected.display_name}</span>; } if (selectedAll) { - return <span class="realm-current">All realms</span>; + return <span class="u-muted">All realms</span>; } return null; diff --git a/app/admin/src/main.ts b/app/admin/src/main.ts @@ -1,5 +1,5 @@ import '@style/global.css'; -import './assets/admin.css'; +import './style/admin.css'; import m from 'mithril'; import { applyTheme, getTheme } from '@util/theme'; diff --git a/app/admin/src/screen/admin.tsx b/app/admin/src/screen/admin.tsx @@ -552,7 +552,7 @@ export const Admin: m.Component = { ) : null} {!user || routeGuardActive || this.accountRedirecting ? ( - <div class="loading">Loading session</div> + <p class="note">Loading session</p> ) : realmsPath ? ( <RealmsPage realms={this.realms} diff --git a/app/admin/src/screen/client-edit.tsx b/app/admin/src/screen/client-edit.tsx @@ -265,7 +265,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => { if (this.attrs.realmSlug && clientId) { @@ -285,14 +285,14 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { ) : null} {this.secret ? ( - <div class="panel secret-panel"> - <div class="secret-header"> + <div class="panel stack-tight"> + <div class="section-header"> <div> <h2>Client secret</h2> <p class="note">{this.secret.clientId}</p> </div> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => { this.secret = null; @@ -307,7 +307,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : this.loading || this.redirecting ? ( <div class="panel" aria-busy="true"> <div class="skeleton skeleton-title"></div> @@ -315,7 +315,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : client ? ( - <div class="client-stack"> + <div class="stack"> <section class="panel"> <h2>Settings</h2> <ClientForm @@ -335,7 +335,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { /> </section> - <section class="panel"> + <section class="panel stack-tight"> <h2>Secret</h2> <p class="note"> {client.has_secret @@ -343,9 +343,9 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { : 'No client secret is configured. Creating one switches this client to confidential authentication.'} </p> {this.rotateConfirm ? ( - <div class="client-actions"> + <div class="action-row"> <button - class="button-danger" + class="button button-danger" type="button" disabled={this.rotating} onclick={() => this.rotate()} @@ -353,7 +353,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { {this.rotating ? 'Rotating' : 'Confirm'} </button> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.rotating} onclick={() => { @@ -365,9 +365,9 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { </button> </div> ) : ( - <div class="client-actions"> + <div class="action-row"> <button - class="button" + class="button button-primary" type="button" disabled={this.rotating} onclick={() => { @@ -389,14 +389,14 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { onAuthExpired={this.attrs.onAuthExpired} /> - <section class="panel danger-zone"> + <section class="panel danger-zone stack-tight"> <h2>Danger zone</h2> <p class="note"> Deleting removes the client registration and related authorization state. </p> - <div class="client-actions"> + <div class="action-row"> <button - class="button-danger" + class="button button-danger" type="button" onclick={() => this.openDelete()} > @@ -419,7 +419,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { </p> <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.deleting} onclick={() => this.cancelDelete()} @@ -427,7 +427,7 @@ export const ClientEditPage: m.Component<ClientEditAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={this.deleting} onclick={() => this.deleteClient()} diff --git a/app/admin/src/screen/clients.tsx b/app/admin/src/screen/clients.tsx @@ -254,7 +254,7 @@ export const ClientsPage: m.Component<ClientsAttrs> = { <p>{this.error.message}</p> {this.attrs.realmSlug ? ( <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => this.load(this.attrs.realmSlug)} > @@ -273,15 +273,15 @@ export const ClientsPage: m.Component<ClientsAttrs> = { {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : realms.length === 0 ? ( <div class="empty"> <p>No realms are available for this account.</p> </div> ) : ( - <div class="table-panel"> - <div class="table-toolbar"> - <div class="table-search"> + <section class="card" aria-label="Realm clients"> + <div class="toolbar toolbar-panel"> + <div class="toolbar-search"> <input type="search" value={this.search} @@ -292,9 +292,9 @@ export const ClientsPage: m.Component<ClientsAttrs> = { }} /> </div> - <div class="table-actions"> + <div class="toolbar-actions"> <button - class="button" + class="button button-primary" type="button" disabled={!this.attrs.realmSlug} onclick={() => this.openCreate()} @@ -317,78 +317,79 @@ export const ClientsPage: m.Component<ClientsAttrs> = { <p>No OIDC clients are registered in this realm.</p> </div> ) : ( - <div class="data-table-wrap"> - <table class="data-table"> - <thead> - <tr> - <th class="table-icon-column" scope="col"> - <span class="sr-only">Icon</span> - </th> - <th class="data-table-primary" scope="col">Application</th> - <th scope="col">Access</th> - </tr> - </thead> - <tbody> - {visibleClients.map((client: AdminClient) => { - const href = clientPath(this.attrs.realmSlug || '', client.client_id); - return ( - <tr - tabindex="0" - onclick={() => { - if (this.attrs.realmSlug) m.route.set(href); - }} - onkeydown={(event: KeyboardEvent) => { - if ( - event.target !== event.currentTarget || - !this.attrs.realmSlug - ) { - return; - } - if (event.key !== 'Enter' && event.key !== ' ') return; - event.preventDefault(); - m.route.set(href); - }} - > - <td class="table-icon-column"> - <span class="table-icon" aria-hidden="true"> - {client.logo_url ? ( - <img src={client.logo_url} alt="" /> - ) : ( - Icon(AppWindow) - )} - </span> - </td> - <td class="data-table-primary"> - <a - class="client-title" - href={appUrl(href)} - onclick={(event: MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - if (this.attrs.realmSlug) m.route.set(href); - }} - > - <strong>{client.name}</strong> - </a> - <span class="data-table-sub">{client.client_id}</span> - {client.enabled ? null : ( - <span class="data-table-status">Disabled</span> + <> + <table class="table table-linkable"> + <thead> + <tr> + <th scope="col"> + <span class="sr-only">Icon</span> + </th> + <th scope="col">Application</th> + <th scope="col">Access</th> + </tr> + </thead> + <tbody> + {visibleClients.map((client: AdminClient) => { + const href = clientPath(this.attrs.realmSlug || '', client.client_id); + return ( + <tr + tabindex="0" + role="link" + onclick={() => { + if (this.attrs.realmSlug) m.route.set(href); + }} + onkeydown={(event: KeyboardEvent) => { + if ( + event.target !== event.currentTarget || + !this.attrs.realmSlug + ) { + return; + } + if (event.key !== 'Enter' && event.key !== ' ') return; + event.preventDefault(); + m.route.set(href); + }} + > + <td> + <span class="table-icon" aria-hidden="true"> + {client.logo_url ? ( + <img src={client.logo_url} alt="" /> + ) : ( + Icon(AppWindow) )} - </td> - <td data-label="Access">{ACCESS_MODE_LABELS[client.access_mode]}</td> - </tr> - ); - })} - </tbody> - </table> - {visibleClients.length === 0 ? ( - <div class="empty"> - <p>No clients match this search.</p> - </div> - ) : null} - </div> + </span> + </td> + <td data-label="Application"> + <a + class="table-title link" + href={appUrl(href)} + onclick={(event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + if (this.attrs.realmSlug) m.route.set(href); + }} + > + {client.name} + </a> + <span class="table-sub">{client.client_id}</span> + {client.enabled ? null : ( + <span class="status-muted">Disabled</span> + )} + </td> + <td data-label="Access">{ACCESS_MODE_LABELS[client.access_mode]}</td> + </tr> + ); + })} + </tbody> + </table> + {visibleClients.length === 0 ? ( + <div class="empty"> + <p>No clients match this search.</p> + </div> + ) : null} + </> )} - </div> + </section> )} {this.createOpen ? ( @@ -425,7 +426,7 @@ export const ClientsPage: m.Component<ClientsAttrs> = { <code class="secret-value">{this.secret.secret}</code> <div class="modal-actions"> <button - class="button" + class="button button-primary" type="button" onclick={() => { this.secret = null; diff --git a/app/admin/src/screen/global-user.tsx b/app/admin/src/screen/global-user.tsx @@ -72,7 +72,7 @@ export const GlobalUserPage: m.Component<GlobalUserAttrs> = { <div> <Breadcrumb items={[{ label: 'Users', path: '/users/global' }, { label: displayName }]} /> <PageHeader row title="User" subtitle="Global identity and realm memberships."> - <a class="button-secondary" href={appUrl('/users/global')} onclick={(event: Event) => { + <a class="button button-secondary" href={appUrl('/users/global')} onclick={(event: Event) => { event.preventDefault(); m.route.set('/users/global'); }}> @@ -90,7 +90,7 @@ export const GlobalUserPage: m.Component<GlobalUserAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> {userId ? ( - <button class="button-secondary" type="button" onclick={() => this.load(userId)}> + <button class="button button-secondary" type="button" onclick={() => this.load(userId)}> Try again </button> ) : null} @@ -104,9 +104,9 @@ export const GlobalUserPage: m.Component<GlobalUserAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : ( - <div class="client-stack"> + <div class="stack"> <section class="panel"> - <div class="panel-header"> + <div class="section-header"> <h2>Account</h2> </div> <dl class="details"> @@ -146,7 +146,7 @@ export const GlobalUserPage: m.Component<GlobalUserAttrs> = { </section> <section class="panel"> - <div class="panel-header"> + <div class="section-header"> <div> <h2>Realm memberships</h2> <p class="note">App access is managed in the realm where the user is a member.</p> @@ -157,56 +157,54 @@ export const GlobalUserPage: m.Component<GlobalUserAttrs> = { <p>This user is not currently a member of any realm.</p> </div> ) : ( - <div class="data-table-wrap"> - <table class="data-table data-table-static"> - <thead> - <tr> - <th class="data-table-primary" scope="col">Realm</th> - <th scope="col">Relationship</th> - <th scope="col">Membership</th> - <th scope="col">Roles</th> - <th scope="col">Action</th> - </tr> - </thead> - <tbody> - {detail.memberships.map((membership: AdminGlobalUserMembership) => { - const href = `/users/${encodeURIComponent(membership.slug)}/${encodeURIComponent(detail.user.id)}`; - return ( - <tr> - <td class="data-table-primary"> - <strong>{membership.display_name}</strong> - <span class="data-table-sub">{membership.slug}</span> - </td> - <td data-label="Relationship"> - {membership.relationship === 'home' ? 'Home' : 'Guest'} - </td> - <td data-label="Membership"> - {membership.membership_status} - {membership.banned ? ( - <span class="data-table-status">Banned</span> - ) : null} - </td> - <td data-label="Roles"> - {membership.roles.length ? membership.roles.join(', ') : 'None'} - </td> - <td data-label="Action"> - <a - class="button-secondary" - href={appUrl(href)} - onclick={(event: Event) => { - event.preventDefault(); - m.route.set(href); - }} - > - Manage access - </a> - </td> - </tr> - ); - })} - </tbody> - </table> - </div> + <table class="table"> + <thead> + <tr> + <th scope="col">Realm</th> + <th scope="col">Relationship</th> + <th scope="col">Membership</th> + <th scope="col">Roles</th> + <th scope="col">Action</th> + </tr> + </thead> + <tbody> + {detail.memberships.map((membership: AdminGlobalUserMembership) => { + const href = `/users/${encodeURIComponent(membership.slug)}/${encodeURIComponent(detail.user.id)}`; + return ( + <tr> + <td data-label="Realm"> + <span class="table-title">{membership.display_name}</span> + <span class="table-sub">{membership.slug}</span> + </td> + <td data-label="Relationship"> + {membership.relationship === 'home' ? 'Home' : 'Guest'} + </td> + <td data-label="Membership"> + {membership.membership_status} + {membership.banned ? ( + <span class="status-muted"> Banned</span> + ) : null} + </td> + <td data-label="Roles"> + {membership.roles.length ? membership.roles.join(', ') : 'None'} + </td> + <td data-label="Action"> + <a + class="link" + href={appUrl(href)} + onclick={(event: Event) => { + event.preventDefault(); + m.route.set(href); + }} + > + Manage access + </a> + </td> + </tr> + ); + })} + </tbody> + </table> )} </section> </div> diff --git a/app/admin/src/screen/hosts.tsx b/app/admin/src/screen/hosts.tsx @@ -254,7 +254,7 @@ export const HostsPage: m.Component<HostsAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => { if (realmSlug) { @@ -274,7 +274,7 @@ export const HostsPage: m.Component<HostsAttrs> = { ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : realms.length === 0 ? ( <div class="empty"> <p>No realms are available for this account.</p> @@ -286,9 +286,9 @@ export const HostsPage: m.Component<HostsAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : ( - <section class="table-panel host-table-panel" aria-label="Realm hosts"> - <div class="table-toolbar"> - <div class="table-search"> + <section class="card" aria-label="Realm hosts"> + <div class="toolbar toolbar-panel"> + <div class="toolbar-search"> <input type="search" value={this.search} @@ -300,59 +300,53 @@ export const HostsPage: m.Component<HostsAttrs> = { /> </div> {canManage ? ( - <div class="table-actions"> - <button class="button" type="button" onclick={() => this.openAdd()}> + <div class="toolbar-actions"> + <button class="button button-primary" type="button" onclick={() => this.openAdd()}> Add host </button> </div> ) : null} </div> - <div class="data-table-wrap"> - <table class="data-table data-table-static host-table"> - <thead> + <table class="table"> + <thead> + <tr> + <th scope="col">Hostname</th> + <th scope="col">Added</th> + {canManage ? <th scope="col">Actions</th> : null} + </tr> + </thead> + <tbody> + {visible.map((entry: AdminRealmHost) => ( <tr> - <th class="data-table-primary host-name-column" scope="col">Hostname</th> - <th class="host-added-column" scope="col">Added</th> - {canManage ? <th class="host-action-column" scope="col">Actions</th> : null} - </tr> - </thead> - <tbody> - {visible.map((entry: AdminRealmHost) => ( - <tr> - <td class="data-table-primary host-name-column" data-label="Hostname"> - <span class="host-name">{entry.host}</span> - </td> - <td class="host-added-column" data-label="Added"> - <span class="host-added">{formatDate(entry.created_at)}</span> + <td data-label="Hostname"> + <span class="table-mono">{entry.host}</span> + </td> + <td data-label="Added" class="table-meta u-nowrap">{formatDate(entry.created_at)}</td> + {canManage ? ( + <td data-label="Actions"> + <button + class="button-inline button-danger" + type="button" + onclick={() => this.openRemove(entry.host)} + > + Remove + </button> </td> - {canManage ? ( - <td class="host-action-column" data-label="Actions"> - <div class="host-row-action"> - <button - class="action-button is-danger" - type="button" - onclick={() => this.openRemove(entry.host)} - > - Remove - </button> - </div> - </td> - ) : null} - </tr> - ))} - </tbody> - </table> - {hosts.length > 0 && visible.length === 0 ? ( - <div class="empty"> - <p>No hosts match this search.</p> - </div> - ) : hosts.length === 0 ? ( - <div class="empty"> - <p>No hosts are assigned to this realm.</p> - </div> - ) : null} - </div> + ) : null} + </tr> + ))} + </tbody> + </table> + {hosts.length > 0 && visible.length === 0 ? ( + <div class="empty"> + <p>No hosts match this search.</p> + </div> + ) : hosts.length === 0 ? ( + <div class="empty"> + <p>No hosts are assigned to this realm.</p> + </div> + ) : null} </section> )} @@ -370,7 +364,7 @@ export const HostsPage: m.Component<HostsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Hostname</span> <input class="field-control" @@ -396,14 +390,14 @@ export const HostsPage: m.Component<HostsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.creating} onclick={() => this.resetAdd()} > Cancel </button> - <button class="button" type="submit" disabled={this.creating}> + <button class="button button-primary" type="submit" disabled={this.creating}> {this.creating ? 'Adding' : 'Add host'} </button> </div> @@ -424,7 +418,7 @@ export const HostsPage: m.Component<HostsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Confirm hostname</span> <input class="field-control" @@ -446,7 +440,7 @@ export const HostsPage: m.Component<HostsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.removing} onclick={() => this.resetRemove()} @@ -454,7 +448,7 @@ export const HostsPage: m.Component<HostsAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={ this.removing || diff --git a/app/admin/src/screen/realms.tsx b/app/admin/src/screen/realms.tsx @@ -1,6 +1,4 @@ -import { LibraryBig } from 'lucide'; import m from 'mithril'; -import { Icon } from '@component/icon'; import { Modal } from '@component/modal'; import { PageHeader } from '@component/page-header'; import { @@ -288,7 +286,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { <div class="alert" role="alert"> <p>{realmsError.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => this.attrs.onRealmsChanged()} > @@ -312,10 +310,9 @@ export const RealmsPage: m.Component<RealmsAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : ( - <section class="table-panel realm-table-panel"> - <h2 class="sr-only">Realm registry</h2> - <div class="table-toolbar"> - <div class="table-search"> + <section class="card" aria-label="Realm registry"> + <div class="toolbar toolbar-panel"> + <div class="toolbar-search"> <input type="search" value={this.search} @@ -326,138 +323,130 @@ export const RealmsPage: m.Component<RealmsAttrs> = { }} /> </div> - <div class="table-actions"> + <div class="toolbar-actions"> {canCreateRealm ? ( - <button class="button" type="button" onclick={() => this.openCreate()}> + <button class="button button-primary" type="button" onclick={() => this.openCreate()}> Register realm </button> ) : null} </div> </div> - <div class="data-table-wrap"> - <table class="data-table realm-table"> - <thead> - <tr> - <th class="table-icon-column" scope="col"> - <span class="sr-only">Realm</span> - </th> - <th class="data-table-primary realm-name-column" scope="col">Realm</th> - <th class="realm-owner-column" scope="col">Owner</th> - <th class="realm-action-column" scope="col">Actions</th> - </tr> - </thead> - <tbody> - {visibleRealms.map((realm: AdminRealm) => { - const href = settingsPath(realm); - return ( - <tr - tabindex="0" - onclick={() => m.route.set(href)} - onkeydown={(event: KeyboardEvent) => { - if (event.target !== event.currentTarget) return; - if (event.key !== 'Enter' && event.key !== ' ') return; - event.preventDefault(); - m.route.set(href); - }} - > - <td class="table-icon-column"> - <span class="table-icon" aria-hidden="true"> - {Icon(LibraryBig)} - </span> - </td> - <td class="data-table-primary realm-name-column"> + <table class="table table-linkable"> + <thead> + <tr> + <th scope="col">Realm</th> + <th scope="col">Owner</th> + <th scope="col">Members</th> + <th scope="col">Hosts</th> + <th scope="col">Domains</th> + <th scope="col">Clients</th> + <th scope="col">Actions</th> + </tr> + </thead> + <tbody> + {visibleRealms.map((realm: AdminRealm) => { + const href = settingsPath(realm); + return ( + <tr + tabindex="0" + role="link" + onclick={() => m.route.set(href)} + onkeydown={(event: KeyboardEvent) => { + if (event.target !== event.currentTarget) return; + if (event.key !== 'Enter' && event.key !== ' ') return; + event.preventDefault(); + m.route.set(href); + }} + > + <td data-label="Realm"> + <a + class="table-title link" + href={appUrl(href)} + onclick={(event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + m.route.set(href); + }} + > + {realm.display_name} + </a> + <span class="table-sub">{realm.slug}</span> + </td> + <td data-label="Owner"> + <span class="table-title">{ownerName(realm)}</span> + <span class="table-sub">{ownerMeta(realm)}</span> + </td> + <td data-label="Members" class="u-nowrap">{realm.member_count}</td> + <td data-label="Hosts" class="u-nowrap"> + {realm.can_edit ? ( <a - class="realm-display" - href={appUrl(href)} + class="link" + href={appUrl(hostsPath(realm))} onclick={(event: MouseEvent) => { event.preventDefault(); event.stopPropagation(); - m.route.set(href); + m.route.set(hostsPath(realm)); }} > - {realm.display_name} + {realm.host_count} </a> - <span class="realm-meta"> - <span class="realm-slug">{realm.slug}</span> - <span class="realm-count">{pluralCount(realm.member_count, 'member')}</span> - {realm.can_edit ? ( - <a - class="realm-count realm-count-link" - href={appUrl(hostsPath(realm))} - onclick={(event: MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - m.route.set(hostsPath(realm)); - }} - > - {pluralCount(realm.host_count, 'host')} - </a> - ) : ( - <span class="realm-count">{pluralCount(realm.host_count, 'host')}</span> - )} - {realm.can_edit ? ( - <a - class="realm-count realm-count-link" - href={appUrl(domainsPath(realm))} - onclick={(event: MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - m.route.set(domainsPath(realm)); - }} - > - {pluralCount(realm.email_domain_count, 'domain')} - </a> - ) : ( - <span class="realm-count"> - {pluralCount(realm.email_domain_count, 'domain')} - </span> - )} - <span class="realm-count">{pluralCount(realm.client_count, 'client')}</span> - </span> - </td> - <td class="realm-owner-column" data-label="Owner"> - <span class="realm-owner-name">{ownerName(realm)}</span> - <span class="realm-owner-meta">{ownerMeta(realm)}</span> - </td> - <td class="realm-action-column"> - {realm.can_delete ? ( - <div class="realm-row-action"> - <button - class="action-button is-danger" - type="button" - onclick={(event: MouseEvent) => { - event.stopPropagation(); - this.openDelete(realm); - }} - > - Delete realm - </button> - </div> - ) : null} - </td> - </tr> - ); - })} - </tbody> - </table> - {realms.length > 0 && visibleRealms.length === 0 ? ( - <div class="empty"> - <p>No realms match this search.</p> - </div> - ) : realms.length === 0 ? ( - <div class="empty"> - <p>No realms are available for this account.</p> - </div> - ) : null} - </div> + ) : ( + realm.host_count + )} + </td> + <td data-label="Domains" class="u-nowrap"> + {realm.can_edit ? ( + <a + class="link" + href={appUrl(domainsPath(realm))} + onclick={(event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + m.route.set(domainsPath(realm)); + }} + > + {realm.email_domain_count} + </a> + ) : ( + realm.email_domain_count + )} + </td> + <td data-label="Clients" class="u-nowrap">{realm.client_count}</td> + <td data-label="Actions"> + {realm.can_delete ? ( + <button + class="button-inline button-danger" + type="button" + onclick={(event: MouseEvent) => { + event.stopPropagation(); + this.openDelete(realm); + }} + > + Delete realm + </button> + ) : null} + </td> + </tr> + ); + })} + </tbody> + </table> + {realms.length > 0 && visibleRealms.length === 0 ? ( + <div class="empty"> + <p>No realms match this search.</p> + </div> + ) : realms.length === 0 ? ( + <div class="empty"> + <p>No realms are available for this account.</p> + </div> + ) : null} </section> )} {this.createOpen ? ( <Modal title="Register a realm" onClose={() => this.resetCreate()}> <form - class="realm-create-form" onsubmit={(event: Event) => { event.preventDefault(); this.submitCreate(); @@ -471,7 +460,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Display name</span> <input class="field-control" @@ -493,7 +482,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Realm ID</span> <input class="field-control" @@ -516,7 +505,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { </p> <div class="field-grid"> - <div class="form-field"> + <div class="field"> <span class="field-label">Logo URL</span> <input class="field-control" @@ -534,7 +523,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Primary color</span> <input class="field-control" @@ -573,14 +562,14 @@ export const RealmsPage: m.Component<RealmsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.creating} onclick={() => this.resetCreate()} > Cancel </button> - <button class="button" type="submit" disabled={this.creating}> + <button class="button button-primary" type="submit" disabled={this.creating}> {this.creating ? 'Creating' : 'Create realm'} </button> </div> @@ -602,7 +591,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Confirm realm ID</span> <input class="field-control" @@ -623,7 +612,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.deleting} onclick={() => this.resetDelete()} @@ -631,7 +620,7 @@ export const RealmsPage: m.Component<RealmsAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={!deleteConfirmationMatches || this.deleting} onclick={() => this.submitDelete()} diff --git a/app/admin/src/screen/sessions.tsx b/app/admin/src/screen/sessions.tsx @@ -168,7 +168,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { <p>{this.error.message}</p> {this.attrs.realmSlug ? ( <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => this.load(this.attrs.realmSlug)} > @@ -185,13 +185,13 @@ export const SessionsPage: m.Component<SessionsAttrs> = { ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : realms.length === 0 ? ( <div class="empty"> <p>No realms are available for this account.</p> </div> ) : this.loading || this.redirecting ? ( - <div class="session-stack" aria-busy="true"> + <div class="stack" aria-busy="true"> <div class="panel"> <div class="skeleton skeleton-title"></div> <div class="skeleton"></div> @@ -204,7 +204,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { </div> </div> ) : this.sessions && this.sessions.length > 0 ? ( - <div class="session-stack"> + <div class="stack"> {this.sessions.map((session: AdminSession) => { const realmKey = actionKey('realm', session); const terminateKey = actionKey('terminate', session); @@ -213,11 +213,11 @@ export const SessionsPage: m.Component<SessionsAttrs> = { const terminatePending = pending === terminateKey; return ( - <article class="panel"> - <div class="session-header"> + <article class="panel stack-tight"> + <div class="section-header"> <div> <h2>{session.user.display_name || session.user.username}</h2> - <p class="session-user"> + <p class="note"> {session.user.username} {session.user.status !== 'active' ? ` \u00B7 ${session.user.status}` @@ -225,13 +225,13 @@ export const SessionsPage: m.Component<SessionsAttrs> = { </p> </div> {session.revoked_at ? ( - <span class="session-badge"> + <span class="status"> Realm access revoked {formatTime(session.revoked_at)} </span> ) : null} </div> - <dl class="details session-details"> + <dl class="details"> <div> <dt>Scope</dt> <dd>{scopeLabel(session.scope.type)}</dd> @@ -259,15 +259,15 @@ export const SessionsPage: m.Component<SessionsAttrs> = { </dl> {session.user_agent ? ( - <p class="session-agent">{session.user_agent}</p> + <p class="note">{session.user_agent}</p> ) : null} - <div class="session-actions"> + <div class="action-row"> {session.revoked_at ? null : this.confirmKey === realmKey ? ( - <div class="confirm"> - <span>Revoke this realm's access?</span> + <div class="action-row"> + <span class="note">Revoke this realm's access?</span> <button - class="button" + class="button button-primary" type="button" disabled={Boolean(pending)} onclick={() => this.act(session, 'realm')} @@ -275,7 +275,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { {revokePending ? 'Revoking' : 'Confirm'} </button> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={Boolean(pending)} onclick={() => { @@ -288,7 +288,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { </div> ) : ( <button - class="button-secondary" + class="button button-secondary" type="button" disabled={Boolean(pending)} onclick={() => { @@ -302,8 +302,8 @@ export const SessionsPage: m.Component<SessionsAttrs> = { {session.can_terminate ? ( this.confirmKey === terminateKey ? ( - <div class="confirm"> - <span>Terminate this session?</span> + <div class="action-row"> + <span class="note">Terminate this session?</span> <button class="button button-danger" type="button" @@ -313,7 +313,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { {terminatePending ? 'Terminating' : 'Confirm'} </button> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={Boolean(pending)} onclick={() => { @@ -326,7 +326,7 @@ export const SessionsPage: m.Component<SessionsAttrs> = { </div> ) : ( <button - class="button-danger" + class="button button-danger" type="button" disabled={Boolean(pending)} onclick={() => { diff --git a/app/admin/src/screen/settings.tsx b/app/admin/src/screen/settings.tsx @@ -253,7 +253,7 @@ export const SettingsPage: m.Component<SettingsAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => { if (realmSlug) { @@ -273,7 +273,7 @@ export const SettingsPage: m.Component<SettingsAttrs> = { ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : realms.length === 0 ? ( <div class="empty"> <p>No realms are available for this account.</p> @@ -285,10 +285,10 @@ export const SettingsPage: m.Component<SettingsAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : this.settings ? ( - <div class="settings-stack"> + <div class="stack"> <section class="panel"> <h2>Realm details</h2> - <form class="settings-form" onsubmit={(event: Event) => { + <form class="stack-tight" onsubmit={(event: Event) => { event.preventDefault(); this.submit(); }}> @@ -298,12 +298,12 @@ export const SettingsPage: m.Component<SettingsAttrs> = { </div> ) : null} - <div class="form-field"> + <div class="field"> <span class="field-label">Realm ID</span> <input class="field-control" value={this.settings.slug} disabled /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Display name</span> <input class="field-control" @@ -318,7 +318,7 @@ export const SettingsPage: m.Component<SettingsAttrs> = { /> </div> - <label class="checkbox-row"> + <label class="checkbox"> <input type="checkbox" checked={this.form.allow_session_duration_choice} @@ -337,9 +337,9 @@ export const SettingsPage: m.Component<SettingsAttrs> = { <section class="panel"> <h2>Realm branding</h2> <p class="note">Shown on login and consent for clients in this realm.</p> - <div class="settings-form"> + <div class="stack-tight"> <div class="field-grid"> - <div class="form-field"> + <div class="field"> <span class="field-label">Logo URL</span> <input class="field-control" @@ -356,7 +356,7 @@ export const SettingsPage: m.Component<SettingsAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Primary color</span> <input class="field-control" @@ -392,9 +392,9 @@ export const SettingsPage: m.Component<SettingsAttrs> = { ></span> </div> - <div class="settings-actions"> + <div class="action-row"> <button - class="button" + class="button button-primary" type="button" disabled={this.pending} onclick={() => this.submit()} @@ -408,9 +408,9 @@ export const SettingsPage: m.Component<SettingsAttrs> = { <section class="panel"> <h2>Realm access</h2> <p class="note">Manage hostnames and email domains for this realm.</p> - <div class="settings-actions"> + <div class="action-row"> <a - class="button-secondary" + class="button button-secondary" href={appUrl(`/hosts/${encodeURIComponent(realmSlug || '')}`)} onclick={(event: MouseEvent) => { event.preventDefault(); @@ -420,7 +420,7 @@ export const SettingsPage: m.Component<SettingsAttrs> = { Hosts </a> <a - class="button-secondary" + class="button button-secondary" href={appUrl(`/email-domains/${encodeURIComponent(realmSlug || '')}`)} onclick={(event: MouseEvent) => { event.preventDefault(); diff --git a/app/admin/src/screen/system-settings.tsx b/app/admin/src/screen/system-settings.tsx @@ -136,7 +136,7 @@ export const SystemSettingsPage: m.Component<SystemSettingsAttrs> = { {this.error ? ( <div class="alert" role="alert"> <p>{this.error.message}</p> - <button class="button-secondary" type="button" onclick={() => this.load()}> + <button class="button button-secondary" type="button" onclick={() => this.load()}> Try again </button> </div> @@ -161,7 +161,7 @@ export const SystemSettingsPage: m.Component<SystemSettingsAttrs> = { Used as the system fallback. Realm branding overrides these values, and client branding overrides realm branding. </p> - <div class="settings-form"> + <div class="stack-tight"> {this.formError ? ( <div class="alert" role="alert"> {typeof this.formError === 'string' ? this.formError : this.formError.message} @@ -169,7 +169,7 @@ export const SystemSettingsPage: m.Component<SystemSettingsAttrs> = { ) : null} <div class="field-grid"> - <div class="form-field"> + <div class="field"> <span class="field-label">Logo URL</span> <input class="field-control" @@ -186,7 +186,7 @@ export const SystemSettingsPage: m.Component<SystemSettingsAttrs> = { /> </div> - <div class="form-field"> + <div class="field"> <span class="field-label">Primary color</span> <input class="field-control" @@ -222,9 +222,9 @@ export const SystemSettingsPage: m.Component<SystemSettingsAttrs> = { ></span> </div> - <div class="settings-actions"> + <div class="action-row"> <button - class="button" + class="button button-primary" type="button" disabled={this.pending} onclick={() => this.submit()} diff --git a/app/admin/src/screen/user.tsx b/app/admin/src/screen/user.tsx @@ -363,7 +363,7 @@ export const UserPage: m.Component<UserAttrs> = { <div class="alert" role="alert"> <p>{this.error.message}</p> <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => { if (realmSlug && userId) this.load(realmSlug, userId); @@ -381,7 +381,7 @@ export const UserPage: m.Component<UserAttrs> = { ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : this.loading || this.redirecting ? ( <div class="panel" aria-busy="true"> <div class="skeleton skeleton-title"></div> @@ -389,7 +389,7 @@ export const UserPage: m.Component<UserAttrs> = { <div class="skeleton skeleton-short"></div> </div> ) : detail ? ( - <div class="client-stack"> + <div class="stack"> <section class="panel"> <h2>Account</h2> <dl class="details"> @@ -420,8 +420,8 @@ export const UserPage: m.Component<UserAttrs> = { </dl> </section> - <section class="panel"> - <div class="panel-header"> + <section class="panel stack-tight"> + <div class="section-header"> <div> <h2>Realm access</h2> <p class="note">Manage membership and roles in this realm.</p> @@ -430,7 +430,9 @@ export const UserPage: m.Component<UserAttrs> = { detail.permissions.can_reactivate_membership ? ( <button class={ - detail.permissions.can_suspend_membership ? 'button-danger' : 'button-secondary' + detail.permissions.can_suspend_membership + ? 'button button-danger' + : 'button button-secondary' } type="button" disabled={this.membershipPending} @@ -465,12 +467,12 @@ export const UserPage: m.Component<UserAttrs> = { this access. </div> ) : null} - <fieldset class="role-field"> - <legend>Realm roles</legend> + <fieldset class="fieldset stack-tight"> + <legend class="field-label">Realm roles</legend> {this.roles.length === 0 ? ( <p class="note">No realm roles are available.</p> ) : ( - <div class="checkbox-list"> + <div class="stack-tight"> {this.roles.map((role: AdminRole) => { const checked = this.selectedRoles.includes(role.slug); const protectedRole = @@ -480,7 +482,7 @@ export const UserPage: m.Component<UserAttrs> = { role.slug === 'realm-admin' && detail.user.roles.includes(role.slug)); return ( - <label class="checkbox-row"> + <label class="checkbox"> <input type="checkbox" checked={checked} @@ -504,9 +506,9 @@ export const UserPage: m.Component<UserAttrs> = { )} </fieldset> {detail.permissions.can_edit_roles ? ( - <div class="modal-actions"> + <div class="action-row"> <button - class="button" + class="button button-primary" type="button" disabled={ this.rolePending || @@ -520,8 +522,8 @@ export const UserPage: m.Component<UserAttrs> = { ) : null} </section> - <section class="panel"> - <div class="panel-header"> + <section class="panel stack-tight"> + <div class="section-header"> <h2>Application consents</h2> </div> {detail.consents.length === 0 ? ( @@ -529,80 +531,75 @@ export const UserPage: m.Component<UserAttrs> = { <p>No consents have been recorded for this realm.</p> </div> ) : ( - <div class="data-table-wrap"> - <table class="data-table data-table-static"> - <thead> + <table class="table"> + <thead> + <tr> + <th scope="col">Application</th> + <th scope="col">Scopes</th> + <th scope="col">Granted</th> + <th scope="col">Status</th> + <th scope="col">Updated</th> + <th scope="col">Action</th> + </tr> + </thead> + <tbody> + {detail.consents.map((consent: AdminUserConsent) => ( <tr> - <th class="data-table-primary" scope="col">Application</th> - <th scope="col">Scopes</th> - <th scope="col">Granted</th> - <th scope="col">Status</th> - <th scope="col">Updated</th> - <th scope="col">Action</th> + <td data-label="Application"> + <span class="table-title">{consent.client_name || 'Unknown client'}</span> + <span class="table-sub">{consent.client_id}</span> + </td> + <td data-label="Scopes"> + {consent.scopes.length ? consent.scopes.join(', ') : 'None'} + </td> + <td data-label="Granted"> + {grantedLabel(consent)} + {consent.client_consent_mode ? ( + <span class="table-sub"> + {consent.client_consent_mode} + </span> + ) : null} + </td> + <td data-label="Status"> + {consent.active ? 'Active' : 'Revoked'} + </td> + <td data-label="Updated">{formatTime(consent.updated_at)}</td> + <td data-label="Action"> + {consent.active ? ( + <button + class="button-inline button-danger" + type="button" + disabled={Boolean(this.pendingAction)} + onclick={() => { + this.confirm = { + type: 'revoke', + clientId: consent.client_id, + label: consent.client_name || consent.client_id, + }; + m.redraw(); + }} + > + Revoke + </button> + ) : ( + 'None' + )} + </td> </tr> - </thead> - <tbody> - {detail.consents.map((consent: AdminUserConsent) => ( - <tr> - <td class="data-table-primary"> - <strong>{consent.client_name || 'Unknown client'}</strong> - <span class="data-table-sub">{consent.client_id}</span> - </td> - <td data-label="Scopes"> - {consent.scopes.length ? consent.scopes.join(', ') : 'None'} - </td> - <td data-label="Granted"> - {grantedLabel(consent)} - {consent.client_consent_mode ? ( - <span class="data-table-sub"> - {consent.client_consent_mode} - </span> - ) : null} - </td> - <td data-label="Status"> - {consent.active ? 'Active' : 'Revoked'} - {!consent.active ? ( - <span class="data-table-status">Revoked</span> - ) : null} - </td> - <td data-label="Updated">{formatTime(consent.updated_at)}</td> - <td data-label="Action"> - {consent.active ? ( - <button - class="button-secondary" - type="button" - disabled={Boolean(this.pendingAction)} - onclick={() => { - this.confirm = { - type: 'revoke', - clientId: consent.client_id, - label: consent.client_name || consent.client_id, - }; - m.redraw(); - }} - > - Revoke - </button> - ) : ( - 'None' - )} - </td> - </tr> - ))} - </tbody> - </table> - </div> + ))} + </tbody> + </table> )} </section> - <section class="panel"> - <div class="panel-header"> + <section class="panel stack-tight"> + <div class="section-header"> <div> <h2>Application bans</h2> <p class="note">Bans persist independently of consent.</p> </div> <button - class="button-danger" + class="button button-danger" id="open-ban-dialog" type="button" onclick={() => { @@ -620,51 +617,49 @@ export const UserPage: m.Component<UserAttrs> = { <p>This user is not banned from any app.</p> </div> ) : ( - <div class="data-table-wrap"> - <table class="data-table data-table-static"> - <thead> + <table class="table"> + <thead> + <tr> + <th scope="col">Application</th> + <th scope="col">Banned by</th> + <th scope="col">Created</th> + <th scope="col">Action</th> + </tr> + </thead> + <tbody> + {detail.bans.map((ban: AdminUserBan) => ( <tr> - <th class="data-table-primary" scope="col">Application</th> - <th scope="col">Banned by</th> - <th scope="col">Created</th> - <th scope="col">Action</th> + <td data-label="Application"> + <span class="table-title">{banLabel(ban)}</span> + {ban.client_id !== '*' ? ( + <span class="table-sub">{ban.client_id}</span> + ) : null} + </td> + <td data-label="Banned by"> + {ban.created_by_username || 'Unknown'} + </td> + <td data-label="Created">{formatTime(ban.created_at)}</td> + <td data-label="Action"> + <button + class="button-inline" + type="button" + disabled={Boolean(this.pendingAction)} + onclick={() => { + this.confirm = { + type: 'unban', + clientId: ban.client_id, + label: banLabel(ban), + }; + m.redraw(); + }} + > + Unban + </button> + </td> </tr> - </thead> - <tbody> - {detail.bans.map((ban: AdminUserBan) => ( - <tr> - <td class="data-table-primary"> - <strong>{banLabel(ban)}</strong> - {ban.client_id !== '*' ? ( - <span class="data-table-sub">{ban.client_id}</span> - ) : null} - </td> - <td data-label="Banned by"> - {ban.created_by_username || 'Unknown'} - </td> - <td data-label="Created">{formatTime(ban.created_at)}</td> - <td data-label="Action"> - <button - class="button-secondary" - type="button" - disabled={Boolean(this.pendingAction)} - onclick={() => { - this.confirm = { - type: 'unban', - clientId: ban.client_id, - label: banLabel(ban), - }; - m.redraw(); - }} - > - Unban - </button> - </td> - </tr> - ))} - </tbody> - </table> - </div> + ))} + </tbody> + </table> )} </section> </div> @@ -691,7 +686,7 @@ export const UserPage: m.Component<UserAttrs> = { )} <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.pendingAction} onclick={() => this.cancelAction()} @@ -699,7 +694,7 @@ export const UserPage: m.Component<UserAttrs> = { Cancel </button> <button - class={this.confirm.type === 'revoke' ? 'button' : 'button-danger'} + class={this.confirm.type === 'revoke' ? 'button button-primary' : 'button button-danger'} type="button" disabled={this.pendingAction} onclick={() => this.submitAction()} @@ -714,7 +709,7 @@ export const UserPage: m.Component<UserAttrs> = { {this.banOpen && detail ? ( <Modal title="Ban from app" onClose={() => this.cancelAction()}> - <div class="form-field"> + <div class="field"> <span class="field-label" id="ban-application-label">Application</span> <SelectMenu labelledBy="ban-application-label" @@ -738,7 +733,7 @@ export const UserPage: m.Component<UserAttrs> = { </p> <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.banPending} onclick={() => this.cancelAction()} @@ -746,7 +741,7 @@ export const UserPage: m.Component<UserAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={this.banPending} onclick={() => this.submitBan()} @@ -765,7 +760,7 @@ export const UserPage: m.Component<UserAttrs> = { </p> <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.membershipPending} onclick={() => this.cancelAccessActions()} @@ -773,7 +768,7 @@ export const UserPage: m.Component<UserAttrs> = { Cancel </button> <button - class="button-danger" + class="button button-danger" type="button" disabled={this.membershipPending} onclick={() => this.submitMembership()} @@ -792,7 +787,7 @@ export const UserPage: m.Component<UserAttrs> = { </p> <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.rolePending} onclick={() => this.cancelAccessActions()} @@ -800,7 +795,7 @@ export const UserPage: m.Component<UserAttrs> = { Cancel </button> <button - class="button" + class="button button-primary" type="button" disabled={this.rolePending} onclick={() => this.submitRoles()} diff --git a/app/admin/src/screen/users.tsx b/app/admin/src/screen/users.tsx @@ -261,22 +261,22 @@ export const UsersPage: m.Component<UsersAttrs> = { {this.error ? ( <div class="alert" role="alert"> <p>{this.error.message}</p> - <button class="button-secondary" type="button" onclick={() => this.load(this.loadedScope)}> + <button class="button button-secondary" type="button" onclick={() => this.load(this.loadedScope)}> Try again </button> </div> ) : null} {!realms ? ( - <div class="loading">Loading realms</div> + <p class="note">Loading realms</p> ) : !isGlobal && realms.length === 0 ? ( <div class="empty"> <p>No realms are available for this account.</p> </div> ) : ( - <div class="table-panel"> - <div class="table-toolbar"> - <div class="table-search"> + <section class="card" aria-label="Realm users"> + <div class="toolbar toolbar-panel"> + <div class="toolbar-search"> <input type="search" value={this.search} @@ -288,9 +288,9 @@ export const UsersPage: m.Component<UsersAttrs> = { /> </div> {!isGlobal ? ( - <div class="table-actions"> + <div class="toolbar-actions"> <button - class="button" + class="button button-primary" type="button" onclick={() => { this.resetAdd(); @@ -317,92 +317,93 @@ export const UsersPage: m.Component<UsersAttrs> = { <p>{isGlobal ? 'No users exist yet.' : 'No users are members of this realm.'}</p> </div> ) : ( - <div class="data-table-wrap"> - <table class="data-table"> - <thead> - <tr> - <th class="table-icon-column" scope="col"> - <span class="sr-only">User</span> - </th> - <th class="data-table-primary" scope="col">User</th> - <th scope="col">{isGlobal ? 'Home realm' : 'Membership'}</th> - {isGlobal ? <th scope="col">Realms</th> : null} - <th scope="col">Status</th> - </tr> - </thead> - <tbody> - {visibleUsers.map((user: AnyUser) => { - const href = userHref(isGlobal, realmSlug, user.id); - return ( - <tr - tabindex="0" - onclick={() => m.route.set(href)} - onkeydown={(event: KeyboardEvent) => { - if (event.target !== event.currentTarget) return; - if (event.key !== 'Enter' && event.key !== ' ') return; - event.preventDefault(); - m.route.set(href); - }} - > - <td class="table-icon-column"> - <span class="table-icon" aria-hidden="true"> - {Icon(Users)} - </span> + <> + <table class="table table-linkable"> + <thead> + <tr> + <th scope="col"> + <span class="sr-only">User</span> + </th> + <th scope="col">User</th> + <th scope="col">{isGlobal ? 'Home realm' : 'Membership'}</th> + {isGlobal ? <th scope="col">Realms</th> : null} + <th scope="col">Status</th> + </tr> + </thead> + <tbody> + {visibleUsers.map((user: AnyUser) => { + const href = userHref(isGlobal, realmSlug, user.id); + return ( + <tr + tabindex="0" + role="link" + onclick={() => m.route.set(href)} + onkeydown={(event: KeyboardEvent) => { + if (event.target !== event.currentTarget) return; + if (event.key !== 'Enter' && event.key !== ' ') return; + event.preventDefault(); + m.route.set(href); + }} + > + <td> + <span class="table-icon" aria-hidden="true"> + {Icon(Users)} + </span> + </td> + <td data-label="User"> + <a + class="table-title link" + href={appUrl(href)} + onclick={(event: MouseEvent) => { + event.preventDefault(); + event.stopPropagation(); + m.route.set(href); + }} + > + {user.display_name || user.username} + </a> + <span class="table-sub">{user.email || user.username}</span> + {user.email ? <span class="table-sub">{user.username}</span> : null} + </td> + {isGlobal ? ( + <td data-label="Home realm"> + {(user as AdminGlobalUser).home_realm_slug || 'None'} + {(user as AdminGlobalUser).is_system_admin ? ( + <span class="status-muted"> System admin</span> + ) : null} </td> - <td class="data-table-primary"> - <a - class="user-title" - href={appUrl(href)} - onclick={(event: MouseEvent) => { - event.preventDefault(); - event.stopPropagation(); - m.route.set(href); - }} - > - <strong>{user.display_name || user.username}</strong> - </a> - <span class="data-table-sub">{user.email || user.username}</span> - {user.email ? <span class="data-table-sub">{user.username}</span> : null} + ) : ( + <td data-label="Membership"> + {relationshipLabel(user as AdminRealmUser)} + {(user as AdminRealmUser).roles.includes('realm-admin') ? ( + <span class="status-muted"> Realm admin</span> + ) : null} + {(user as AdminRealmUser).is_system_admin ? ( + <span class="status-muted"> System admin</span> + ) : null} </td> - {isGlobal ? ( - <td data-label="Home realm"> - {(user as AdminGlobalUser).home_realm_slug || 'None'} - {(user as AdminGlobalUser).is_system_admin ? ( - <span class="data-table-status">System admin</span> - ) : null} - </td> - ) : ( - <td data-label="Membership"> - {relationshipLabel(user as AdminRealmUser)} - {(user as AdminRealmUser).roles.includes('realm-admin') ? ( - <span class="data-table-status">Realm admin</span> - ) : null} - {(user as AdminRealmUser).is_system_admin ? ( - <span class="data-table-status">System admin</span> - ) : null} - </td> - )} - {isGlobal ? ( - <td data-label="Realms">{(user as AdminGlobalUser).membership_count}</td> - ) : null} - <td data-label="Status"> - {isGlobal - ? globalStatusLabel(user as AdminGlobalUser) - : realmStatus(user as AdminRealmUser)} - </td> - </tr> - ); - })} - </tbody> - </table> - {visibleUsers.length === 0 ? ( - <div class="empty"> - <p>No users match this search.</p> - </div> - ) : null} - </div> + )} + {isGlobal ? ( + <td data-label="Realms">{(user as AdminGlobalUser).membership_count}</td> + ) : null} + <td data-label="Status"> + {isGlobal + ? globalStatusLabel(user as AdminGlobalUser) + : realmStatus(user as AdminRealmUser)} + </td> + </tr> + ); + })} + </tbody> + </table> + {visibleUsers.length === 0 ? ( + <div class="empty"> + <p>No users match this search.</p> + </div> + ) : null} + </> )} - </div> + </section> )} {this.addOpen && realmSlug ? ( @@ -413,7 +414,7 @@ export const UsersPage: m.Component<UsersAttrs> = { this.searchAdd(); }} > - <div class="form-field"> + <div class="field"> <label class="field-label" for="add-user-identifier"> Email or username </label> @@ -429,14 +430,14 @@ export const UsersPage: m.Component<UsersAttrs> = { </div> <div class="modal-actions"> <button - class="button-secondary" + class="button button-secondary" type="button" disabled={this.addPending} onclick={() => this.resetAdd()} > Cancel </button> - <button class="button" type="submit" disabled={this.addPending}> + <button class="button button-primary" type="submit" disabled={this.addPending}> {this.addPending ? 'Searching' : 'Search'} </button> </div> @@ -453,15 +454,15 @@ export const UsersPage: m.Component<UsersAttrs> = { <div class="notice"> <strong>{this.addResult.display_name || this.addResult.username}</strong> {this.addResult.email ? ( - <span class="data-table-sub">{this.addResult.email}</span> + <span class="table-sub">{this.addResult.email}</span> ) : null} - <span class="data-table-sub">{this.addResult.username}</span> - <span class="data-table-sub">{lookupReason(this.addResult)}</span> + <span class="table-sub">{this.addResult.username}</span> + <p class="note">{lookupReason(this.addResult)}</p> </div> <div class="modal-actions"> {this.addResult.can_add ? ( <button - class="button" + class="button button-primary" type="button" disabled={this.addPending} onclick={() => this.submitAdd()} @@ -470,7 +471,7 @@ export const UsersPage: m.Component<UsersAttrs> = { </button> ) : ( <button - class="button-secondary" + class="button button-secondary" type="button" onclick={() => m.route.set(userHref(false, realmSlug, this.addResult.id)) diff --git a/app/admin/src/style/admin.css b/app/admin/src/style/admin.css @@ -0,0 +1,137 @@ +@layer apps { + .grid { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-4); + } + + .field-grid { + display: grid; + grid-template-columns: minmax(0, 1fr); + gap: var(--space-4); + } + + /* block stack where the grid gap owns all rhythm: form columns, + panel interiors, and runs of members that carry their own margins */ + .stack-tight { + display: grid; + gap: var(--space-4); + min-width: 0; + } + + .field-grid > *, + .stack-tight > * { + margin-block-start: 0; + margin-block-end: 0; + } + + @media (min-width: 40em) { + .grid, + .field-grid { + grid-template-columns: repeat(2, minmax(0, 1fr)); + } + } + + /* borderless grouping fieldset: the legend is a .field-label */ + .fieldset { + min-inline-size: 0; + margin: 0; + padding: 0; + border: 0; + } + + /* a row of panel actions, kept together under one label */ + .action-row { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-2); + margin-block-start: var(--space-4); + } + + /* logo / glyph tile in list tables */ + .table-icon { + display: grid; + place-items: center; + width: var(--space-8); + height: var(--space-8); + overflow: hidden; + background: var(--line); + color: var(--muted); + } + + .table-icon img { + width: 100%; + height: 100%; + object-fit: contain; + } + + .table-icon svg { + width: var(--font-xl); + height: var(--font-xl); + } + + .secret-value { + display: block; + padding: var(--space-3); + background: var(--line-strong); + color: inherit; + font-family: var(--font-mono); + font-size: var(--font-sm); + line-height: var(--lh-base); + overflow-wrap: anywhere; + white-space: pre-wrap; + } + + .danger-zone h2 { color: var(--danger-text); } + + .branding-preview { + display: flex; + flex-wrap: wrap; + align-items: center; + gap: var(--space-3); + } + + .branding-logo-preview, + .branding-color-preview { + width: 2rem; + height: 2rem; + overflow: hidden; + background: var(--line-strong); + } + + .branding-logo-preview { + display: inline-flex; + align-items: center; + justify-content: center; + color: var(--muted); + } + + .branding-logo-preview img { + width: 100%; + height: 100%; + object-fit: contain; + } + + .branding-color-preview { + border-radius: var(--radius-sm); + background: var(--field-line); + } + + .branding-logo-preview.is-empty, + .branding-color-preview.is-empty { + border-bottom: 1pt solid var(--field-line); + } + + .verify-record-name, + .verify-record-value { + font-family: var(--font-mono); + font-size: var(--font-sm); + } + + .verify-copy-row { + display: flex; + justify-content: flex-end; + margin-block-start: var(--space-2); + } +}