Skip to content

The open-source AI receptionist for businesses. Answers every call, books the appointment and hands over to a person when needed. You own the code and the data.

Settings overview: the workspace's and your pages directly, no name rows (PR 1940)

Janik7405311c0728
diff --git a/apps/web/src/settings/SettingsHome.tsx b/apps/web/src/settings/SettingsHome.tsx
index 6543b910..34190ffe 100644
--- a/apps/web/src/settings/SettingsHome.tsx
+++ b/apps/web/src/settings/SettingsHome.tsx
@@ -1,8 +1,9 @@
// Settings (#settings, G S): the one place every setting starts from, in three groups. Assistants: one row per
// assistant of the workspace (its number, whether it answers calls) and New assistant for who may create one.
-// Workspace: what everyone shares. You: only you. Each row opens that area's first page; the sub-pages are in the
-// area's own navigation (Assistant › General, Workspace settings › General, User settings › Profile).
-// Server admin stays its own entry in the navigation.
+// Workspace (its name beside the label): one row per page of Workspace settings. Your account (your email beside
+// the label): one row per page of User settings. The pages are named, never the workspace or the person as a row of
+// their own: an avatar there read as a profile, not as settings (LIN-858, mockup B). Danger zone stays in Workspace
+// settings' own navigation. Server admin stays its own entry in the navigation.
import type { Assistant, PhoneNumber } from '@linedesk/db/types'
import { useT } from '@linedesk/i18n/react'
import { type ReactNode, useEffect, useState } from 'react'
@@ -11,19 +12,18 @@ import { notAnsweringWhy } from '../inbox/goLive.ts'
import type { ForwardedCall } from '../onboarding/forwarding-check.ts'
import { usePresence } from '../shell/presence.ts'
import { pages } from '../shell/pages.tsx'
-import { WorkspaceMark, workspaceIconOf } from '../shell/WorkspaceMark.tsx'
-import { useWorkspaces } from '../shell/WorkspaceSwitcher.tsx'
import { useAssistants, useRows, useRun } from '../store.tsx'
-import { tabWorkspace } from '../tabWorkspace.ts'
-import { memberAvatar, useMember } from '../team/members.ts'
import { LineGroup } from '../ui/FeatureLine.tsx'
import { Card } from '../ui/form.tsx'
-import { Avatar, Icon } from '../ui/kit.tsx'
+import type { IconName } from '../ui/icons.ts'
+import { Icon } from '../ui/kit.tsx'
import { Loading, Skeleton, useLoadState } from '../ui/LoadStates.tsx'
import { SettingRow, SettingRows } from '../ui/SettingRow.tsx'
import { sectionHash } from '../ui/SettingsLayout.tsx'
import { StatusMark } from '../ui/StatusMark.tsx'
+import { useAccountSections } from './account/index.tsx'
import { type AssistantCallState, assistantCallState, dialLine } from './phoneNumberModel.ts'
+import { useWorkspaceSections } from './WorkspaceSettings.tsx'
import './settings-home.css'
/** The global keys that open the (first) assistant; shown in its row's tooltip, never as chips (rule 4). */
@@ -62,22 +62,8 @@ export function SettingsHome({ billing, workspaceName, isInstanceAdmin, canEdit,
</SettingRows>
</Card>
</section>
- <section className="sh-group" aria-labelledby="sh-workspace">
- <LineGroup as="h2">
- <span id="sh-workspace">{t('settings.home.group.workspace')}</span>
- </LineGroup>
- <Card className="sh-card">
- <WorkspaceRow name={workspaceName} billing={billing} />
- </Card>
- </section>
- <section className="sh-group" aria-labelledby="sh-you">
- <LineGroup as="h2">
- <span id="sh-you">{t('settings.home.group.you')}</span>
- </LineGroup>
- <Card className="sh-card">
- <YouRow />
- </Card>
- </section>
+ <WorkspaceGroup name={workspaceName} billing={billing} canEdit={canEdit} />
+ <AccountGroup />
</div>
</div>
)
@@ -230,34 +216,84 @@ function NewAssistantRow({ assistants, toast }: { assistants: Assistant[]; toast
)
}
-function WorkspaceRow({ name, billing }: { name: string; billing: boolean }) {
+/** The icon of each settings page, as small line icons in front of its name. */
+const PAGE_ICONS: Record<string, IconName> = {
+ general: 'gear',
+ team: 'users',
+ phone: 'phone',
+ billing: 'money',
+ profile: 'user',
+ security: 'shield',
+ apiKeys: 'plug',
+}
+
+/** Workspace settings' pages, without Danger zone (it stays in the area's own navigation). */
+function WorkspaceGroup({ name, billing, canEdit }: { name: string; billing: boolean; canEdit: boolean }) {
const t = useT()
- const iconUrl = workspaceIconOf(useWorkspaces(), tabWorkspace() ?? '')
+ const sections = useWorkspaceSections(canEdit, billing).filter(s => s.id !== 'danger')
return (
- <Row
- href={sectionHash('workspace', 'general')}
- lead={<WorkspaceMark name={name} iconUrl={iconUrl} size="lg" />}
- title={name}
- line={t(billing ? 'settings.home.workspace.line' : 'settings.home.workspace.lineNoBilling')}
+ <PageGroup
+ id="sh-workspace"
+ label={t('settings.home.group.workspace')}
+ context={name}
+ page="workspace"
+ sections={sections}
/>
)
}
-function YouRow() {
+function AccountGroup() {
const t = useT()
const user = auth.useSession().data?.user
- const me = useMember(user?.id ?? null)
- const name = user?.name || user?.email || pages.account.title
+ const sections = useAccountSections(true)
return (
- <Row
- href={sectionHash('account', 'profile')}
- lead={<Avatar name={name} src={me ? memberAvatar(me) : null} size={32} />}
- title={name}
- line={t('settings.home.account.line')}
+ <PageGroup
+ id="sh-account"
+ label={t('settings.home.group.account')}
+ context={user?.email}
+ page="account"
+ sections={sections}
/>
)
}
+/** A group of an area's pages: its label with a grey word of context beside it, then one row per page. */
+function PageGroup({
+ id,
+ label,
+ context,
+ page,
+ sections,
+}: {
+ id: string
+ label: string
+ context?: string
+ page: string
+ sections: readonly { id: string; label: string; description?: string }[]
+}) {
+ return (
+ <section className="sh-group" aria-labelledby={id}>
+ <LineGroup as="h2" id={id} after={context && <span className="sh-context">{context}</span>}>
+ {label}
+ </LineGroup>
+ <Card className="sh-card">
+ <SettingRows>
+ {sections.map(s => (
+ <Row
+ key={s.id}
+ compact
+ href={sectionHash(page, s.id)}
+ lead={<Icon name={PAGE_ICONS[s.id] ?? 'right'} size={16} />}
+ title={s.label}
+ tip={s.description}
+ />
+ ))}
+ </SettingRows>
+ </Card>
+ </section>
+ )
+}
+
/** The assistant's mark: the waveform on the dark square, as in the navigation. */
function AssistantMark() {
return (
@@ -275,6 +311,7 @@ function AssistantMark() {
*/
function Row({
href,
+ compact,
lead,
title,
aside,
@@ -284,6 +321,8 @@ function Row({
tip,
}: {
href: string
+ /** A page of an area: one line, the small icon without its square. */
+ compact?: boolean
lead: ReactNode
title: string
aside?: string
@@ -295,7 +334,7 @@ function Row({
const row = (state: ReactNode) => (
<>
<SettingRow
- lead={<span className="sh-lead">{lead}</span>}
+ lead={<span className={compact ? 'sh-lead sh-lead-icon' : 'sh-lead'}>{lead}</span>}
title={<span className="sh-title">{title}</span>}
aside={aside}
description={line}
@@ -318,7 +357,7 @@ function Row({
</div>
)
return (
- <a className="sh-row" href={href} title={tip}>
+ <a className={compact ? 'sh-row sh-row-compact' : 'sh-row'} href={href} title={tip}>
{row(status && <span className="sh-state">{status}</span>)}
</a>
)
diff --git a/apps/web/src/settings/settings-home.css b/apps/web/src/settings/settings-home.css
index 33ad44ee..8ed5610f 100644
--- a/apps/web/src/settings/settings-home.css
+++ b/apps/web/src/settings/settings-home.css
@@ -180,3 +180,21 @@ button.sh-row:disabled {
outline: 2px solid var(--focus);
outline-offset: 2px;
}
+
+/* A page of Workspace settings or User settings (LIN-858): one line, its small icon in the same 32px column as the
+ assistants' marks, so every name starts at one edge. */
+.sh-row-compact {
+ min-height: 44px;
+ padding-top: 8px;
+ padding-bottom: 8px;
+}
+.sh-lead-icon {
+ color: var(--ink-muted);
+}
+/* The workspace's name and your email beside the group's label. */
+.sh-context {
+ min-width: 0;
+ overflow: hidden;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+}
diff --git a/packages/i18n/locales/en/settings.json b/packages/i18n/locales/en/settings.json
index ae211e4d..3d73b32b 100644
--- a/packages/i18n/locales/en/settings.json
+++ b/packages/i18n/locales/en/settings.json
@@ -896,7 +896,6 @@
"holidays.vacation.turnOn": "Turn on",
"holidays.vacation.until": "Last day closed",
"holidays.yourDay": "Your day",
- "home.account.line": "Profile, notifications, sign-in and API keys.",
"home.assistant.answering": "Answering calls",
"home.assistant.cannotAnswer": "Can't answer calls",
"home.assistant.cannotAnswerYet": "Can't answer calls yet",
@@ -908,11 +907,9 @@
"home.assistant.forwardingUnchecked": "Forwarding not checked",
"home.assistant.forwardingUncheckedTip": "Open Phone to test the forwarding",
"home.assistant.noNumber": "No number yet",
+ "home.group.account": "Your account",
"home.group.assistants": "Assistants",
"home.group.workspace": "Workspace",
- "home.group.you": "You",
- "home.workspace.line": "Shared by everyone: team, phone numbers, billing.",
- "home.workspace.lineNoBilling": "Shared by everyone: team and phone numbers.",
"hours.byDay": "Opening hours by day",
"hours.changeTip": "Change your business hours",
"hours.closed": "Closed",