rift-ds 1.38.0 → 1.40.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/behaviors/shortcuts.js +2 -2
- package/behaviors/top-layer.css +28 -0
- package/behaviors/useAnchoredPosition.d.ts +12 -9
- package/behaviors/useAnchoredPosition.js +3 -0
- package/behaviors/useFoldedSections.d.ts +17 -0
- package/behaviors/useFoldedSections.js +23 -0
- package/behaviors/useLayer.d.ts +9 -0
- package/behaviors/useLayer.js +4 -3
- package/bin/rift-ds.mjs +3 -0
- package/bin/templates/blocks/app/notifications/Inbox.tsx +163 -0
- package/bin/templates/blocks/app/notifications/page.module.css +63 -0
- package/bin/templates/blocks/app/notifications/page.tsx +13 -0
- package/bin/templates/blocks/app/settings/Settings.tsx +483 -0
- package/bin/templates/blocks/app/settings/page.module.css +160 -6
- package/bin/templates/blocks/app/settings/page.tsx +10 -78
- package/bin/templates/blocks/components/blocks/AppShell.module.css +16 -244
- package/bin/templates/blocks/components/blocks/AppShell.tsx +274 -84
- package/bin/templates/blocks/registry.json +16 -3
- package/chat/ChatThreads.d.ts +63 -19
- package/chat/ChatThreads.js +119 -32
- package/chat/ChatWidget.css +15 -3
- package/chat/ChatWidget.d.ts +16 -17
- package/chat/ChatWidget.js +40 -7
- package/chat/DemoWelcome.d.ts +7 -0
- package/chat/DemoWelcome.js +19 -0
- package/chat/demo-fixtures.d.ts +1 -1
- package/chat/demo-fixtures.js +1 -0
- package/chat/rail-seat.d.ts +25 -0
- package/chat/rail-seat.js +8 -0
- package/chat/registry.json.d.ts +4 -1
- package/chat/registry.json.js +1 -1
- package/components/AppLayout/AppLayout.css +64 -0
- package/components/AppLayout/AppLayout.d.ts +21 -1
- package/components/AppLayout/AppLayout.js +9 -2
- package/components/AppSidebar/AppSidebar.css +378 -16
- package/components/AppSidebar/AppSidebar.d.ts +92 -4
- package/components/AppSidebar/AppSidebar.js +321 -155
- package/components/AppToolbar/AppToolbar.css +143 -0
- package/components/AppToolbar/AppToolbar.d.ts +124 -0
- package/components/AppToolbar/AppToolbar.js +119 -0
- package/components/ColourSwatch/ColourSwatch.css +49 -0
- package/components/ColourSwatch/ColourSwatch.d.ts +9 -1
- package/components/ColourSwatch/ColourSwatch.js +12 -1
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.css +13 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.d.ts +7 -0
- package/components/CommandPaletteTrigger/CommandPaletteTrigger.js +2 -0
- package/components/Composer/Composer.css +20 -0
- package/components/Composer/Composer.d.ts +8 -0
- package/components/Composer/Composer.js +2 -0
- package/components/DrillMenu/DrillMenu.css +7 -0
- package/components/DrillMenu/DrillMenu.d.ts +6 -0
- package/components/DrillMenu/DrillMenu.js +2 -1
- package/components/NotificationCenter/NotificationCenter.css +145 -99
- package/components/NotificationCenter/NotificationCenter.d.ts +58 -4
- package/components/NotificationCenter/NotificationCenter.js +71 -63
- package/components/PaymentCard/PaymentCard.css +182 -0
- package/components/PaymentCard/PaymentCard.d.ts +80 -0
- package/components/PaymentCard/PaymentCard.js +80 -0
- package/components/PromptSuggestions/PromptSuggestions.css +180 -11
- package/components/PromptSuggestions/PromptSuggestions.d.ts +24 -3
- package/components/PromptSuggestions/PromptSuggestions.js +35 -9
- package/components/RadioButton/RadioButton.d.ts +2 -1
- package/components/RadioButton/RadioButton.js +1 -0
- package/components/ShaderScene/scenes.js +6 -5
- package/components/Stat/Stat.css +19 -19
- package/components/SubNavPanel/SubNavPanel.css +21 -0
- package/components/SubNavPanel/SubNavPanel.js +19 -2
- package/components/ThreadHistory/ThreadHistory.css +519 -0
- package/components/ThreadHistory/ThreadHistory.d.ts +90 -0
- package/components/ThreadHistory/ThreadHistory.js +344 -0
- package/components/ThreadPanel/ThreadPanel.css +90 -306
- package/components/ThreadPanel/ThreadPanel.d.ts +16 -0
- package/components/ThreadPanel/ThreadPanel.js +67 -241
- package/components/registry.json +57 -7
- package/components/registry.json.d.ts +57 -7
- package/components/registry.json.js +1 -1
- package/index.d.ts +3 -0
- package/index.js +6 -0
- package/package.json +1 -1
- package/tokens/presets/contrast.css +36 -19
- package/tokens/presets/coral.css +2 -0
- package/tokens/presets/forest.css +8 -0
- package/tokens/presets/pink.css +2 -0
- package/tokens/presets/violet.css +51 -21
- package/tokens/presets/zest.css +4 -0
- package/tokens/values.json.js +1 -1
- package/bin/templates/blocks/app/settings/ProfileForm.tsx +0 -98
|
@@ -0,0 +1,483 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The settings block's page. The open section follows the address's hash,
|
|
5
|
+
* which the sidebar's settings links set (so the back button and a pasted
|
|
6
|
+
* link land on the right one), and the page header names it.
|
|
7
|
+
*
|
|
8
|
+
* Every section is built from the same few parts, so a new setting is one
|
|
9
|
+
* more of them, whatever its control:
|
|
10
|
+
*
|
|
11
|
+
* - Group: a heading over its rows, a rule between one group and the next.
|
|
12
|
+
* - Row: what the setting is and a sentence on why (with a link where it
|
|
13
|
+
* helps) on the left; its value and its control on the right; an icon
|
|
14
|
+
* tile leading it when it reports a status. The control is whatever the
|
|
15
|
+
* setting needs: an Edit that edits in place, a switch that saves as it
|
|
16
|
+
* flips, a chevron that opens more, a button that acts.
|
|
17
|
+
* - Fields: labelled controls set side by side, two to a row, for settings
|
|
18
|
+
* read together (a pair of selects, a pair of sliders).
|
|
19
|
+
*
|
|
20
|
+
* The values are placeholders. Replace them with your own, `save` with a
|
|
21
|
+
* call to your server, and `check` with your rules or the errors your
|
|
22
|
+
* server returns.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import { useState, useSyncExternalStore, type ReactNode } from 'react';
|
|
26
|
+
import { Alert } from 'rift-ds/components/Alert/Alert';
|
|
27
|
+
import { Avatar } from 'rift-ds/components/Avatar/Avatar';
|
|
28
|
+
import { Button } from 'rift-ds/components/Button/Button';
|
|
29
|
+
import { Dropdown } from 'rift-ds/components/Dropdown/Dropdown';
|
|
30
|
+
import { Icon } from 'rift-ds/components/Icon/Icon';
|
|
31
|
+
import { IconButton } from 'rift-ds/components/IconButton/IconButton';
|
|
32
|
+
import { Input } from 'rift-ds/components/Input/Input';
|
|
33
|
+
import { Link } from 'rift-ds/components/Link/Link';
|
|
34
|
+
import { Meter } from 'rift-ds/components/Meter/Meter';
|
|
35
|
+
import { RadioGroup } from 'rift-ds/components/RadioButton/RadioButton';
|
|
36
|
+
import { SegmentedControl } from 'rift-ds/components/SegmentedControl/SegmentedControl';
|
|
37
|
+
import { Slider } from 'rift-ds/components/Slider/Slider';
|
|
38
|
+
import { ToggleSwitch } from 'rift-ds/components/ToggleSwitch/ToggleSwitch';
|
|
39
|
+
import { AppShell, SETTINGS_SECTIONS } from '../../components/blocks/AppShell';
|
|
40
|
+
import styles from './page.module.css';
|
|
41
|
+
|
|
42
|
+
type SectionId = (typeof SETTINGS_SECTIONS)[number]['id'];
|
|
43
|
+
|
|
44
|
+
const subscribeHash = (callback: () => void) => {
|
|
45
|
+
window.addEventListener('hashchange', callback);
|
|
46
|
+
return () => window.removeEventListener('hashchange', callback);
|
|
47
|
+
};
|
|
48
|
+
const readSection = (): SectionId => {
|
|
49
|
+
const id = window.location.hash.slice(1);
|
|
50
|
+
return SETTINGS_SECTIONS.some((section) => section.id === id) ? (id as SectionId) : 'general';
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
const TIME_ZONES = [
|
|
54
|
+
{ value: 'Pacific Time', label: 'Pacific Time' },
|
|
55
|
+
{ value: 'Eastern Time', label: 'Eastern Time' },
|
|
56
|
+
{ value: 'Central European Time', label: 'Central European Time' },
|
|
57
|
+
{ value: 'UTC', label: 'UTC' },
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
const CURRENCIES = [
|
|
61
|
+
{ value: 'usd', label: 'US dollar' },
|
|
62
|
+
{ value: 'eur', label: 'Euro' },
|
|
63
|
+
{ value: 'gbp', label: 'Pound sterling' },
|
|
64
|
+
];
|
|
65
|
+
|
|
66
|
+
const HOURS = ['18:00', '20:00', '22:00', '06:00', '08:00'].map((hour) => ({ value: hour, label: hour }));
|
|
67
|
+
|
|
68
|
+
/** Every setting edited in place, by key. */
|
|
69
|
+
type FieldKey = 'workspaceName' | 'workspaceUrl' | 'name' | 'email' | 'phone' | 'password';
|
|
70
|
+
|
|
71
|
+
const INITIAL: Record<FieldKey, string> = {
|
|
72
|
+
workspaceName: 'Acme',
|
|
73
|
+
workspaceUrl: 'acme',
|
|
74
|
+
name: 'Alex Morgan',
|
|
75
|
+
email: 'alex@example.com',
|
|
76
|
+
phone: '+1 (555) 010-0199',
|
|
77
|
+
password: '',
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
function check(key: FieldKey, value: string): string | undefined {
|
|
81
|
+
if (!value.trim()) return 'Enter a value.';
|
|
82
|
+
if (key === 'email' && !/^\S+@\S+\.\S+$/.test(value)) return 'Enter an email address like name@example.com.';
|
|
83
|
+
if (key === 'workspaceUrl' && !/^[a-z0-9-]+$/.test(value)) return 'Use lowercase letters, numbers and dashes.';
|
|
84
|
+
if (key === 'password' && value.length < 12) return 'Use at least 12 characters.';
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
/** Shows only the end of a value, as a value worth guarding should be shown. */
|
|
89
|
+
function mask(key: FieldKey, value: string) {
|
|
90
|
+
if (key === 'email') return value.replace(/^[^@]+/, (name) => '•'.repeat(Math.max(4, name.length)));
|
|
91
|
+
if (key === 'phone') return `•••••••${value.replace(/\D/g, '').slice(-4)}`;
|
|
92
|
+
return value;
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
/** A heading over its rows; a rule parts one group from the next. */
|
|
96
|
+
function Group({ title, children }: { title?: string; children: ReactNode }) {
|
|
97
|
+
return (
|
|
98
|
+
<section className={styles.group} aria-label={title ? undefined : 'More settings'}>
|
|
99
|
+
{title ? <h2 className={styles.groupTitle}>{title}</h2> : null}
|
|
100
|
+
<div className={styles.rows}>{children}</div>
|
|
101
|
+
</section>
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* One setting: the label and its sentence, its value, its control, and an
|
|
107
|
+
* icon tile leading it when it reports a status.
|
|
108
|
+
*/
|
|
109
|
+
function Row({
|
|
110
|
+
label,
|
|
111
|
+
description,
|
|
112
|
+
value,
|
|
113
|
+
control,
|
|
114
|
+
icon,
|
|
115
|
+
status,
|
|
116
|
+
below,
|
|
117
|
+
}: {
|
|
118
|
+
label: string;
|
|
119
|
+
description?: ReactNode;
|
|
120
|
+
value?: ReactNode;
|
|
121
|
+
control?: ReactNode;
|
|
122
|
+
icon?: ReactNode;
|
|
123
|
+
status?: 'positive' | 'default';
|
|
124
|
+
below?: ReactNode;
|
|
125
|
+
}) {
|
|
126
|
+
return (
|
|
127
|
+
<div className={styles.row}>
|
|
128
|
+
{icon ? (
|
|
129
|
+
<span className={styles.tile} data-status={status ?? 'default'}>
|
|
130
|
+
{icon}
|
|
131
|
+
</span>
|
|
132
|
+
) : null}
|
|
133
|
+
<div className={styles.text}>
|
|
134
|
+
<span className={styles.label}>{label}</span>
|
|
135
|
+
{description ? <span className={styles.description}>{description}</span> : null}
|
|
136
|
+
</div>
|
|
137
|
+
{value !== undefined || control ? (
|
|
138
|
+
<div className={styles.end}>
|
|
139
|
+
{value !== undefined ? <span className={styles.value}>{value}</span> : null}
|
|
140
|
+
{control}
|
|
141
|
+
</div>
|
|
142
|
+
) : null}
|
|
143
|
+
{below ? <div className={styles.below}>{below}</div> : null}
|
|
144
|
+
</div>
|
|
145
|
+
);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
/** Labelled controls side by side, two to a row, one on a phone. */
|
|
149
|
+
function Fields({ children }: { children: ReactNode }) {
|
|
150
|
+
return <div className={styles.fields}>{children}</div>;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export function Settings() {
|
|
154
|
+
const active = useSyncExternalStore(subscribeHash, readSection, () => 'general' as SectionId);
|
|
155
|
+
const section = SETTINGS_SECTIONS.find((entry) => entry.id === active) ?? SETTINGS_SECTIONS[0];
|
|
156
|
+
|
|
157
|
+
const [values, setValues] = useState(INITIAL);
|
|
158
|
+
// An edit remembers its section, so leaving the section leaves it behind.
|
|
159
|
+
const [editing, setEditing] = useState<{ section: SectionId; key: FieldKey } | null>(null);
|
|
160
|
+
const [draft, setDraft] = useState('');
|
|
161
|
+
const [error, setError] = useState<string | undefined>();
|
|
162
|
+
const [revealed, setRevealed] = useState<FieldKey[]>([]);
|
|
163
|
+
const [noticeShown, setNoticeShown] = useState(true);
|
|
164
|
+
const [settings, setSettings] = useState({
|
|
165
|
+
timeZone: 'Pacific Time',
|
|
166
|
+
currency: 'usd',
|
|
167
|
+
weekStart: 'monday',
|
|
168
|
+
mentions: true,
|
|
169
|
+
approvals: true,
|
|
170
|
+
weeklySummary: true,
|
|
171
|
+
productNews: false,
|
|
172
|
+
digest: 'daily',
|
|
173
|
+
quietFrom: '20:00',
|
|
174
|
+
quietUntil: '08:00',
|
|
175
|
+
urgentAlerts: true,
|
|
176
|
+
signOutAfter: 60,
|
|
177
|
+
});
|
|
178
|
+
const set = <K extends keyof typeof settings>(key: K) => (value: (typeof settings)[K]) =>
|
|
179
|
+
setSettings((current) => ({ ...current, [key]: value }));
|
|
180
|
+
|
|
181
|
+
const editingKey = editing?.section === active ? editing.key : null;
|
|
182
|
+
const startEdit = (key: FieldKey) => {
|
|
183
|
+
setEditing({ section: active, key });
|
|
184
|
+
setDraft(key === 'password' ? '' : values[key]);
|
|
185
|
+
setError(undefined);
|
|
186
|
+
};
|
|
187
|
+
const cancel = () => {
|
|
188
|
+
setEditing(null);
|
|
189
|
+
setError(undefined);
|
|
190
|
+
};
|
|
191
|
+
const save = () => {
|
|
192
|
+
if (!editingKey) return;
|
|
193
|
+
const problem = check(editingKey, draft);
|
|
194
|
+
if (problem) {
|
|
195
|
+
setError(problem);
|
|
196
|
+
return;
|
|
197
|
+
}
|
|
198
|
+
// Save to your server here, and show what it returns.
|
|
199
|
+
setValues((current) => ({ ...current, [editingKey]: draft }));
|
|
200
|
+
setEditing(null);
|
|
201
|
+
};
|
|
202
|
+
|
|
203
|
+
/**
|
|
204
|
+
* A row edited in place: its value and an Edit at rest; its field, Save
|
|
205
|
+
* and Cancel while editing. `masked` hides the value behind a Reveal.
|
|
206
|
+
*/
|
|
207
|
+
const editable = (key: FieldKey, label: string, description?: string, options: { masked?: boolean; display?: string } = {}) => {
|
|
208
|
+
if (editingKey === key) {
|
|
209
|
+
return (
|
|
210
|
+
<Row
|
|
211
|
+
label={label}
|
|
212
|
+
description={description}
|
|
213
|
+
below={
|
|
214
|
+
<form
|
|
215
|
+
className={styles.editor}
|
|
216
|
+
// The check below runs on Save, so the browser's own stays out of it.
|
|
217
|
+
noValidate
|
|
218
|
+
onSubmit={(event) => {
|
|
219
|
+
event.preventDefault();
|
|
220
|
+
save();
|
|
221
|
+
}}
|
|
222
|
+
>
|
|
223
|
+
<Input
|
|
224
|
+
aria-label={label}
|
|
225
|
+
type={key === 'email' ? 'email' : key === 'phone' ? 'tel' : key === 'password' ? 'password' : 'text'}
|
|
226
|
+
value={draft}
|
|
227
|
+
onValueChange={setDraft}
|
|
228
|
+
errorText={error}
|
|
229
|
+
prefix={key === 'workspaceUrl' ? 'acme.app/' : undefined}
|
|
230
|
+
autoFocus
|
|
231
|
+
/>
|
|
232
|
+
<div className={styles.editorActions}>
|
|
233
|
+
<Button type="submit" size="compact" label="Save" />
|
|
234
|
+
<Button size="compact" variant="tertiary" label="Cancel" onClick={cancel} />
|
|
235
|
+
</div>
|
|
236
|
+
</form>
|
|
237
|
+
}
|
|
238
|
+
/>
|
|
239
|
+
);
|
|
240
|
+
}
|
|
241
|
+
const shown = !options.masked || revealed.includes(key);
|
|
242
|
+
return (
|
|
243
|
+
<Row
|
|
244
|
+
label={label}
|
|
245
|
+
description={description}
|
|
246
|
+
value={
|
|
247
|
+
key === 'password' ? undefined : (
|
|
248
|
+
<>
|
|
249
|
+
{options.display ?? (shown ? values[key] : mask(key, values[key]))}
|
|
250
|
+
{options.masked && !shown ? (
|
|
251
|
+
<Button
|
|
252
|
+
size="compact"
|
|
253
|
+
variant="tertiary"
|
|
254
|
+
label="Reveal"
|
|
255
|
+
aria-label={`Reveal ${label.toLowerCase()}`}
|
|
256
|
+
onClick={() => setRevealed((keys) => [...keys, key])}
|
|
257
|
+
/>
|
|
258
|
+
) : null}
|
|
259
|
+
</>
|
|
260
|
+
)
|
|
261
|
+
}
|
|
262
|
+
control={
|
|
263
|
+
<Button
|
|
264
|
+
size="compact"
|
|
265
|
+
variant="secondary"
|
|
266
|
+
label="Edit"
|
|
267
|
+
aria-label={`Edit ${label.toLowerCase()}`}
|
|
268
|
+
onClick={() => startEdit(key)}
|
|
269
|
+
/>
|
|
270
|
+
}
|
|
271
|
+
/>
|
|
272
|
+
);
|
|
273
|
+
};
|
|
274
|
+
|
|
275
|
+
/** A row that opens more: its state, then a chevron. */
|
|
276
|
+
const opens = (label: string, description: string, value: string, icon?: ReactNode, status?: 'positive') => (
|
|
277
|
+
<Row
|
|
278
|
+
label={label}
|
|
279
|
+
description={description}
|
|
280
|
+
value={value}
|
|
281
|
+
icon={icon}
|
|
282
|
+
status={status}
|
|
283
|
+
control={<IconButton icon="chevron_right" variant="tertiary" size="compact" label={`Manage ${label.toLowerCase()}`} />}
|
|
284
|
+
/>
|
|
285
|
+
);
|
|
286
|
+
|
|
287
|
+
/** A row whose switch saves as it flips. */
|
|
288
|
+
const toggle = (key: 'mentions' | 'approvals' | 'weeklySummary' | 'productNews' | 'urgentAlerts', label: string, description: ReactNode) => (
|
|
289
|
+
<Row
|
|
290
|
+
label={label}
|
|
291
|
+
description={description}
|
|
292
|
+
control={<ToggleSwitch label={label} showLabel={false} checked={settings[key]} onCheckedChange={set(key)} />}
|
|
293
|
+
/>
|
|
294
|
+
);
|
|
295
|
+
|
|
296
|
+
return (
|
|
297
|
+
<AppShell
|
|
298
|
+
activeKey="settings"
|
|
299
|
+
activeSubKey={active}
|
|
300
|
+
breadcrumb={[{ label: 'Acme', href: '#' }, { label: 'Settings', href: '#general' }, { label: section.label }]}
|
|
301
|
+
title={section.label}
|
|
302
|
+
description={section.description}
|
|
303
|
+
>
|
|
304
|
+
<div className={styles.page}>
|
|
305
|
+
{active === 'general' && (
|
|
306
|
+
<>
|
|
307
|
+
<Group title="Workspace">
|
|
308
|
+
{editable('workspaceName', 'Workspace name', 'Shown in the sidebar and in every email we send.')}
|
|
309
|
+
{editable('workspaceUrl', 'Workspace address', 'Where your team signs in.', {
|
|
310
|
+
display: `acme.app/${values.workspaceUrl}`,
|
|
311
|
+
})}
|
|
312
|
+
<Row
|
|
313
|
+
label="Logo"
|
|
314
|
+
description="Square, at least 256 pixels. It appears beside the workspace name."
|
|
315
|
+
icon={<Avatar name={values.workspaceName} shape="square" aria-label={`${values.workspaceName} logo`} />}
|
|
316
|
+
control={<Button size="compact" variant="secondary" label="Change" aria-label="Change logo" />}
|
|
317
|
+
/>
|
|
318
|
+
</Group>
|
|
319
|
+
|
|
320
|
+
<Group title="Region">
|
|
321
|
+
<Fields>
|
|
322
|
+
<Dropdown label="Time zone" options={TIME_ZONES} value={settings.timeZone} onValueChange={set('timeZone')} />
|
|
323
|
+
<Dropdown label="Currency" options={CURRENCIES} value={settings.currency} onValueChange={set('currency')} />
|
|
324
|
+
</Fields>
|
|
325
|
+
<Row
|
|
326
|
+
label="Week starts on"
|
|
327
|
+
description="For calendars, schedules and weekly reports."
|
|
328
|
+
control={
|
|
329
|
+
<SegmentedControl
|
|
330
|
+
aria-label="Week starts on"
|
|
331
|
+
segments={[
|
|
332
|
+
{ value: 'monday', label: 'Monday' },
|
|
333
|
+
{ value: 'sunday', label: 'Sunday' },
|
|
334
|
+
]}
|
|
335
|
+
value={settings.weekStart}
|
|
336
|
+
onValueChange={set('weekStart')}
|
|
337
|
+
/>
|
|
338
|
+
}
|
|
339
|
+
/>
|
|
340
|
+
</Group>
|
|
341
|
+
|
|
342
|
+
<Group title="Plan and usage">
|
|
343
|
+
<Row
|
|
344
|
+
label="Plan"
|
|
345
|
+
description="Up to 25 members and 10 GB of files."
|
|
346
|
+
value="Team"
|
|
347
|
+
control={<Button size="compact" variant="secondary" label="Change plan" />}
|
|
348
|
+
/>
|
|
349
|
+
<Row
|
|
350
|
+
label="Storage"
|
|
351
|
+
description="Files, receipts and exports across the workspace."
|
|
352
|
+
below={<Meter label="Storage used" value={62} valueText="6.2 of 10 GB" showValue />}
|
|
353
|
+
/>
|
|
354
|
+
</Group>
|
|
355
|
+
|
|
356
|
+
<Group>
|
|
357
|
+
<Row
|
|
358
|
+
label="Archive this workspace"
|
|
359
|
+
description="Hides it for everyone until an admin restores it. Nothing is deleted."
|
|
360
|
+
control={<Button size="compact" variant="secondary" tone="destructive" label="Archive" />}
|
|
361
|
+
/>
|
|
362
|
+
<Row
|
|
363
|
+
label="Delete this workspace"
|
|
364
|
+
description="Removes the workspace and everything in it for every member. This cannot be undone."
|
|
365
|
+
control={<Button size="compact" variant="primary" tone="destructive" label="Delete workspace" />}
|
|
366
|
+
/>
|
|
367
|
+
</Group>
|
|
368
|
+
</>
|
|
369
|
+
)}
|
|
370
|
+
|
|
371
|
+
{active === 'notifications' && (
|
|
372
|
+
<>
|
|
373
|
+
{noticeShown ? (
|
|
374
|
+
<Alert
|
|
375
|
+
variant="info"
|
|
376
|
+
description="Notifications wait during your quiet hours and arrive together when they end, except the urgent ones you allow."
|
|
377
|
+
dismissible
|
|
378
|
+
onDismiss={() => setNoticeShown(false)}
|
|
379
|
+
/>
|
|
380
|
+
) : null}
|
|
381
|
+
|
|
382
|
+
<Group title="Email">
|
|
383
|
+
{toggle('mentions', 'Mentions', 'When someone mentions you in a comment or a note.')}
|
|
384
|
+
{toggle('approvals', 'Approvals waiting', 'When a request needs your yes or no.')}
|
|
385
|
+
{toggle('weeklySummary', 'Weekly summary', 'Monday morning: what moved last week.')}
|
|
386
|
+
{toggle(
|
|
387
|
+
'productNews',
|
|
388
|
+
'Product news',
|
|
389
|
+
<>
|
|
390
|
+
New features, now and then. <Link href="#notifications">Learn more</Link>
|
|
391
|
+
</>,
|
|
392
|
+
)}
|
|
393
|
+
</Group>
|
|
394
|
+
|
|
395
|
+
<Group title="Digest">
|
|
396
|
+
<RadioGroup
|
|
397
|
+
label="How often we gather the rest"
|
|
398
|
+
value={settings.digest}
|
|
399
|
+
onValueChange={set('digest')}
|
|
400
|
+
options={[
|
|
401
|
+
{ value: 'off', label: 'Off', description: 'Each notification arrives on its own.' },
|
|
402
|
+
{ value: 'daily', label: 'Daily', description: 'One email at the end of the day.' },
|
|
403
|
+
{ value: 'weekly', label: 'Weekly', description: 'One email on Friday afternoon.' },
|
|
404
|
+
]}
|
|
405
|
+
/>
|
|
406
|
+
</Group>
|
|
407
|
+
|
|
408
|
+
<Group title="Quiet hours">
|
|
409
|
+
<Fields>
|
|
410
|
+
<Dropdown label="From" options={HOURS} value={settings.quietFrom} onValueChange={set('quietFrom')} />
|
|
411
|
+
<Dropdown label="Until" options={HOURS} value={settings.quietUntil} onValueChange={set('quietUntil')} />
|
|
412
|
+
</Fields>
|
|
413
|
+
{toggle('urgentAlerts', 'Allow urgent alerts', 'A frozen card or a failed payment still reaches you.')}
|
|
414
|
+
</Group>
|
|
415
|
+
</>
|
|
416
|
+
)}
|
|
417
|
+
|
|
418
|
+
{active === 'profile' && (
|
|
419
|
+
<>
|
|
420
|
+
<Group title="Account info">
|
|
421
|
+
{editable('name', 'Name')}
|
|
422
|
+
{editable('email', 'Email', 'Where sign-in links and notifications go.', { masked: true })}
|
|
423
|
+
{editable('phone', 'Phone number', 'Used for two-step verification.', { masked: true })}
|
|
424
|
+
</Group>
|
|
425
|
+
|
|
426
|
+
<Group title="Photo">
|
|
427
|
+
<Row
|
|
428
|
+
label="Profile photo"
|
|
429
|
+
description="Shown beside your name in comments, approvals and the sidebar."
|
|
430
|
+
icon={<Avatar name={values.name} />}
|
|
431
|
+
control={<Button size="compact" variant="secondary" label="Upload" aria-label="Upload a profile photo" />}
|
|
432
|
+
/>
|
|
433
|
+
</Group>
|
|
434
|
+
</>
|
|
435
|
+
)}
|
|
436
|
+
|
|
437
|
+
{active === 'security' && (
|
|
438
|
+
<>
|
|
439
|
+
<Group title="Password and security">
|
|
440
|
+
{editable('password', 'Password', 'Last changed three months ago.')}
|
|
441
|
+
{opens('Two-step verification', 'A code from your phone each time you sign in.', 'Enabled')}
|
|
442
|
+
{opens('Signed-in devices', 'This laptop, and two others.', '3 devices')}
|
|
443
|
+
</Group>
|
|
444
|
+
|
|
445
|
+
<Group title="Sessions">
|
|
446
|
+
<Row
|
|
447
|
+
label="Sign out after"
|
|
448
|
+
description="How long a quiet session stays signed in, on every device."
|
|
449
|
+
value={`${settings.signOutAfter} minutes`}
|
|
450
|
+
below={
|
|
451
|
+
<Slider
|
|
452
|
+
aria-label="Sign out after, in minutes"
|
|
453
|
+
min={15}
|
|
454
|
+
max={240}
|
|
455
|
+
step={15}
|
|
456
|
+
value={settings.signOutAfter}
|
|
457
|
+
onValueChange={set('signOutAfter')}
|
|
458
|
+
/>
|
|
459
|
+
}
|
|
460
|
+
/>
|
|
461
|
+
</Group>
|
|
462
|
+
|
|
463
|
+
<Group title="Account status">
|
|
464
|
+
{opens(
|
|
465
|
+
'Account standing',
|
|
466
|
+
'Thanks for keeping to the terms. A problem would show here.',
|
|
467
|
+
'All good',
|
|
468
|
+
<Icon name="check_circle" tone="inherit" />,
|
|
469
|
+
'positive',
|
|
470
|
+
)}
|
|
471
|
+
<Row
|
|
472
|
+
label="Role"
|
|
473
|
+
description="Admins can change billing, members and these settings."
|
|
474
|
+
value="Admin"
|
|
475
|
+
icon={<Icon name="shield_person" tone="inherit" />}
|
|
476
|
+
/>
|
|
477
|
+
</Group>
|
|
478
|
+
</>
|
|
479
|
+
)}
|
|
480
|
+
</div>
|
|
481
|
+
</AppShell>
|
|
482
|
+
);
|
|
483
|
+
}
|
|
@@ -1,11 +1,165 @@
|
|
|
1
|
-
/* The settings
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/* The settings page: a standard page, its groups across the whole content
|
|
2
|
+
column. Every group is a heading over rows, and every row the same shape
|
|
3
|
+
whatever its control: an optional icon tile, the label over its sentence,
|
|
4
|
+
then the value and the control at the end. A phone stacks the end under
|
|
5
|
+
the text. */
|
|
5
6
|
|
|
6
|
-
.
|
|
7
|
+
.page {
|
|
7
8
|
display: flex;
|
|
8
9
|
flex-direction: column;
|
|
9
10
|
gap: var(--gap-1000);
|
|
10
|
-
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
/* A rule parts one group from the next. */
|
|
14
|
+
.group {
|
|
15
|
+
display: flex;
|
|
16
|
+
flex-direction: column;
|
|
17
|
+
gap: var(--gap-400);
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.group + .group {
|
|
21
|
+
padding-top: var(--padding-1000);
|
|
22
|
+
border-top: var(--border-025) solid var(--color-divider);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.groupTitle {
|
|
26
|
+
margin: 0;
|
|
27
|
+
color: var(--color-text-primary);
|
|
28
|
+
font-family: var(--font-heading-3-family);
|
|
29
|
+
font-size: var(--font-heading-3-size);
|
|
30
|
+
font-weight: var(--font-heading-3-weight);
|
|
31
|
+
line-height: var(--font-heading-3-line-height);
|
|
32
|
+
letter-spacing: var(--font-heading-3-letter-spacing);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
.rows {
|
|
36
|
+
display: flex;
|
|
37
|
+
flex-direction: column;
|
|
38
|
+
gap: var(--gap-500);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/* A row: the tile and the text take the room, the end holds the value and
|
|
42
|
+
the control; what sits below (a field being edited, a meter) spans it. */
|
|
43
|
+
.row {
|
|
44
|
+
display: grid;
|
|
45
|
+
grid-template-columns: auto minmax(0, 1fr) auto;
|
|
46
|
+
grid-template-areas: 'tile text end' 'below below below';
|
|
47
|
+
align-items: center;
|
|
48
|
+
column-gap: var(--gap-400);
|
|
49
|
+
row-gap: var(--gap-300);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.row:not(:has(.tile)) {
|
|
53
|
+
grid-template-columns: minmax(0, 1fr) auto;
|
|
54
|
+
grid-template-areas: 'text end' 'below below';
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.tile {
|
|
58
|
+
grid-area: tile;
|
|
59
|
+
display: inline-flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
justify-content: center;
|
|
62
|
+
width: var(--control-height-default);
|
|
63
|
+
height: var(--control-height-default);
|
|
64
|
+
border-radius: var(--radius-300);
|
|
65
|
+
background-color: var(--color-bg-container-secondary);
|
|
66
|
+
color: var(--color-icon-primary);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.tile[data-status='positive'] {
|
|
70
|
+
background-color: var(--color-status-positive-bg);
|
|
71
|
+
color: var(--color-status-positive-icon);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
.text {
|
|
75
|
+
grid-area: text;
|
|
76
|
+
display: flex;
|
|
77
|
+
flex-direction: column;
|
|
78
|
+
gap: var(--gap-050);
|
|
79
|
+
min-width: 0;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
.label {
|
|
83
|
+
color: var(--color-text-primary);
|
|
84
|
+
font-family: var(--font-paragraph-emphasis-family);
|
|
85
|
+
font-size: var(--font-paragraph-emphasis-size);
|
|
86
|
+
font-weight: var(--font-paragraph-emphasis-weight);
|
|
87
|
+
line-height: var(--font-paragraph-emphasis-line-height);
|
|
88
|
+
letter-spacing: var(--font-paragraph-emphasis-letter-spacing);
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
.description {
|
|
92
|
+
color: var(--color-text-secondary);
|
|
93
|
+
font-family: var(--font-paragraph-sm-family);
|
|
94
|
+
font-size: var(--font-paragraph-sm-size);
|
|
95
|
+
font-weight: var(--font-paragraph-sm-weight);
|
|
96
|
+
line-height: var(--font-paragraph-sm-line-height);
|
|
97
|
+
letter-spacing: var(--font-paragraph-sm-letter-spacing);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
.end {
|
|
101
|
+
grid-area: end;
|
|
102
|
+
display: flex;
|
|
103
|
+
align-items: center;
|
|
104
|
+
justify-content: flex-end;
|
|
105
|
+
gap: var(--gap-300);
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.value {
|
|
109
|
+
display: inline-flex;
|
|
110
|
+
align-items: center;
|
|
111
|
+
gap: var(--gap-200);
|
|
112
|
+
color: var(--color-text-primary);
|
|
113
|
+
font-family: var(--font-paragraph-family);
|
|
114
|
+
font-size: var(--font-paragraph-size);
|
|
115
|
+
font-weight: var(--font-paragraph-weight);
|
|
116
|
+
line-height: var(--font-paragraph-line-height);
|
|
117
|
+
letter-spacing: var(--font-paragraph-letter-spacing);
|
|
118
|
+
font-variant-numeric: tabular-nums;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.below {
|
|
122
|
+
grid-area: below;
|
|
123
|
+
min-width: 0;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
/* Two labelled controls to a row, the way settings read together sit. */
|
|
127
|
+
.fields {
|
|
128
|
+
display: grid;
|
|
129
|
+
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
130
|
+
gap: var(--gap-500);
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
/* A row in edit: its field over Save and Cancel. */
|
|
134
|
+
.editor {
|
|
135
|
+
display: flex;
|
|
136
|
+
flex-direction: column;
|
|
137
|
+
gap: var(--gap-300);
|
|
138
|
+
max-width: 420px; /* a field's comfortable width */
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
.editorActions {
|
|
142
|
+
display: flex;
|
|
143
|
+
gap: var(--gap-200);
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
@media (max-width: 600px) {
|
|
147
|
+
.row,
|
|
148
|
+
.row:not(:has(.tile)) {
|
|
149
|
+
grid-template-columns: minmax(0, 1fr);
|
|
150
|
+
grid-template-areas: 'text' 'end' 'below';
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.row:has(.tile) {
|
|
154
|
+
grid-template-columns: auto minmax(0, 1fr);
|
|
155
|
+
grid-template-areas: 'tile text' 'end end' 'below below';
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
.end {
|
|
159
|
+
justify-content: flex-start;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
.fields {
|
|
163
|
+
grid-template-columns: minmax(0, 1fr);
|
|
164
|
+
}
|
|
11
165
|
}
|