oneslash-design-system 2.28.1 → 2.30.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 +1 -1
- package/dist/DESIGN.md +31 -1
- package/dist/cases/about-page.md +2 -0
- package/dist/cases/accept-invite.md +2 -0
- package/dist/cases/account-menu.md +2 -0
- package/dist/cases/activity-timeline.md +2 -0
- package/dist/cases/admin-inbox.md +2 -0
- package/dist/cases/agent-asks-before-risky-action.md +3 -1
- package/dist/cases/agent-cancels-when-unanswered.md +2 -0
- package/dist/cases/agent-changes-review/all-at-once.d.ts +1 -0
- package/dist/cases/agent-changes-review/all-at-once.jsx +238 -0
- package/dist/cases/agent-changes-review/per-change.d.ts +1 -0
- package/dist/cases/agent-changes-review/per-change.jsx +203 -0
- package/dist/cases/agent-changes-review.md +585 -0
- package/dist/cases/agent-handoff/to-agent.d.ts +1 -0
- package/dist/cases/agent-handoff/to-agent.jsx +53 -0
- package/dist/cases/agent-handoff/to-person.d.ts +1 -0
- package/dist/cases/agent-handoff/to-person.jsx +84 -0
- package/dist/cases/agent-handoff.md +231 -0
- package/dist/cases/agent-memory/list.d.ts +1 -0
- package/dist/cases/agent-memory/list.jsx +256 -0
- package/dist/cases/agent-memory.md +354 -0
- package/dist/cases/agent-options.md +2 -0
- package/dist/cases/agent-pending-reply/steps.jsx +70 -21
- package/dist/cases/agent-pending-reply.md +74 -27
- package/dist/cases/agent-permissions/levels.d.ts +3 -0
- package/dist/cases/agent-permissions/levels.jsx +51 -0
- package/dist/cases/agent-permissions/per-tool.d.ts +3 -0
- package/dist/cases/agent-permissions/per-tool.jsx +180 -0
- package/dist/cases/agent-permissions.md +319 -0
- package/dist/cases/agent-plan-proposal/changes.jsx +18 -11
- package/dist/cases/agent-plan-proposal/steps.jsx +11 -4
- package/dist/cases/agent-plan-proposal.md +36 -21
- package/dist/cases/agent-question.md +2 -0
- package/dist/cases/agent-refuses-clearly.md +2 -0
- package/dist/cases/agent-run-failure/limit-reached.d.ts +1 -0
- package/dist/cases/agent-run-failure/limit-reached.jsx +172 -0
- package/dist/cases/agent-run-failure/step-failed.d.ts +3 -0
- package/dist/cases/agent-run-failure/step-failed.jsx +187 -0
- package/dist/cases/agent-run-failure.md +500 -0
- package/dist/cases/agent-says-what-it-is.md +2 -0
- package/dist/cases/agent-says-where-it-stopped.md +27 -0
- package/dist/cases/agent-settings.md +2 -0
- package/dist/cases/agent-shows-progress.md +2 -0
- package/dist/cases/agent-shows-sources.md +2 -0
- package/dist/cases/api-keys.md +2 -0
- package/dist/cases/app-shell.md +2 -0
- package/dist/cases/artifact-card.md +2 -0
- package/dist/cases/ask-page.md +2 -0
- package/dist/cases/auth-gate-loading.md +2 -0
- package/dist/cases/billing-page.md +2 -0
- package/dist/cases/blog-index.md +2 -0
- package/dist/cases/breadcrumb.md +2 -0
- package/dist/cases/breakdown-list.md +2 -0
- package/dist/cases/bulk-actions/list.d.ts +1 -0
- package/dist/cases/bulk-actions/list.jsx +206 -0
- package/dist/cases/bulk-actions/paged-table.d.ts +1 -0
- package/dist/cases/bulk-actions/paged-table.jsx +243 -0
- package/dist/cases/bulk-actions.md +553 -0
- package/dist/cases/changelog.md +2 -0
- package/dist/cases/chart.md +2 -0
- package/dist/cases/check-your-email.md +2 -0
- package/dist/cases/code-sample.md +2 -0
- package/dist/cases/collapsible-search.md +2 -0
- package/dist/cases/comment-thread.md +2 -0
- package/dist/cases/comparison-page/table.d.ts +1 -0
- package/dist/cases/comparison-page/table.jsx +97 -0
- package/dist/cases/comparison-page.md +156 -0
- package/dist/cases/composer-limit.md +2 -0
- package/dist/cases/confirm-destructive-action.md +2 -0
- package/dist/cases/confirm-dialogs.md +2 -0
- package/dist/cases/connection-status/card.d.ts +1 -0
- package/dist/cases/connection-status/card.jsx +97 -0
- package/dist/cases/connection-status/row.d.ts +1 -0
- package/dist/cases/connection-status/row.jsx +120 -0
- package/dist/cases/connection-status.md +330 -0
- package/dist/cases/contact-page.md +2 -0
- package/dist/cases/conversation-starters.md +2 -0
- package/dist/cases/cookie-choice.md +2 -0
- package/dist/cases/create-modal.md +2 -0
- package/dist/cases/danger-zone.md +2 -0
- package/dist/cases/dashboard.md +2 -0
- package/dist/cases/data-table-page.md +2 -0
- package/dist/cases/date-field.md +2 -0
- package/dist/cases/device-login.md +2 -0
- package/dist/cases/docs-component-page.md +2 -0
- package/dist/cases/email-confirmed.md +2 -0
- package/dist/cases/empty-list.md +2 -0
- package/dist/cases/empty-lists.md +2 -0
- package/dist/cases/empty-not-set-up.md +2 -0
- package/dist/cases/empty-search.md +2 -0
- package/dist/cases/error-page.md +2 -0
- package/dist/cases/faq.md +2 -0
- package/dist/cases/feature-grid.md +2 -0
- package/dist/cases/feedback-form.md +2 -0
- package/dist/cases/file-upload.md +2 -0
- package/dist/cases/filter-menu.md +2 -0
- package/dist/cases/forgot-password.md +2 -0
- package/dist/cases/form-errors.md +2 -0
- package/dist/cases/image-viewer.md +2 -0
- package/dist/cases/import-checklist.md +2 -0
- package/dist/cases/inline-form-feedback.md +2 -0
- package/dist/cases/integrations-list/nested.jsx +1 -1
- package/dist/cases/integrations-list/rows.jsx +1 -1
- package/dist/cases/integrations-list.md +6 -4
- package/dist/cases/invite-member.md +2 -0
- package/dist/cases/invoice-list.md +2 -0
- package/dist/cases/landing-hero.md +2 -0
- package/dist/cases/leaderboard.md +2 -0
- package/dist/cases/legal-page.md +2 -0
- package/dist/cases/load-failure.md +2 -0
- package/dist/cases/log-out-confirm.md +2 -0
- package/dist/cases/login-page.md +2 -0
- package/dist/cases/long-form-page.md +2 -0
- package/dist/cases/master-detail.md +2 -0
- package/dist/cases/members-list.md +2 -0
- package/dist/cases/mention-list.md +2 -0
- package/dist/cases/message-actions.md +2 -0
- package/dist/cases/message-attachments.md +2 -0
- package/dist/cases/message-composer/with-tools.jsx +17 -7
- package/dist/cases/message-composer.md +28 -11
- package/dist/cases/message-edit.md +2 -0
- package/dist/cases/message-reactions.md +2 -0
- package/dist/cases/message-row.md +2 -0
- package/dist/cases/message-send-failure/needs-a-person.d.ts +1 -0
- package/dist/cases/message-send-failure/needs-a-person.jsx +116 -0
- package/dist/cases/message-send-failure/retrying.d.ts +1 -0
- package/dist/cases/message-send-failure/retrying.jsx +116 -0
- package/dist/cases/message-send-failure.md +308 -0
- package/dist/cases/mobile-menu.md +2 -0
- package/dist/cases/newsletter-signup.md +2 -0
- package/dist/cases/no-access/page.d.ts +1 -0
- package/dist/cases/no-access/page.jsx +37 -0
- package/dist/cases/no-access/read-only.d.ts +1 -0
- package/dist/cases/no-access/read-only.jsx +33 -0
- package/dist/cases/no-access.md +147 -0
- package/dist/cases/not-found-page.md +2 -0
- package/dist/cases/notification-menu.md +2 -0
- package/dist/cases/number-format.md +2 -0
- package/dist/cases/oauth-consent.md +2 -0
- package/dist/cases/on-off-settings.md +2 -0
- package/dist/cases/on-this-page.md +2 -0
- package/dist/cases/onboarding.md +2 -0
- package/dist/cases/one-main-action.md +2 -0
- package/dist/cases/overflow-menu.md +2 -0
- package/dist/cases/page-end.md +2 -0
- package/dist/cases/page-header.md +2 -0
- package/dist/cases/paged-card.md +2 -0
- package/dist/cases/password-gate.md +2 -0
- package/dist/cases/payment-method.md +2 -0
- package/dist/cases/people-row.md +2 -0
- package/dist/cases/phone-navigation.md +2 -0
- package/dist/cases/plan-change-confirm.md +2 -0
- package/dist/cases/plan-comparison.md +3 -1
- package/dist/cases/plan-picker.md +4 -1
- package/dist/cases/plan-sign-off.md +2 -0
- package/dist/cases/pricing-section.md +5 -1
- package/dist/cases/product-cards.md +2 -0
- package/dist/cases/product-demo/scripted.d.ts +1 -0
- package/dist/cases/product-demo/scripted.jsx +99 -0
- package/dist/cases/product-demo/still.d.ts +1 -0
- package/dist/cases/product-demo/still.jsx +20 -0
- package/dist/cases/product-demo.md +226 -0
- package/dist/cases/profile-form.md +2 -0
- package/dist/cases/quick-switcher.md +2 -0
- package/dist/cases/range-switch.md +2 -0
- package/dist/cases/rename.md +2 -0
- package/dist/cases/reply-feedback.md +2 -0
- package/dist/cases/reply-sources.md +2 -0
- package/dist/cases/route-loading.md +2 -0
- package/dist/cases/scope-picker.md +2 -0
- package/dist/cases/section-index.md +2 -0
- package/dist/cases/session-expired/in-place.d.ts +1 -0
- package/dist/cases/session-expired/in-place.jsx +63 -0
- package/dist/cases/session-expired/redirect.d.ts +1 -0
- package/dist/cases/session-expired/redirect.jsx +62 -0
- package/dist/cases/session-expired.md +204 -0
- package/dist/cases/set-new-password.md +2 -0
- package/dist/cases/settings-page.md +2 -0
- package/dist/cases/settings-save.md +2 -0
- package/dist/cases/side-pane.md +2 -0
- package/dist/cases/sidebar-nav.md +2 -0
- package/dist/cases/sign-up-page.md +3 -0
- package/dist/cases/signup-from-site/plain.d.ts +1 -0
- package/dist/cases/signup-from-site/plain.jsx +125 -0
- package/dist/cases/signup-from-site/with-plan.d.ts +4 -0
- package/dist/cases/signup-from-site/with-plan.jsx +151 -0
- package/dist/cases/signup-from-site.md +351 -0
- package/dist/cases/site-footer.md +2 -0
- package/dist/cases/site-header/links.d.ts +3 -1
- package/dist/cases/site-header/links.jsx +6 -2
- package/dist/cases/site-header.md +11 -3
- package/dist/cases/site-matches-app.md +32 -0
- package/dist/cases/site-search.md +2 -0
- package/dist/cases/slash-command-list.md +2 -0
- package/dist/cases/stat-row.md +2 -0
- package/dist/cases/status-label.md +3 -1
- package/dist/cases/success-feedback.md +2 -0
- package/dist/cases/tabbed-panels.md +2 -0
- package/dist/cases/tag-filter.md +2 -0
- package/dist/cases/task-header.md +2 -0
- package/dist/cases/theme-switcher.md +2 -0
- package/dist/cases/type-to-confirm.md +2 -0
- package/dist/cases/typing-and-status.md +2 -0
- package/dist/cases/unsaved-changes-guard.md +2 -0
- package/dist/cases/upgrade-prompt.md +2 -0
- package/dist/cases/usage-meters.md +2 -0
- package/dist/cases.json +1492 -39
- package/dist/components/checkBox.d.ts +7 -2
- package/dist/components/checkBox.jsx +39 -14
- package/dist/components/diff.d.ts +32 -0
- package/dist/components/diff.jsx +42 -0
- package/dist/components/segmentedControl.d.ts +3 -1
- package/dist/components/segmentedControl.jsx +8 -6
- package/dist/components/slidingIndicator.d.ts +5 -2
- package/dist/components/slidingIndicator.jsx +9 -3
- package/dist/components/tableContainer.d.ts +1 -1
- package/dist/components/tableContainer.jsx +2 -2
- package/dist/components/timeStamp.d.ts +3 -1
- package/dist/components/timeStamp.jsx +4 -2
- package/dist/components/useReducedMotion.d.ts +6 -0
- package/dist/components/useReducedMotion.js +19 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -0
- package/dist/internal/diff.d.ts +17 -0
- package/dist/internal/diff.js +44 -0
- package/dist/native-mapping.json +9 -2
- package/dist/stories/AgentPermissions.probe.stories.d.ts +7 -0
- package/dist/stories/AgentPermissions.probe.stories.jsx +18 -0
- package/dist/stories/AgentRunFailure.probe.stories.d.ts +6 -0
- package/dist/stories/AgentRunFailure.probe.stories.jsx +12 -0
- package/dist/stories/Cases.generated.stories.d.ts +24 -0
- package/dist/stories/Cases.generated.stories.jsx +48 -0
- package/dist/stories/Checkbox.stories.d.ts +3 -0
- package/dist/stories/Checkbox.stories.jsx +38 -0
- package/dist/stories/Diff.stories.d.ts +10 -0
- package/dist/stories/Diff.stories.jsx +45 -0
- package/dist/stories/SegmentedControl.stories.d.ts +1 -0
- package/dist/stories/SegmentedControl.stories.jsx +6 -0
- package/dist/stories/SignupFromSite.probe.stories.d.ts +7 -0
- package/dist/stories/SignupFromSite.probe.stories.jsx +17 -0
- package/dist/stories/SiteHeader.probe.stories.d.ts +6 -0
- package/dist/stories/SiteHeader.probe.stories.jsx +13 -0
- package/dist/stories/Table.stories.d.ts +1 -0
- package/dist/stories/Table.stories.jsx +25 -0
- package/dist/stories/TimeStamp.stories.d.ts +1 -0
- package/dist/stories/TimeStamp.stories.jsx +13 -0
- package/package.json +5 -1
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
# Message that did not send
|
|
2
|
+
|
|
3
|
+
A person sent a message and it did not reach the people it was for, because the app is offline or because something needs fixing first.
|
|
4
|
+
|
|
5
|
+
For: an app, an agent
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Keep the message in the thread as a `Message`, where the person wrote it, with a line in its `footer` that says it did not send.
|
|
10
|
+
- Write 'Not sent yet. Trying again.' when the app will send it by itself, with 'Send Now' and 'Discard'.
|
|
11
|
+
- Say why it did not send and what fixes it when it needs the person: 'Not sent. Reconnect Figma, then send again.' Link the fix to the place that does it, with 'Try Again' and 'Discard'.
|
|
12
|
+
- Make the line's Buttons `size="small"`, with an `aria-label` that names the message: 'Send now: Can you check the plan table on…'.
|
|
13
|
+
- Show a warning `Alert` above the `Composer` while the app is offline: 'You are offline. Messages send when you are back.' Give it no close button and `autoDismiss={false}`.
|
|
14
|
+
- Keep the `Composer` working. The person can type and send more, and each new message waits in the thread too.
|
|
15
|
+
- Show 'Send Now' and 'Try Again' as `loading` while they send, and keep their labels.
|
|
16
|
+
- Move focus to the `Composer` when the message sends or is discarded, because the line and its Buttons are gone.
|
|
17
|
+
- Send focus to the `Composer` after 'Discard', not to the next row as the case 'Message actions' does after a delete. A failed message is usually the last one.
|
|
18
|
+
- Say in a polite status line, once, when waiting messages have sent: 'Back online. 2 messages sent.'
|
|
19
|
+
|
|
20
|
+
## Don't
|
|
21
|
+
|
|
22
|
+
- Do not fade the text as the only sign that it did not send. Say it in words under the message.
|
|
23
|
+
- Do not show a toast for a failure that stays. The line stays with the message until it sends or is discarded.
|
|
24
|
+
- Do not lose the text. It stays in the thread until it sends or the person discards it.
|
|
25
|
+
- Do not show the error's own message, such as 'Request failed with status 401'.
|
|
26
|
+
- Do not block the Composer while one message waits.
|
|
27
|
+
|
|
28
|
+
## Option: Sends again by itself
|
|
29
|
+
|
|
30
|
+
Use when: The app can send it again without help, such as when it is offline.
|
|
31
|
+
|
|
32
|
+
Uses: `Alert`, `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
'use client';
|
|
36
|
+
import { useEffect, useRef, useState } from 'react';
|
|
37
|
+
import Message from 'oneslash-design-system/components/message';
|
|
38
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
39
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
40
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
41
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
42
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
43
|
+
import Button from 'oneslash-design-system/components/button';
|
|
44
|
+
import Composer from 'oneslash-design-system/components/composer';
|
|
45
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
46
|
+
|
|
47
|
+
// A real app reads this from the session.
|
|
48
|
+
const me = 'Dana Lee';
|
|
49
|
+
|
|
50
|
+
type Row = { id: string; from: string; at: Date; text: string; state: 'sent' | 'waiting' | 'sending' };
|
|
51
|
+
|
|
52
|
+
// Opens offline, with Dana's last message waiting to go.
|
|
53
|
+
const firstThread: Row[] = [
|
|
54
|
+
{ id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T14:31:00'), text: 'The pricing page is ready for a last look.', state: 'sent' },
|
|
55
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I fixed the plan table on phones.', state: 'sent' },
|
|
56
|
+
{ id: 'm3', from: me, at: new Date('2026-11-16T14:40:00'), text: 'Can you check the plan table on a phone before 4:00 PM?', state: 'waiting' },
|
|
57
|
+
];
|
|
58
|
+
|
|
59
|
+
// Names a message by its first words, for the Buttons under it.
|
|
60
|
+
const firstWords = (text: string) => (text.length > 32 ? `${text.slice(0, 32).trimEnd()}…` : text);
|
|
61
|
+
|
|
62
|
+
export default function MessageSendFailureRetrying() {
|
|
63
|
+
const [thread, setThread] = useState(firstThread);
|
|
64
|
+
const [online, setOnline] = useState(false);
|
|
65
|
+
const [text, setText] = useState('');
|
|
66
|
+
// Said once, in the polite status line, when the waiting messages have gone.
|
|
67
|
+
const [status, setStatus] = useState('');
|
|
68
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
69
|
+
const composer = useRef<HTMLTextAreaElement>(null);
|
|
70
|
+
// Each new message gets its own id, so no two rows share one after a discard.
|
|
71
|
+
const nextId = useRef(firstThread.length + 1);
|
|
72
|
+
// The thread as last drawn, for the request that ends later.
|
|
73
|
+
const latest = useRef(thread);
|
|
74
|
+
latest.current = thread;
|
|
75
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
76
|
+
const focusNext = useRef<() => void>();
|
|
77
|
+
|
|
78
|
+
// Stops the request if the example goes away before it ends.
|
|
79
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
80
|
+
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const move = focusNext.current;
|
|
83
|
+
focusNext.current = undefined;
|
|
84
|
+
move?.();
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
// The Composer keeps working while a message waits. Offline, a new message waits in the thread too.
|
|
88
|
+
function send() {
|
|
89
|
+
const id = `m${nextId.current++}`;
|
|
90
|
+
setThread((rows) => [...rows, { id, from: me, at: new Date(), text: text.trim(), state: online ? 'sent' : 'waiting' }]);
|
|
91
|
+
setText('');
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
// Sends at once. Here the connection is back, so every waiting message goes with it.
|
|
95
|
+
function sendNow(id: string) {
|
|
96
|
+
if (thread.some((m) => m.state === 'sending')) return;
|
|
97
|
+
setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sending' } : m)));
|
|
98
|
+
// Stands in for the request to the server.
|
|
99
|
+
timer.current = setTimeout(() => {
|
|
100
|
+
const waiting = latest.current.filter((m) => m.state !== 'sent').length;
|
|
101
|
+
setThread((rows) => rows.map((m) => ({ ...m, state: 'sent' })));
|
|
102
|
+
setOnline(true);
|
|
103
|
+
setStatus(`Back online. ${waiting} ${waiting === 1 ? 'message' : 'messages'} sent.`);
|
|
104
|
+
// The line and its Buttons are gone, so focus goes to the message box.
|
|
105
|
+
focusNext.current = () => composer.current?.focus();
|
|
106
|
+
}, 1200);
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
// Takes the message out of the thread. It was never sent, so no one else saw it.
|
|
110
|
+
function discard(id: string) {
|
|
111
|
+
setThread((rows) => rows.filter((m) => m.id !== id));
|
|
112
|
+
focusNext.current = () => composer.current?.focus();
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
return (
|
|
116
|
+
<Center width="page">
|
|
117
|
+
<Stack gap="large">
|
|
118
|
+
<Heading level={1} size="h5">Launch plan</Heading>
|
|
119
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
120
|
+
<Stack gap="small">
|
|
121
|
+
{thread.map((m) => {
|
|
122
|
+
const notSent = m.state !== 'sent';
|
|
123
|
+
return (
|
|
124
|
+
<Message
|
|
125
|
+
key={m.id}
|
|
126
|
+
aria-label={notSent ? `${m.from}, not sent yet` : m.from}
|
|
127
|
+
avatar={<UserImage userHandle={m.from} decorative />}
|
|
128
|
+
name={m.from}
|
|
129
|
+
meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
|
|
130
|
+
footer={
|
|
131
|
+
notSent ? (
|
|
132
|
+
<Stack gap="small">
|
|
133
|
+
<Paragraph size="body2" tone="secondary" measure="none">Not sent yet. Trying again.</Paragraph>
|
|
134
|
+
<Cluster gap="small">
|
|
135
|
+
<Button size="small" type="secondary" state="enabled" label="Send Now" aria-label={`Send now: ${firstWords(m.text)}`} loading={m.state === 'sending'} onClickButton={() => sendNow(m.id)} />
|
|
136
|
+
<Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={`Discard: ${firstWords(m.text)}`} onClickButton={() => discard(m.id)} />
|
|
137
|
+
</Cluster>
|
|
138
|
+
</Stack>
|
|
139
|
+
) : undefined
|
|
140
|
+
}
|
|
141
|
+
>
|
|
142
|
+
<Paragraph measure="none">{m.text}</Paragraph>
|
|
143
|
+
</Message>
|
|
144
|
+
);
|
|
145
|
+
})}
|
|
146
|
+
</Stack>
|
|
147
|
+
<Stack gap="small">
|
|
148
|
+
{!online && <Alert type="warning" variant="inline" message="You are offline. Messages send when you are back." autoDismiss={false} />}
|
|
149
|
+
{/* On the page from the start, so it is heard once when the messages go. */}
|
|
150
|
+
<Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
|
|
151
|
+
<Composer
|
|
152
|
+
ref={composer}
|
|
153
|
+
id="message-send-failure-retrying-message"
|
|
154
|
+
aria-label="Message"
|
|
155
|
+
placeholder="Message the team"
|
|
156
|
+
value={text}
|
|
157
|
+
onChange={setText}
|
|
158
|
+
onSubmit={send}
|
|
159
|
+
/>
|
|
160
|
+
</Stack>
|
|
161
|
+
</Stack>
|
|
162
|
+
</Center>
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
## Option: Waits for a fix
|
|
168
|
+
|
|
169
|
+
Use when: Sending cannot work until the person does something, such as reconnect an account.
|
|
170
|
+
|
|
171
|
+
Uses: `Button`, `Center`, `Cluster`, `Composer`, `Heading`, `Link`, `Message`, `Paragraph`, `Stack`, `TimeStamp`, `UserImage`
|
|
172
|
+
|
|
173
|
+
```tsx
|
|
174
|
+
'use client';
|
|
175
|
+
import { useEffect, useRef, useState } from 'react';
|
|
176
|
+
import Message from 'oneslash-design-system/components/message';
|
|
177
|
+
import UserImage from 'oneslash-design-system/components/userImage';
|
|
178
|
+
import TimeStamp from 'oneslash-design-system/components/timeStamp';
|
|
179
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
180
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
181
|
+
import Link from 'oneslash-design-system/components/link';
|
|
182
|
+
import Button from 'oneslash-design-system/components/button';
|
|
183
|
+
import Composer from 'oneslash-design-system/components/composer';
|
|
184
|
+
import { Center, Cluster, Stack } from 'oneslash-design-system/components/layout';
|
|
185
|
+
|
|
186
|
+
// A real app reads this from the session.
|
|
187
|
+
const me = 'Dana Lee';
|
|
188
|
+
|
|
189
|
+
type Row = { id: string; from: string; at: Date; text: string; state: 'sent' | 'failed' | 'sending' };
|
|
190
|
+
|
|
191
|
+
// This thread is shared with a Figma file. Dana's access to Figma ran out, so her last reply did not send.
|
|
192
|
+
const firstThread: Row[] = [
|
|
193
|
+
{ id: 'm1', from: 'Ben Carter', at: new Date('2026-11-16T14:31:00'), text: 'The hero image is too dark on phones.', state: 'sent' },
|
|
194
|
+
{ id: 'm2', from: 'Omar Reyes', at: new Date('2026-11-16T14:35:00'), text: 'I can try a lighter one this afternoon.', state: 'sent' },
|
|
195
|
+
{ id: 'm3', from: me, at: new Date('2026-11-16T14:40:00'), text: 'Yes, try the lighter one and we check it on Monday.', state: 'failed' },
|
|
196
|
+
];
|
|
197
|
+
|
|
198
|
+
// Names a message by its first words, for the Buttons under it.
|
|
199
|
+
const firstWords = (text: string) => (text.length > 32 ? `${text.slice(0, 32).trimEnd()}…` : text);
|
|
200
|
+
|
|
201
|
+
export default function MessageSendFailureNeedsAPerson() {
|
|
202
|
+
const [thread, setThread] = useState(firstThread);
|
|
203
|
+
const [connected, setConnected] = useState(false);
|
|
204
|
+
const [text, setText] = useState('');
|
|
205
|
+
// Said once, in the polite status line, when a message has gone.
|
|
206
|
+
const [status, setStatus] = useState('');
|
|
207
|
+
const timer = useRef<ReturnType<typeof setTimeout>>();
|
|
208
|
+
const composer = useRef<HTMLTextAreaElement>(null);
|
|
209
|
+
// Each new message gets its own id, so no two rows share one after a discard.
|
|
210
|
+
const nextId = useRef(firstThread.length + 1);
|
|
211
|
+
// Where focus goes after the next render, once the element it goes to is on screen.
|
|
212
|
+
const focusNext = useRef<() => void>();
|
|
213
|
+
|
|
214
|
+
// Stops the request if the example goes away before it ends.
|
|
215
|
+
useEffect(() => () => clearTimeout(timer.current), []);
|
|
216
|
+
|
|
217
|
+
useEffect(() => {
|
|
218
|
+
const move = focusNext.current;
|
|
219
|
+
focusNext.current = undefined;
|
|
220
|
+
move?.();
|
|
221
|
+
});
|
|
222
|
+
|
|
223
|
+
// The Composer keeps working. Until Figma is reconnected, a new reply cannot send either, and says so.
|
|
224
|
+
function send() {
|
|
225
|
+
const id = `m${nextId.current++}`;
|
|
226
|
+
setThread((rows) => [...rows, { id, from: me, at: new Date(), text: text.trim(), state: connected ? 'sent' : 'failed' }]);
|
|
227
|
+
setText('');
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
// Stands in for a person who reconnected Figma first, so it sends.
|
|
231
|
+
function tryAgain(id: string) {
|
|
232
|
+
if (thread.some((m) => m.state === 'sending')) return;
|
|
233
|
+
setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sending' } : m)));
|
|
234
|
+
timer.current = setTimeout(() => {
|
|
235
|
+
setThread((rows) => rows.map((m) => (m.id === id ? { ...m, state: 'sent' } : m)));
|
|
236
|
+
setConnected(true);
|
|
237
|
+
setStatus('Message sent.');
|
|
238
|
+
// The line and its Buttons are gone, so focus goes to the message box.
|
|
239
|
+
focusNext.current = () => composer.current?.focus();
|
|
240
|
+
}, 1200);
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Takes the message out of the thread. It was never sent, so no one else saw it.
|
|
244
|
+
function discard(id: string) {
|
|
245
|
+
setThread((rows) => rows.filter((m) => m.id !== id));
|
|
246
|
+
focusNext.current = () => composer.current?.focus();
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
return (
|
|
250
|
+
<Center width="page">
|
|
251
|
+
<Stack gap="large">
|
|
252
|
+
<Stack gap="small">
|
|
253
|
+
<Heading level={1} size="h5">Homepage hero</Heading>
|
|
254
|
+
<Paragraph tone="secondary" size="body2" measure="none">Replies here also go to the comments on the Figma file.</Paragraph>
|
|
255
|
+
</Stack>
|
|
256
|
+
{/* A real app gives the list that holds the rows role="log". */}
|
|
257
|
+
<Stack gap="small">
|
|
258
|
+
{thread.map((m) => {
|
|
259
|
+
const notSent = m.state !== 'sent';
|
|
260
|
+
return (
|
|
261
|
+
<Message
|
|
262
|
+
key={m.id}
|
|
263
|
+
aria-label={notSent ? `${m.from}, not sent` : m.from}
|
|
264
|
+
avatar={<UserImage userHandle={m.from} decorative />}
|
|
265
|
+
name={m.from}
|
|
266
|
+
meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time" />}
|
|
267
|
+
footer={
|
|
268
|
+
notSent ? (
|
|
269
|
+
<Stack gap="small">
|
|
270
|
+
{/* The reason and its fix. The link goes where the fix is done. */}
|
|
271
|
+
<Paragraph size="body2" tone="secondary" measure="none">
|
|
272
|
+
Not sent. <Link href="/settings/integrations" size="body2">Reconnect Figma</Link>, then send again.
|
|
273
|
+
</Paragraph>
|
|
274
|
+
<Cluster gap="small">
|
|
275
|
+
<Button size="small" type="secondary" state="enabled" label="Try Again" aria-label={`Try again: ${firstWords(m.text)}`} loading={m.state === 'sending'} onClickButton={() => tryAgain(m.id)} />
|
|
276
|
+
<Button size="small" type="tertiary" state={m.state === 'sending' ? 'disabled' : 'enabled'} label="Discard" aria-label={`Discard: ${firstWords(m.text)}`} onClickButton={() => discard(m.id)} />
|
|
277
|
+
</Cluster>
|
|
278
|
+
</Stack>
|
|
279
|
+
) : undefined
|
|
280
|
+
}
|
|
281
|
+
>
|
|
282
|
+
<Paragraph measure="none">{m.text}</Paragraph>
|
|
283
|
+
</Message>
|
|
284
|
+
);
|
|
285
|
+
})}
|
|
286
|
+
</Stack>
|
|
287
|
+
<Stack gap="small">
|
|
288
|
+
{/* On the page from the start, so it is heard once when the message goes. */}
|
|
289
|
+
<Paragraph role="status" size="body2" tone="secondary" measure="none">{status}</Paragraph>
|
|
290
|
+
<Composer
|
|
291
|
+
ref={composer}
|
|
292
|
+
id="message-send-failure-needs-a-person-message"
|
|
293
|
+
aria-label="Message"
|
|
294
|
+
placeholder="Message the team"
|
|
295
|
+
value={text}
|
|
296
|
+
onChange={setText}
|
|
297
|
+
onSubmit={send}
|
|
298
|
+
/>
|
|
299
|
+
</Stack>
|
|
300
|
+
</Stack>
|
|
301
|
+
</Center>
|
|
302
|
+
);
|
|
303
|
+
}
|
|
304
|
+
```
|
|
305
|
+
|
|
306
|
+
## Native
|
|
307
|
+
|
|
308
|
+
On Apple show the line under the message in a footnote style, with 'Send Now' and 'Discard' as Buttons and a banner above the text field while offline. On Android use the same line under the message, and a `Snackbar` only for a failure that clears itself.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A site's links and actions do not fit in the bar on a phone, and the person still needs to reach every one.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Follow the rule 'On a phone, a sidebar opens as a drawer and a list opens its detail'. The menu is a `Drawer` from the start side.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NoAccessPage(): import("react").JSX.Element;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import AppShell from '../../components/appShell';
|
|
4
|
+
import Navigation from '../../components/navigation';
|
|
5
|
+
import MenuItem from '../../components/menuItem';
|
|
6
|
+
import TitleBar from '../../components/titleBar';
|
|
7
|
+
import Surface from '../../components/surface';
|
|
8
|
+
import EmptyBox from '../../components/emptyBox';
|
|
9
|
+
import Paragraph from '../../components/paragraph';
|
|
10
|
+
import Button from '../../components/button';
|
|
11
|
+
import { Stack } from '../../components/layout';
|
|
12
|
+
// The places a member can open. Billing is for admins, so it is not in the list:
|
|
13
|
+
// the person reached it by a link, and the page says why they cannot see it.
|
|
14
|
+
var places = [
|
|
15
|
+
{ label: 'Home', icon: 'House', href: '/' },
|
|
16
|
+
{ label: 'Invoices', icon: 'FileText', href: '/invoices' },
|
|
17
|
+
{ label: 'Settings', icon: 'Settings', href: '/settings' },
|
|
18
|
+
];
|
|
19
|
+
var sidebar = (<Navigation aria-label="Main">
|
|
20
|
+
<Paragraph size="body1" measure="none">Acme</Paragraph>
|
|
21
|
+
{places.map(function (p) { return (<MenuItem key={p.href} size="small" label={p.label} iconName={p.icon} href={p.href} isSelected={false}
|
|
22
|
+
// A real app lets the link go to its page.
|
|
23
|
+
onClick={function (event) { return event.preventDefault(); }}/>); })}
|
|
24
|
+
</Navigation>);
|
|
25
|
+
export default function NoAccessPage() {
|
|
26
|
+
// Below md the sidebar is a Drawer; this says whether it is open.
|
|
27
|
+
var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
|
|
28
|
+
return (<AppShell title="Billing" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
|
|
29
|
+
<Stack gap="large">
|
|
30
|
+
{/* The page exists, so it keeps its name. It is not a 404. */}
|
|
31
|
+
<TitleBar title="Billing"/>
|
|
32
|
+
<Surface minHeight="tall" align="center">
|
|
33
|
+
<EmptyBox size="large" icon="Lock" text="You do not have access to Billing" secondText="Ask an admin: Dana Lee" action={<Button size="medium" type="secondary" state="enabled" label="Go Home" href="/"/>}/>
|
|
34
|
+
</Surface>
|
|
35
|
+
</Stack>
|
|
36
|
+
</AppShell>);
|
|
37
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export default function NoAccessReadOnly(): import("react").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import Heading from '../../components/heading';
|
|
3
|
+
import Alert from '../../components/alert';
|
|
4
|
+
import SettingsSection from '../../components/settingsSection';
|
|
5
|
+
import TextField from '../../components/textField';
|
|
6
|
+
import { Center, Stack } from '../../components/layout';
|
|
7
|
+
// A real app reads these from the server. Ben Carter is a member, so he can read them and not change them.
|
|
8
|
+
var general = [
|
|
9
|
+
{ id: 'no-access-name', label: 'Workspace name', value: 'Acme' },
|
|
10
|
+
{ id: 'no-access-email', label: 'Billing email', value: 'billing@acme.example' },
|
|
11
|
+
{ id: 'no-access-time-zone', label: 'Time zone', value: 'Central Time (US and Canada)' },
|
|
12
|
+
];
|
|
13
|
+
var members = [
|
|
14
|
+
{ id: 'no-access-invite', label: 'Who can invite members', value: 'Admins only' },
|
|
15
|
+
{ id: 'no-access-domain', label: 'Email domain for new members', value: 'acme.example' },
|
|
16
|
+
];
|
|
17
|
+
// A read-only field changes nothing.
|
|
18
|
+
var unchanged = function () { };
|
|
19
|
+
export default function NoAccessReadOnly() {
|
|
20
|
+
return (<Center>
|
|
21
|
+
<Stack gap="xlarge">
|
|
22
|
+
<Heading level={1} size="h5">Workspace settings</Heading>
|
|
23
|
+
{/* One line at the top says why nothing can be changed, and who can. No Save Button, no disabled Buttons. */}
|
|
24
|
+
<Alert type="info" variant="inline" message="Only admins can change these settings. Your admin is Dana Lee." autoDismiss={false}/>
|
|
25
|
+
<SettingsSection title="General">
|
|
26
|
+
{general.map(function (f) { return (<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged}/>); })}
|
|
27
|
+
</SettingsSection>
|
|
28
|
+
<SettingsSection title="Members">
|
|
29
|
+
{members.map(function (f) { return (<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged}/>); })}
|
|
30
|
+
</SettingsSection>
|
|
31
|
+
</Stack>
|
|
32
|
+
</Center>);
|
|
33
|
+
}
|
|
@@ -0,0 +1,147 @@
|
|
|
1
|
+
# No access
|
|
2
|
+
|
|
3
|
+
A person reaches a page or a setting that their role does not let them see or change, often by a link someone sent.
|
|
4
|
+
|
|
5
|
+
For: an app
|
|
6
|
+
|
|
7
|
+
## Do
|
|
8
|
+
|
|
9
|
+
- Keep the shell and the navigation, as the case 'Error page' does inside the shell. Name the page in the `TitleBar`, so the person knows the link was right.
|
|
10
|
+
- Show an `EmptyBox` in the page's place that names what they cannot see: 'You do not have access to Billing'.
|
|
11
|
+
- Say who can give access, by name: 'Ask an admin: Dana Lee'.
|
|
12
|
+
- Offer one way out, 'Go Home', as the `EmptyBox` action.
|
|
13
|
+
- Show one info `Alert` at the top of a settings page the person can only read: 'Only admins can change these settings. Your admin is Dana Lee.' Give it no close button and `autoDismiss={false}`.
|
|
14
|
+
- Show the fields with `readOnly`, so the person can still read, select and copy the values.
|
|
15
|
+
- Show a choice that has no read-only state, such as a `RadioGroup`, disabled, under the line that says who can change it.
|
|
16
|
+
- Leave out the Save Button and every Button that would change a setting.
|
|
17
|
+
|
|
18
|
+
## Don't
|
|
19
|
+
|
|
20
|
+
- Do not show a 404 for a page that exists. Say it is there and who can open it.
|
|
21
|
+
- Do not hide a navigation item and leave the page blank when a person followed a link to it. Say why they cannot see it.
|
|
22
|
+
- Do not show disabled Buttons with no reason. Leave them out, and say once at the top who can change things.
|
|
23
|
+
- Do not use `disabled` fields for a page the person can read. Disabled text is faint and cannot be focused.
|
|
24
|
+
- Do not say 'Contact your admin' on a page the person cannot change without saying who that is.
|
|
25
|
+
|
|
26
|
+
## Option: Page they cannot see
|
|
27
|
+
|
|
28
|
+
Use when: The person opened a page their role cannot see.
|
|
29
|
+
|
|
30
|
+
Uses: `AppShell`, `Button`, `EmptyBox`, `MenuItem`, `Navigation`, `Paragraph`, `Stack`, `Surface`, `TitleBar`
|
|
31
|
+
|
|
32
|
+
```tsx
|
|
33
|
+
'use client';
|
|
34
|
+
import { useState } from 'react';
|
|
35
|
+
import AppShell from 'oneslash-design-system/components/appShell';
|
|
36
|
+
import Navigation from 'oneslash-design-system/components/navigation';
|
|
37
|
+
import MenuItem from 'oneslash-design-system/components/menuItem';
|
|
38
|
+
import TitleBar from 'oneslash-design-system/components/titleBar';
|
|
39
|
+
import Surface from 'oneslash-design-system/components/surface';
|
|
40
|
+
import EmptyBox from 'oneslash-design-system/components/emptyBox';
|
|
41
|
+
import Paragraph from 'oneslash-design-system/components/paragraph';
|
|
42
|
+
import Button from 'oneslash-design-system/components/button';
|
|
43
|
+
import { Stack } from 'oneslash-design-system/components/layout';
|
|
44
|
+
|
|
45
|
+
// The places a member can open. Billing is for admins, so it is not in the list:
|
|
46
|
+
// the person reached it by a link, and the page says why they cannot see it.
|
|
47
|
+
const places = [
|
|
48
|
+
{ label: 'Home', icon: 'House', href: '/' },
|
|
49
|
+
{ label: 'Invoices', icon: 'FileText', href: '/invoices' },
|
|
50
|
+
{ label: 'Settings', icon: 'Settings', href: '/settings' },
|
|
51
|
+
];
|
|
52
|
+
|
|
53
|
+
const sidebar = (
|
|
54
|
+
<Navigation aria-label="Main">
|
|
55
|
+
<Paragraph size="body1" measure="none">Acme</Paragraph>
|
|
56
|
+
{places.map((p) => (
|
|
57
|
+
<MenuItem
|
|
58
|
+
key={p.href}
|
|
59
|
+
size="small"
|
|
60
|
+
label={p.label}
|
|
61
|
+
iconName={p.icon}
|
|
62
|
+
href={p.href}
|
|
63
|
+
isSelected={false}
|
|
64
|
+
// A real app lets the link go to its page.
|
|
65
|
+
onClick={(event: { preventDefault: () => void }) => event.preventDefault()}
|
|
66
|
+
/>
|
|
67
|
+
))}
|
|
68
|
+
</Navigation>
|
|
69
|
+
);
|
|
70
|
+
|
|
71
|
+
export default function NoAccessPage() {
|
|
72
|
+
// Below md the sidebar is a Drawer; this says whether it is open.
|
|
73
|
+
const [navOpen, setNavOpen] = useState(false);
|
|
74
|
+
return (
|
|
75
|
+
<AppShell title="Billing" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
|
|
76
|
+
<Stack gap="large">
|
|
77
|
+
{/* The page exists, so it keeps its name. It is not a 404. */}
|
|
78
|
+
<TitleBar title="Billing" />
|
|
79
|
+
<Surface minHeight="tall" align="center">
|
|
80
|
+
<EmptyBox
|
|
81
|
+
size="large"
|
|
82
|
+
icon="Lock"
|
|
83
|
+
text="You do not have access to Billing"
|
|
84
|
+
secondText="Ask an admin: Dana Lee"
|
|
85
|
+
action={<Button size="medium" type="secondary" state="enabled" label="Go Home" href="/" />}
|
|
86
|
+
/>
|
|
87
|
+
</Surface>
|
|
88
|
+
</Stack>
|
|
89
|
+
</AppShell>
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
## Option: Settings they cannot change
|
|
95
|
+
|
|
96
|
+
Use when: The person can see a settings page but cannot change it.
|
|
97
|
+
|
|
98
|
+
Uses: `Alert`, `Center`, `Heading`, `SettingsSection`, `Stack`, `TextField`
|
|
99
|
+
|
|
100
|
+
```tsx
|
|
101
|
+
'use client';
|
|
102
|
+
import Heading from 'oneslash-design-system/components/heading';
|
|
103
|
+
import Alert from 'oneslash-design-system/components/alert';
|
|
104
|
+
import SettingsSection from 'oneslash-design-system/components/settingsSection';
|
|
105
|
+
import TextField from 'oneslash-design-system/components/textField';
|
|
106
|
+
import { Center, Stack } from 'oneslash-design-system/components/layout';
|
|
107
|
+
|
|
108
|
+
// A real app reads these from the server. Ben Carter is a member, so he can read them and not change them.
|
|
109
|
+
const general = [
|
|
110
|
+
{ id: 'no-access-name', label: 'Workspace name', value: 'Acme' },
|
|
111
|
+
{ id: 'no-access-email', label: 'Billing email', value: 'billing@acme.example' },
|
|
112
|
+
{ id: 'no-access-time-zone', label: 'Time zone', value: 'Central Time (US and Canada)' },
|
|
113
|
+
];
|
|
114
|
+
const members = [
|
|
115
|
+
{ id: 'no-access-invite', label: 'Who can invite members', value: 'Admins only' },
|
|
116
|
+
{ id: 'no-access-domain', label: 'Email domain for new members', value: 'acme.example' },
|
|
117
|
+
];
|
|
118
|
+
|
|
119
|
+
// A read-only field changes nothing.
|
|
120
|
+
const unchanged = () => {};
|
|
121
|
+
|
|
122
|
+
export default function NoAccessReadOnly() {
|
|
123
|
+
return (
|
|
124
|
+
<Center>
|
|
125
|
+
<Stack gap="xlarge">
|
|
126
|
+
<Heading level={1} size="h5">Workspace settings</Heading>
|
|
127
|
+
{/* One line at the top says why nothing can be changed, and who can. No Save Button, no disabled Buttons. */}
|
|
128
|
+
<Alert type="info" variant="inline" message="Only admins can change these settings. Your admin is Dana Lee." autoDismiss={false} />
|
|
129
|
+
<SettingsSection title="General">
|
|
130
|
+
{general.map((f) => (
|
|
131
|
+
<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged} />
|
|
132
|
+
))}
|
|
133
|
+
</SettingsSection>
|
|
134
|
+
<SettingsSection title="Members">
|
|
135
|
+
{members.map((f) => (
|
|
136
|
+
<TextField key={f.id} id={f.id} label={f.label} value={f.value} readOnly onChange={unchanged} />
|
|
137
|
+
))}
|
|
138
|
+
</SettingsSection>
|
|
139
|
+
</Stack>
|
|
140
|
+
</Center>
|
|
141
|
+
);
|
|
142
|
+
}
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
## Native
|
|
146
|
+
|
|
147
|
+
On Apple use `ContentUnavailableView` with a lock image, the line on who can give access, and 'Go Home' in its `actions`. For a read-only settings screen, show `LabeledContent` rows in place of controls, with one footer line on who can change them.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A page shows counts, money, sizes, shares or changes.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Answer
|
|
6
8
|
|
|
7
9
|
Use the helpers in `formatNumber` (`formatCount`, `formatMoney`, `formatPercent`, `formatBytes`, `formatDuration`), `StatTile` and `Progress`. A count is whole and grouped: '1,240'. In a tile, a count or an amount from 10,000 up shows its short form: '12.4K', '$12.4K'. A table shows the exact number, right-aligned. On a chart's axis, a number from 10,000 up shows its short form too: '12.4K'. The chart's readout and its table show the exact number. Money has its symbol and its currency's decimals: '$1,240.00', '¥1,240', 'KWD 1,240.000'. A cost under the smallest unit reads '< $0.01'. A share is a whole percent, and a small one reads '< 1%'. A size is base 1024: '52 MB', '1.2 GB'. A time reads '340 ms', '1.2 s', '2 h 24 min'. The unit is in the label or after the number in words: 'Responses', '7 of 8 seats', '340 responses, no limit'. A bare number is never shown, and a unit is never only in a tooltip. A change says its direction, its size and what it compares with: 'Up 12% from last week'. It reads 'New this week' when there was nothing before. A change in a percent is in points: 'Up 3 pts from last week'. A refund in a list of charges has a minus: '-$12.00'. In a sentence, say the word: 'Refunded $12.00'. A change has no color, because more is not good or bad by itself. Unknown is never 0. `formatNumber` shows '–' for a value it cannot read. `StatTile` shows 'No data yet'. While a number loads, a `Skeleton` holds its place. On a failure, show the case 'Load failure'. A limit is a `Progress`, which says 'Limit reached' in words.
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A person reads a long page and wants to see its sections, jump to one and know which one they are in.
|
|
4
4
|
|
|
5
|
+
For: a marketing site, an app
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Put `OnThisPage` in the `aside` of `PageShell`. It sticks below a `SiteHeader` and shows from `xl`. `PageShell` gives each level 2 and 3 heading with an `id` a scroll margin, so `#sharing` lands below the header.
|
package/dist/cases/onboarding.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A marketing page asks the visitor to do something: sign up, open the app, buy a plan.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Answer
|
|
6
8
|
|
|
7
9
|
A page has one main action. It is a primary `Button` with the same label in the header, the hero, the pricing section and the end of the page: 'Sign Up', or 'Sign Up for Pro' on a plan. A second action is a secondary `Button`, or a `Link` that teaches, such as 'See How It Works'. It is never a second primary. Write the label as the move, in Title Case, with short prepositions lowercase. Do not write 'Get Started Free' in one place and 'Try It' in another. The main action and the second action open in the same tab, unless one goes to a store or starts a download. A link to another site, in a list or a footer, uses `external`, as the case 'Site footer' says.
|
package/dist/cases/page-end.md
CHANGED
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
A page has said what it had to say, and its last block decides what the visitor does next.
|
|
4
4
|
|
|
5
|
+
For: a marketing site
|
|
6
|
+
|
|
5
7
|
## Do
|
|
6
8
|
|
|
7
9
|
- Follow the rule 'A marketing page asks for one main action, in the same words everywhere'. The closing block uses the same labels as the header and the hero.
|