@1agh/maude 2.1.0 → 2.1.2
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/apps/studio/access/request.ts +1 -0
- package/apps/studio/actions/agents.ts +45 -42
- package/apps/studio/actions/defs/app.ts +28 -1
- package/apps/studio/actions/defs/sync.ts +4 -0
- package/apps/studio/actions/verbs.ts +49 -0
- package/apps/studio/actions.manifest.json +162 -20
- package/apps/studio/actions.parity.json +13 -1
- package/apps/studio/ai/create-claim.ts +1 -1
- package/apps/studio/bin/_asset-file.mjs +117 -0
- package/apps/studio/bin/_canvas-file.mjs +146 -0
- package/apps/studio/bin/_curl-local.mjs +7 -4
- package/apps/studio/bin/_footage.mjs +123 -0
- package/apps/studio/bin/_pdf-playwright.mjs +14 -0
- package/apps/studio/bin/_png-playwright.mjs +15 -1
- package/apps/studio/bin/_pw-launch.mjs +98 -0
- package/apps/studio/bin/_retry-save.mjs +49 -0
- package/apps/studio/bin/_sync.mjs +145 -2
- package/apps/studio/bin/asset-rename.sh +12 -0
- package/apps/studio/bin/asset-trash.sh +12 -0
- package/apps/studio/bin/canvas-move.sh +12 -0
- package/apps/studio/bin/canvas-new.sh +12 -0
- package/apps/studio/bin/footage.sh +12 -0
- package/apps/studio/bin/generate.sh +7 -0
- package/apps/studio/bin/retry-save.sh +13 -0
- package/apps/studio/bridge/canvas-mode-store.ts +11 -2
- package/apps/studio/bridge/dgn-protocol.ts +8 -3
- package/apps/studio/bridge/occlusion.ts +45 -0
- package/apps/studio/canvas-theme-pill.tsx +169 -26
- package/apps/studio/client/app.jsx +16 -4
- package/apps/studio/client/export-center.jsx +32 -3
- package/apps/studio/client/home/HomeAccountBanner.jsx +61 -0
- package/apps/studio/client/home/HomeAccountsChip.jsx +404 -0
- package/apps/studio/client/home/HomeConnection.jsx +112 -0
- package/apps/studio/client/home/ProjectRows.jsx +514 -0
- package/apps/studio/client/home/home-accounts-model.js +234 -76
- package/apps/studio/client/home/home-api.js +10 -2
- package/apps/studio/client/home/home-app.jsx +151 -394
- package/apps/studio/client/home/home-icons.jsx +8 -0
- package/apps/studio/client/home/home-model.js +149 -1
- package/apps/studio/client/home/home-where-model.js +105 -0
- package/apps/studio/client/home/home.css +621 -53
- package/apps/studio/client/home/use-account-fix.js +123 -0
- package/apps/studio/client/hooks/use-palette-and-panels.jsx +3 -1
- package/apps/studio/client/hooks/use-tabs.jsx +11 -4
- package/apps/studio/client/panels/TeamProjects.jsx +137 -134
- package/apps/studio/client/share-link.js +12 -0
- package/apps/studio/client/styles/_index.css +4 -0
- package/apps/studio/client/v2/assets/generate-ask.jsx +3 -1
- package/apps/studio/client/v2/diagnostics/diagnostics-host.jsx +1 -0
- package/apps/studio/client/v2/diagnostics/diagnostics-model.js +32 -2
- package/apps/studio/client/v2/diagnostics/diagnostics-sheet.jsx +35 -8
- package/apps/studio/client/v2/diagnostics/diagnostics.css +34 -0
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details-model.js +94 -3
- package/apps/studio/client/v2/diagnostics/sync-details/sync-details.jsx +187 -4
- package/apps/studio/client/v2/export/done-toast.jsx +2 -5
- package/apps/studio/client/v2/export/export-sheet.jsx +9 -2
- package/apps/studio/client/v2/export/export.css +9 -0
- package/apps/studio/client/v2/export/exports-model.js +16 -3
- package/apps/studio/client/v2/export/file-rows.jsx +81 -5
- package/apps/studio/client/v2/export/native-save.js +33 -0
- package/apps/studio/client/v2/export/sections/print-copy.js +3 -0
- package/apps/studio/client/v2/export/sections/print.jsx +37 -20
- package/apps/studio/client/v2/link-server/LinkServerDialog.jsx +492 -0
- package/apps/studio/client/v2/link-server/LinkServerHost.jsx +42 -0
- package/apps/studio/client/v2/link-server/link-server-api.js +142 -0
- package/apps/studio/client/v2/link-server/link-server-model.js +438 -0
- package/apps/studio/client/v2/link-server/link-server.css +109 -0
- package/apps/studio/client/v2/onboarding/AdvancedSheets.jsx +31 -86
- package/apps/studio/client/v2/onboarding/onboarding-model.js +1 -18
- package/apps/studio/client/v2/search/search-keywords.js +3 -2
- package/apps/studio/client/v2/settings/account.jsx +4 -2
- package/apps/studio/client/v2/settings/advanced-section.jsx +245 -148
- package/apps/studio/client/v2/settings/connection-row.jsx +3 -59
- package/apps/studio/client/v2/settings/connections-section.jsx +118 -425
- package/apps/studio/client/v2/settings/general-section.jsx +138 -43
- package/apps/studio/client/v2/settings/project-sync-settings.jsx +4 -3
- package/apps/studio/client/v2/settings/reset-section.jsx +14 -3
- package/apps/studio/client/v2/settings/settings-card.jsx +142 -0
- package/apps/studio/client/v2/settings/settings-cards.js +220 -0
- package/apps/studio/client/v2/settings/settings-handlers.js +7 -6
- package/apps/studio/client/v2/settings/settings-model.js +91 -31
- package/apps/studio/client/v2/settings/settings-sheet.jsx +25 -6
- package/apps/studio/client/v2/settings/settings.css +374 -64
- package/apps/studio/client/v2/settings/this-project-card.jsx +730 -0
- package/apps/studio/client/v2/settings/this-project-model.js +172 -0
- package/apps/studio/client/v2/settings/use-connections.js +3 -2
- package/apps/studio/client/v2/settings/use-open-card.js +37 -0
- package/apps/studio/client/v2/shell/connection-state.js +197 -0
- package/apps/studio/client/v2/shell/menu-runner.js +7 -2
- package/apps/studio/client/v2/shell/occlusion-insets.js +37 -9
- package/apps/studio/client/v2/shell/project-account-bus.js +36 -0
- package/apps/studio/client/v2/shell/project-account-card.jsx +357 -148
- package/apps/studio/client/v2/shell/project-account-model.js +272 -149
- package/apps/studio/client/v2/shell/project-account-toast.js +66 -0
- package/apps/studio/client/v2/shell/project-account.css +237 -0
- package/apps/studio/client/v2/shell/share-cluster-host.jsx +166 -83
- package/apps/studio/client/v2/shell/shell-parity.js +3 -2
- package/apps/studio/client/v2/shell/shell-parity.json +40 -26
- package/apps/studio/client/v2/shell/use-account.js +2 -0
- package/apps/studio/client/v2/shell/use-occluded-insets.js +13 -3
- package/apps/studio/client/v2/signin/use-signin.js +1 -1
- package/apps/studio/cloud/endpoints.ts +29 -4
- package/apps/studio/collab/room.ts +21 -7
- package/apps/studio/dist/client.bundle.js +886 -886
- package/apps/studio/dist/comment-mount.js +2 -2
- package/apps/studio/dist/styles.css +1 -1
- package/apps/studio/exporters/ghostscript.ts +78 -1
- package/apps/studio/exporters/pdf-fonts.ts +31 -4
- package/apps/studio/generation/jobs.ts +6 -0
- package/apps/studio/home/accounts.ts +30 -11
- package/apps/studio/home/cloud.ts +6 -1
- package/apps/studio/home/hub-health.ts +76 -0
- package/apps/studio/home/routes.ts +9 -3
- package/apps/studio/http.ts +14 -2
- package/apps/studio/migrate/hub.ts +8 -1
- package/apps/studio/routes/agent.ts +6 -2
- package/apps/studio/routes/hub-link-folder.ts +334 -0
- package/apps/studio/routes/hub-signin.ts +78 -1
- package/apps/studio/routes/index.ts +4 -0
- package/apps/studio/routes/project-undo.ts +10 -0
- package/apps/studio/routes/sync.ts +22 -4
- package/apps/studio/server.ts +25 -0
- package/apps/studio/shell/api-key.ts +11 -0
- package/apps/studio/shell/cli-yield.ts +48 -11
- package/apps/studio/sync/accepted-cold-start.ts +144 -8
- package/apps/studio/sync/action-stage.ts +18 -1
- package/apps/studio/sync/ctl-heal.ts +58 -0
- package/apps/studio/sync/file-ledger.ts +38 -4
- package/apps/studio/sync/file-plane.ts +226 -19
- package/apps/studio/sync/held-deletes.ts +86 -5
- package/apps/studio/sync/hub-link.ts +8 -0
- package/apps/studio/sync/index.ts +68 -4
- package/apps/studio/sync/link-consent.ts +22 -75
- package/apps/studio/sync/link-survey.ts +252 -0
- package/apps/studio/sync/local-kernel.ts +16 -1
- package/apps/studio/sync/seed-progress.ts +12 -0
- package/apps/studio/sync/source-recovery.ts +18 -2
- package/apps/studio/sync/status.ts +11 -1
- package/apps/studio/sync/writer-registry.ts +5 -0
- package/apps/studio/whats-new.json +36 -0
- package/cli/commands/design.mjs +74 -16
- package/cli/lib/bash-guard.mjs +23 -4
- package/cli/lib/confine-read.mjs +2 -0
- package/cli/lib/design-help.gen.mjs +15 -2
- package/cli/lib/design-hook.mjs +1 -1
- package/cli/lib/desktop-locate.mjs +36 -8
- package/cli/lib/studio-locate.mjs +8 -2
- package/cli/lib/sub-verbs.mjs +13 -1
- package/package.json +9 -8
- package/apps/studio/client/home/HomeAccounts.jsx +0 -262
- package/apps/studio/client/v2/onboarding/HubSheet.jsx +0 -212
- package/apps/studio/client/v2/shell/account-card-model.js +0 -114
- package/apps/studio/client/v2/shell/account-card.jsx +0 -189
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
// client/home/HomeAccountsChip.jsx — 2.1.2 HB1 (canvas 17, artboards 15, 17, 18): accounts leave Home's
|
|
2
|
+
// main surface. One chip at the top right — "3 accounts", plus a dot and "1 needs sign-in" while a
|
|
3
|
+
// sign-in is missing or stopped working — opens "Accounts on this Mac": one line per account (its
|
|
4
|
+
// e-mail or host, where it is, how many projects, its state only when it isn't fine), the fix on the
|
|
5
|
+
// line that broke (Sign in / Sign in again, `useAccountFix`), Sign out… and GitHub in its "…", the old
|
|
6
|
+
// servers folded at the foot (no answer, no project) with Forget… per server and Forget all, each
|
|
7
|
+
// behind a question, and Add an account…. Forget only removes the saved sign-in (POST
|
|
8
|
+
// /_home/hub/signout), on the person's click — never on its own.
|
|
9
|
+
// Replaces the 2.0.5 face card (HomeAccounts.jsx) and the 2.1.1 accounts row (HomeAccountsRow.jsx).
|
|
10
|
+
|
|
11
|
+
import { useCallback, useEffect, useRef, useState } from 'react';
|
|
12
|
+
|
|
13
|
+
import { AcctFace, StateWord } from './HomeConnection.jsx';
|
|
14
|
+
import { cloudSignOut, hubSignOut, shellInvoke, shellListen } from './home-api.js';
|
|
15
|
+
import { forgetSpec, githubOf, slugOf } from './home-accounts-model.js';
|
|
16
|
+
import { HIcon } from './home-icons.jsx';
|
|
17
|
+
import { CONN_TONE } from './home-where-model.js';
|
|
18
|
+
import { WAITING_WORD } from './use-account-fix.js';
|
|
19
|
+
import { githubSignIn } from '../v2/onboarding/github-home.js';
|
|
20
|
+
|
|
21
|
+
const SIGNOUT_FAILED = 'Couldn’t sign out. Nothing changed — try again.';
|
|
22
|
+
const FORGET_FAILED = 'Couldn’t forget that server. Nothing changed — try again.';
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* @param {{ summary: ReturnType<typeof import('./home-accounts-model.js').homeAccountsSummary>,
|
|
26
|
+
* shell: object|null, native: boolean, open: boolean, onOpen: () => void,
|
|
27
|
+
* onClose: () => void, fixer: { busy: string|null, error: string|null,
|
|
28
|
+
* fix: (card: object) => unknown }, onAddCloud: () => void, onAddTeam: () => void,
|
|
29
|
+
* onChanged?: () => unknown }} props
|
|
30
|
+
*/
|
|
31
|
+
export function HomeAccountsChip({
|
|
32
|
+
summary,
|
|
33
|
+
shell,
|
|
34
|
+
native,
|
|
35
|
+
open,
|
|
36
|
+
onOpen,
|
|
37
|
+
onClose,
|
|
38
|
+
fixer,
|
|
39
|
+
onAddCloud,
|
|
40
|
+
onAddTeam,
|
|
41
|
+
onChanged,
|
|
42
|
+
}) {
|
|
43
|
+
const [menu, setMenu] = useState(null); // the card key whose "…" is open, or 'add'
|
|
44
|
+
const [oldOpen, setOldOpen] = useState(false);
|
|
45
|
+
const [asking, setAsking] = useState(null); // { id, title, body, primary, cancel, run }
|
|
46
|
+
const [busy, setBusy] = useState(false);
|
|
47
|
+
const [error, setError] = useState(null);
|
|
48
|
+
const [ghCode, setGhCode] = useState(null);
|
|
49
|
+
const wrap = useRef(null);
|
|
50
|
+
|
|
51
|
+
const close = useCallback(() => {
|
|
52
|
+
setMenu(null);
|
|
53
|
+
setAsking(null);
|
|
54
|
+
setError(null);
|
|
55
|
+
onClose();
|
|
56
|
+
}, [onClose]);
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!open) return undefined;
|
|
59
|
+
const onKey = (e) => e.key === 'Escape' && close();
|
|
60
|
+
const onDown = (e) => wrap.current && !wrap.current.contains(e.target) && close();
|
|
61
|
+
window.addEventListener('keydown', onKey);
|
|
62
|
+
window.addEventListener('pointerdown', onDown);
|
|
63
|
+
return () => {
|
|
64
|
+
window.removeEventListener('keydown', onKey);
|
|
65
|
+
window.removeEventListener('pointerdown', onDown);
|
|
66
|
+
};
|
|
67
|
+
}, [open, close]);
|
|
68
|
+
// the GitHub device code arrives as a shell message while a sign-in from this list runs
|
|
69
|
+
useEffect(() => {
|
|
70
|
+
if (!open || !native) return undefined;
|
|
71
|
+
let off = () => {};
|
|
72
|
+
shellListen('github://device-code', (p) => setGhCode(p?.user_code ?? null)).then((u) => {
|
|
73
|
+
off = u;
|
|
74
|
+
});
|
|
75
|
+
return () => off();
|
|
76
|
+
}, [open, native]);
|
|
77
|
+
|
|
78
|
+
const { live, old } = summary;
|
|
79
|
+
// GitHub lives in the "…" of each profile's first line
|
|
80
|
+
const firstOf = new Set();
|
|
81
|
+
const seen = new Set();
|
|
82
|
+
for (const c of live)
|
|
83
|
+
if (!seen.has(c.profile)) {
|
|
84
|
+
seen.add(c.profile);
|
|
85
|
+
firstOf.add(c.key);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
const runAsk = async () => {
|
|
89
|
+
const spec = asking;
|
|
90
|
+
setBusy(true);
|
|
91
|
+
setError(null);
|
|
92
|
+
const failed = await spec.run();
|
|
93
|
+
setBusy(false);
|
|
94
|
+
setAsking(null);
|
|
95
|
+
if (failed) setError(failed);
|
|
96
|
+
await onChanged?.();
|
|
97
|
+
};
|
|
98
|
+
const askSignOut = (card) => {
|
|
99
|
+
setMenu(null);
|
|
100
|
+
const s = card.signOut;
|
|
101
|
+
setAsking({
|
|
102
|
+
id: 'signout',
|
|
103
|
+
...s.confirm,
|
|
104
|
+
run: async () => {
|
|
105
|
+
const r =
|
|
106
|
+
s.path === 'cloud-signout'
|
|
107
|
+
? await cloudSignOut(s.profile)
|
|
108
|
+
: await hubSignOut(s.profile, s.url);
|
|
109
|
+
return r.ok && r.json?.ok ? null : r.json?.error || SIGNOUT_FAILED;
|
|
110
|
+
},
|
|
111
|
+
});
|
|
112
|
+
};
|
|
113
|
+
const askForget = (servers) => {
|
|
114
|
+
const spec = forgetSpec(servers);
|
|
115
|
+
setAsking({
|
|
116
|
+
...spec,
|
|
117
|
+
run: async () => {
|
|
118
|
+
let failed = null;
|
|
119
|
+
for (const s of spec.servers) {
|
|
120
|
+
const r = await hubSignOut(s.profile, s.url);
|
|
121
|
+
if (!r.ok || !r.json?.ok) failed = r.json?.error || FORGET_FAILED;
|
|
122
|
+
}
|
|
123
|
+
return failed;
|
|
124
|
+
},
|
|
125
|
+
});
|
|
126
|
+
};
|
|
127
|
+
const ghSignIn = async (profile) => {
|
|
128
|
+
setMenu(null);
|
|
129
|
+
setError(null);
|
|
130
|
+
setBusy(true);
|
|
131
|
+
try {
|
|
132
|
+
await githubSignIn(profile, shellInvoke);
|
|
133
|
+
await onChanged?.();
|
|
134
|
+
} catch (e) {
|
|
135
|
+
setError(typeof e === 'string' ? e : 'GitHub sign-in didn’t finish. Try again.');
|
|
136
|
+
} finally {
|
|
137
|
+
setGhCode(null);
|
|
138
|
+
setBusy(false);
|
|
139
|
+
}
|
|
140
|
+
};
|
|
141
|
+
|
|
142
|
+
const forgettable = old.filter((c) => c.forget);
|
|
143
|
+
const shownError = error || fixer.error;
|
|
144
|
+
|
|
145
|
+
return (
|
|
146
|
+
<span className="island home-top-acct" ref={wrap}>
|
|
147
|
+
<button
|
|
148
|
+
type="button"
|
|
149
|
+
className="home-acchip"
|
|
150
|
+
data-testid="home-accounts-chip"
|
|
151
|
+
data-needs={summary.needs || undefined}
|
|
152
|
+
aria-haspopup="dialog"
|
|
153
|
+
aria-expanded={open}
|
|
154
|
+
onClick={() => (open ? close() : onOpen())}
|
|
155
|
+
>
|
|
156
|
+
<HIcon name="people" size={14} />
|
|
157
|
+
<span>{summary.word}</span>
|
|
158
|
+
{summary.needsWord ? (
|
|
159
|
+
<span className="home-acchip-needs" data-testid="home-accounts-chip-needs">
|
|
160
|
+
<i aria-hidden="true" />
|
|
161
|
+
{summary.needsWord}
|
|
162
|
+
</span>
|
|
163
|
+
) : null}
|
|
164
|
+
<HIcon name="chevron" size={12} />
|
|
165
|
+
</button>
|
|
166
|
+
{open ? (
|
|
167
|
+
<div
|
|
168
|
+
className="home-accts"
|
|
169
|
+
role="dialog"
|
|
170
|
+
aria-label="Accounts on this Mac"
|
|
171
|
+
data-testid="home-accounts"
|
|
172
|
+
>
|
|
173
|
+
<p className="home-accts-h">Accounts on this Mac</p>
|
|
174
|
+
<ul className="home-accts-list">
|
|
175
|
+
{live.map((c) => {
|
|
176
|
+
const id = slugOf(c);
|
|
177
|
+
const bad = c.state === 'rejected' || c.state === 'missing';
|
|
178
|
+
const gh = native && firstOf.has(c.key) ? githubOf(shell, c.profile) : null;
|
|
179
|
+
const more = native && (c.signOut || gh);
|
|
180
|
+
return (
|
|
181
|
+
<li
|
|
182
|
+
key={c.key}
|
|
183
|
+
className={`home-acl${bad ? ' home-acl--bad' : ''}`}
|
|
184
|
+
data-kind={c.kind}
|
|
185
|
+
data-state={c.state}
|
|
186
|
+
data-testid={`home-account-card-${id}`}
|
|
187
|
+
>
|
|
188
|
+
<AcctFace face={c.face} state={c.state} size="md" />
|
|
189
|
+
<span className="home-acl-t">
|
|
190
|
+
<strong>{c.title}</strong>
|
|
191
|
+
<span>{c.sub}</span>
|
|
192
|
+
{c.state !== 'ok' ? (
|
|
193
|
+
<StateWord tone={CONN_TONE[c.state]} testid={`home-account-state-${id}`}>
|
|
194
|
+
{c.word}
|
|
195
|
+
</StateWord>
|
|
196
|
+
) : null}
|
|
197
|
+
</span>
|
|
198
|
+
{c.fix ? (
|
|
199
|
+
<button
|
|
200
|
+
type="button"
|
|
201
|
+
className="btn btn--primary btn--sm home-acl-fix"
|
|
202
|
+
data-testid={`home-account-signin-${id}`}
|
|
203
|
+
disabled={!native || fixer.busy === c.key}
|
|
204
|
+
title={native ? undefined : 'Sign in from the Maude app on your Mac.'}
|
|
205
|
+
onClick={() => fixer.fix(c)}
|
|
206
|
+
>
|
|
207
|
+
{fixer.busy === c.key ? WAITING_WORD : c.fix.label}
|
|
208
|
+
</button>
|
|
209
|
+
) : null}
|
|
210
|
+
{more ? (
|
|
211
|
+
<span className="home-acl-more">
|
|
212
|
+
<button
|
|
213
|
+
type="button"
|
|
214
|
+
className="icon-btn"
|
|
215
|
+
aria-label={`More for ${c.title}`}
|
|
216
|
+
aria-haspopup="menu"
|
|
217
|
+
aria-expanded={menu === c.key}
|
|
218
|
+
data-testid={`home-account-more-${id}`}
|
|
219
|
+
onClick={() => setMenu((m) => (m === c.key ? null : c.key))}
|
|
220
|
+
>
|
|
221
|
+
<HIcon name="more" size={16} />
|
|
222
|
+
</button>
|
|
223
|
+
{menu === c.key ? (
|
|
224
|
+
<span className="island home-acl-menu" role="menu">
|
|
225
|
+
{gh?.login ? (
|
|
226
|
+
<span
|
|
227
|
+
className="home-acl-menu-note"
|
|
228
|
+
data-testid={`home-account-github-${c.profile}`}
|
|
229
|
+
>
|
|
230
|
+
GitHub · {gh.login}
|
|
231
|
+
</span>
|
|
232
|
+
) : null}
|
|
233
|
+
{gh?.signIn ? (
|
|
234
|
+
<button
|
|
235
|
+
type="button"
|
|
236
|
+
role="menuitem"
|
|
237
|
+
className="row-item"
|
|
238
|
+
data-testid={`home-account-github-signin-${c.profile}`}
|
|
239
|
+
disabled={busy}
|
|
240
|
+
onClick={() => ghSignIn(c.profile)}
|
|
241
|
+
>
|
|
242
|
+
Sign in with GitHub…
|
|
243
|
+
</button>
|
|
244
|
+
) : null}
|
|
245
|
+
{c.signOut ? (
|
|
246
|
+
<button
|
|
247
|
+
type="button"
|
|
248
|
+
role="menuitem"
|
|
249
|
+
className="row-item"
|
|
250
|
+
data-testid={`home-account-signout-${id}`}
|
|
251
|
+
disabled={busy}
|
|
252
|
+
onClick={() => askSignOut(c)}
|
|
253
|
+
>
|
|
254
|
+
{c.signOut.label}
|
|
255
|
+
</button>
|
|
256
|
+
) : null}
|
|
257
|
+
</span>
|
|
258
|
+
) : null}
|
|
259
|
+
</span>
|
|
260
|
+
) : null}
|
|
261
|
+
</li>
|
|
262
|
+
);
|
|
263
|
+
})}
|
|
264
|
+
</ul>
|
|
265
|
+
{old.length ? (
|
|
266
|
+
<div className="home-accts-old">
|
|
267
|
+
<button
|
|
268
|
+
type="button"
|
|
269
|
+
className="home-accts-oldh"
|
|
270
|
+
data-testid="home-accounts-old"
|
|
271
|
+
aria-expanded={oldOpen}
|
|
272
|
+
onClick={() => setOldOpen((o) => !o)}
|
|
273
|
+
>
|
|
274
|
+
<HIcon name={oldOpen ? 'chevron' : 'submenu'} size={12} />
|
|
275
|
+
<span>{summary.oldWord}</span>
|
|
276
|
+
<span className="home-accts-oldw">Not answering, no projects</span>
|
|
277
|
+
</button>
|
|
278
|
+
{oldOpen ? (
|
|
279
|
+
<ul className="home-accts-oldl">
|
|
280
|
+
{old.map((c) => {
|
|
281
|
+
const id = slugOf(c);
|
|
282
|
+
return (
|
|
283
|
+
<li key={c.key} data-testid={`home-accounts-old-row-${id}`}>
|
|
284
|
+
<HIcon name="server" size={12} />
|
|
285
|
+
<code>{c.forget?.host ?? c.title}</code>
|
|
286
|
+
{native && c.forget ? (
|
|
287
|
+
<button
|
|
288
|
+
type="button"
|
|
289
|
+
className="btn btn--ghost btn--sm"
|
|
290
|
+
data-testid={`home-accounts-old-forget-${id}`}
|
|
291
|
+
disabled={busy}
|
|
292
|
+
onClick={() => askForget([c.forget])}
|
|
293
|
+
>
|
|
294
|
+
Forget…
|
|
295
|
+
</button>
|
|
296
|
+
) : null}
|
|
297
|
+
</li>
|
|
298
|
+
);
|
|
299
|
+
})}
|
|
300
|
+
{native && forgettable.length > 1 ? (
|
|
301
|
+
<li className="home-accts-oldall">
|
|
302
|
+
<button
|
|
303
|
+
type="button"
|
|
304
|
+
className="btn btn--ghost btn--sm"
|
|
305
|
+
data-testid="home-accounts-old-forget-all"
|
|
306
|
+
disabled={busy}
|
|
307
|
+
onClick={() => askForget(forgettable.map((c) => c.forget))}
|
|
308
|
+
>
|
|
309
|
+
Forget all {forgettable.length}…
|
|
310
|
+
</button>
|
|
311
|
+
</li>
|
|
312
|
+
) : null}
|
|
313
|
+
</ul>
|
|
314
|
+
) : null}
|
|
315
|
+
</div>
|
|
316
|
+
) : null}
|
|
317
|
+
{ghCode ? (
|
|
318
|
+
<p className="home-accts-note" data-testid="home-accounts-github-code">
|
|
319
|
+
Enter <strong>{ghCode}</strong> on the GitHub page that opened.
|
|
320
|
+
</p>
|
|
321
|
+
) : null}
|
|
322
|
+
{shownError ? (
|
|
323
|
+
<p className="home-accts-note" role="alert" data-testid="home-accounts-error">
|
|
324
|
+
{shownError}
|
|
325
|
+
</p>
|
|
326
|
+
) : null}
|
|
327
|
+
{asking ? (
|
|
328
|
+
<div
|
|
329
|
+
className="home-accts-ask"
|
|
330
|
+
role="alertdialog"
|
|
331
|
+
aria-label={asking.title}
|
|
332
|
+
data-testid="home-accounts-confirm"
|
|
333
|
+
data-ask={asking.id}
|
|
334
|
+
>
|
|
335
|
+
<strong>{asking.title}</strong>
|
|
336
|
+
<span>{asking.body}</span>
|
|
337
|
+
<span className="home-accts-btns">
|
|
338
|
+
<button
|
|
339
|
+
type="button"
|
|
340
|
+
className="btn btn--sm"
|
|
341
|
+
data-testid={`home-accounts-${asking.id}-cancel`}
|
|
342
|
+
onClick={() => setAsking(null)}
|
|
343
|
+
>
|
|
344
|
+
{asking.cancel}
|
|
345
|
+
</button>
|
|
346
|
+
<button
|
|
347
|
+
type="button"
|
|
348
|
+
className={`btn btn--sm ${asking.id === 'signout' ? 'btn--danger' : 'btn--primary'}`}
|
|
349
|
+
data-testid={`home-accounts-${asking.id}-confirm`}
|
|
350
|
+
disabled={busy}
|
|
351
|
+
onClick={runAsk}
|
|
352
|
+
>
|
|
353
|
+
{asking.primary}
|
|
354
|
+
</button>
|
|
355
|
+
</span>
|
|
356
|
+
</div>
|
|
357
|
+
) : null}
|
|
358
|
+
{native ? (
|
|
359
|
+
<div className="home-accts-foot">
|
|
360
|
+
<button
|
|
361
|
+
type="button"
|
|
362
|
+
className="home-accts-act"
|
|
363
|
+
data-testid="home-accounts-add"
|
|
364
|
+
aria-haspopup="menu"
|
|
365
|
+
aria-expanded={menu === 'add'}
|
|
366
|
+
onClick={() => setMenu((m) => (m === 'add' ? null : 'add'))}
|
|
367
|
+
>
|
|
368
|
+
<HIcon name="plus" size={12} /> Add an account…
|
|
369
|
+
</button>
|
|
370
|
+
{menu === 'add' ? (
|
|
371
|
+
<span className="home-accts-addm" role="menu">
|
|
372
|
+
<button
|
|
373
|
+
type="button"
|
|
374
|
+
role="menuitem"
|
|
375
|
+
className="row-item"
|
|
376
|
+
data-testid="home-accounts-add-cloud"
|
|
377
|
+
onClick={() => {
|
|
378
|
+
close();
|
|
379
|
+
onAddCloud?.();
|
|
380
|
+
}}
|
|
381
|
+
>
|
|
382
|
+
Add a Maude Cloud account…
|
|
383
|
+
</button>
|
|
384
|
+
<button
|
|
385
|
+
type="button"
|
|
386
|
+
role="menuitem"
|
|
387
|
+
className="row-item"
|
|
388
|
+
data-testid="home-accounts-add-team"
|
|
389
|
+
onClick={() => {
|
|
390
|
+
close();
|
|
391
|
+
onAddTeam?.();
|
|
392
|
+
}}
|
|
393
|
+
>
|
|
394
|
+
Connect to a team server…
|
|
395
|
+
</button>
|
|
396
|
+
</span>
|
|
397
|
+
) : null}
|
|
398
|
+
</div>
|
|
399
|
+
) : null}
|
|
400
|
+
</div>
|
|
401
|
+
) : null}
|
|
402
|
+
</span>
|
|
403
|
+
);
|
|
404
|
+
}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
// client/home/HomeConnection.jsx — 2.1.1 B4 (artboard 14): the pieces Home's accounts row and its project
|
|
2
|
+
// rows share — an account's face with the connection badge on it, the "Where" chip, and the state word.
|
|
3
|
+
// Models: home-where-model.js (words, tones) · home-accounts-model.js (cards). Nothing here decides a
|
|
4
|
+
// state; it draws what the model says.
|
|
5
|
+
|
|
6
|
+
import { HIcon } from './home-icons.jsx';
|
|
7
|
+
|
|
8
|
+
/** The broken-link glyph on a sign-in that stopped working (the project window's badge). */
|
|
9
|
+
export function BrokenLink({ size = 10 }) {
|
|
10
|
+
return (
|
|
11
|
+
<svg
|
|
12
|
+
width={size}
|
|
13
|
+
height={size}
|
|
14
|
+
viewBox="0 0 16 16"
|
|
15
|
+
fill="none"
|
|
16
|
+
stroke="currentColor"
|
|
17
|
+
strokeWidth="1.6"
|
|
18
|
+
strokeLinecap="round"
|
|
19
|
+
aria-hidden="true"
|
|
20
|
+
>
|
|
21
|
+
<path d="M6.6 9.4 5.1 10.9a2.1 2.1 0 0 1-3-3l1.5-1.5" />
|
|
22
|
+
<path d="M9.4 6.6 10.9 5.1a2.1 2.1 0 0 1 3 3l-1.5 1.5" />
|
|
23
|
+
<path d="M5.2 1.8v1.6M1.8 5.2h1.6M10.8 14.2v-1.6M14.2 10.8h-1.6" />
|
|
24
|
+
</svg>
|
|
25
|
+
);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/** "Kept by Maude" — the mark, single colour. */
|
|
29
|
+
export function KeptGlyph({ size = 12 }) {
|
|
30
|
+
return (
|
|
31
|
+
<svg width={size} height={size} viewBox="0 0 16 16" aria-hidden="true">
|
|
32
|
+
<rect x="1.5" y="1.5" width="13" height="13" rx="3.5" fill="currentColor" />
|
|
33
|
+
<path d="M8 4.2v7.6M4.2 8h7.6" stroke="var(--bg-1)" strokeWidth="1.6" strokeLinecap="round" />
|
|
34
|
+
</svg>
|
|
35
|
+
);
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* An account's face — a circle with a letter for a Maude Cloud account, a tile with the server glyph for
|
|
40
|
+
* your server, a laptop tile for this Mac — with the connection state as ONE badge on it (a thin ring
|
|
41
|
+
* turning while it syncs, a grey face offline, a broken link when a sign-in needs the person, a warning
|
|
42
|
+
* when the server does not answer).
|
|
43
|
+
* @param {{ face: { kind: string, initial?: string, tone?: string }, state?: string|null,
|
|
44
|
+
* size?: 'sm'|'md'|'lg' }} props
|
|
45
|
+
*/
|
|
46
|
+
export function AcctFace({ face, state = null, size = 'md' }) {
|
|
47
|
+
const glyph = size === 'lg' ? 16 : size === 'md' ? 13 : 10;
|
|
48
|
+
return (
|
|
49
|
+
<span
|
|
50
|
+
className={`home-acf home-acf--${size}`}
|
|
51
|
+
data-conn={state ?? undefined}
|
|
52
|
+
aria-hidden="true"
|
|
53
|
+
>
|
|
54
|
+
{face.kind === 'cloud' ? (
|
|
55
|
+
<span className={`home-face home-face--${size} home-face--${face.tone}`}>
|
|
56
|
+
{face.initial}
|
|
57
|
+
</span>
|
|
58
|
+
) : (
|
|
59
|
+
<span className={`home-acf-tile home-acf-tile--${face.kind} home-acf-tile--${size}`}>
|
|
60
|
+
<HIcon name={face.kind === 'server' ? 'server' : 'laptop'} size={glyph} />
|
|
61
|
+
</span>
|
|
62
|
+
)}
|
|
63
|
+
{state === 'syncing' ? <span className="home-acf-ring" /> : null}
|
|
64
|
+
{state === 'missing' || state === 'rejected' ? (
|
|
65
|
+
<span className="home-acf-badge home-acf-badge--bad">
|
|
66
|
+
<BrokenLink size={size === 'lg' ? 12 : size === 'md' ? 10 : 8} />
|
|
67
|
+
</span>
|
|
68
|
+
) : null}
|
|
69
|
+
{state === 'unreachable' ? (
|
|
70
|
+
<span className="home-acf-badge home-acf-badge--warn">!</span>
|
|
71
|
+
) : null}
|
|
72
|
+
</span>
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
/** The state as a word with its dot (green · red · amber · grey). */
|
|
77
|
+
export function StateWord({ tone, children, testid }) {
|
|
78
|
+
return (
|
|
79
|
+
<span className="home-sw" data-tone={tone} data-testid={testid}>
|
|
80
|
+
<i aria-hidden="true" />
|
|
81
|
+
{/* 2.1.2: the word clips (…) on a narrow line instead of running under a button */}
|
|
82
|
+
<span className="home-sw-w">{children}</span>
|
|
83
|
+
</span>
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
const WHERE_ICON = { cloud: 'cloud', server: 'server', folder: 'folder' };
|
|
88
|
+
|
|
89
|
+
/**
|
|
90
|
+
* The "Where" chip: the account for a synced project (Maude Cloud by e-mail, your server by host), or the
|
|
91
|
+
* place for a project only on this Mac (Your folder · Kept by Maude), with the folder's path beside it.
|
|
92
|
+
* @param {{ where: { kind: string, label: string, path: string|null }, testid?: string }} props
|
|
93
|
+
*/
|
|
94
|
+
export function WhereChip({ where, testid }) {
|
|
95
|
+
return (
|
|
96
|
+
<span className="home-where" data-kind={where.kind} data-testid={testid}>
|
|
97
|
+
<span className="home-place">
|
|
98
|
+
{where.kind === 'kept' ? (
|
|
99
|
+
<KeptGlyph size={12} />
|
|
100
|
+
) : (
|
|
101
|
+
<HIcon name={WHERE_ICON[where.kind] ?? 'folder'} size={12} />
|
|
102
|
+
)}
|
|
103
|
+
<span>{where.label}</span>
|
|
104
|
+
</span>
|
|
105
|
+
{where.path ? (
|
|
106
|
+
<span className="home-where-path" title={where.path}>
|
|
107
|
+
{where.path}
|
|
108
|
+
</span>
|
|
109
|
+
) : null}
|
|
110
|
+
</span>
|
|
111
|
+
);
|
|
112
|
+
}
|