@hanzo/app 0.3.94 → 0.3.96
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/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +114 -48
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/PreferencesDialog.js +5 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.d.ts +10 -0
- package/dist/Shell.js +258 -158
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +16 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +71 -25
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +9 -3
- package/dist/bots/grid.d.ts +36 -0
- package/dist/bots/grid.js +91 -0
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +9 -4
- package/dist/bots/kit.js +3 -2
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +2 -2
- package/dist/ground.js +3 -3
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/durable.d.ts +1 -1
- package/dist/lib/durable.js +1 -1
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +7 -1
- package/dist/lib/todo.js +41 -29
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/seek.d.ts +6 -1
- package/dist/seek.js +13 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Account.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export interface Org {
|
|
|
9
9
|
personal: boolean;
|
|
10
10
|
role: string;
|
|
11
11
|
}
|
|
12
|
-
/** The first letters of a name, at most two: Antje Worring
|
|
12
|
+
/** The first letters of a name, at most two: Antje Worring -> AW. */
|
|
13
13
|
export declare const initials: (name: string) => string;
|
|
14
14
|
/** The plan from a tier answer: its display name (`Unlimited`), else by its family (`Max 20x`); '' with no plan. */
|
|
15
15
|
export declare const planOf: (tier: Tier | null) => string;
|
|
@@ -26,10 +26,10 @@ export declare function Face({ host, size }: {
|
|
|
26
26
|
export declare const upgrade: (family: string | null | undefined) => string;
|
|
27
27
|
export declare function Account({ host, narrow, above, onOrg, defaultAccountOpen, }: {
|
|
28
28
|
host: Who;
|
|
29
|
-
/** The rail's: the face alone, the
|
|
29
|
+
/** The rail's folded mode: the face alone, the hover card opening beside it. */
|
|
30
30
|
narrow?: boolean;
|
|
31
31
|
/**
|
|
32
|
-
* The
|
|
32
|
+
* The card opens above the face, not beside it: the foot of a phone's menu
|
|
33
33
|
* (Drawer.tsx). That copy leaves ⌘/ to the rail's own, so one press opens one dialog.
|
|
34
34
|
*/
|
|
35
35
|
above?: boolean;
|
|
@@ -37,6 +37,12 @@ export declare function Account({ host, narrow, above, onOrg, defaultAccountOpen
|
|
|
37
37
|
onOrg: (org: string) => void;
|
|
38
38
|
defaultAccountOpen?: boolean;
|
|
39
39
|
}): import("react").JSX.Element;
|
|
40
|
+
/** The app's keys (help.ts `KEYS`), categorized with crisp `--border-strong` keycaps for this platform. */
|
|
41
|
+
export declare function Shortcuts({ open, onOpenChange, apple }: {
|
|
42
|
+
open: boolean;
|
|
43
|
+
onOpenChange: (open: boolean) => void;
|
|
44
|
+
apple: boolean;
|
|
45
|
+
}): import("react").JSX.Element;
|
|
40
46
|
/**
|
|
41
47
|
* What became of an organization this tab created: nothing to say once the token
|
|
42
48
|
* carries it (the app is already in it), and a plain line while it does not.
|
package/dist/Account.js
CHANGED
|
@@ -1,45 +1,20 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
//
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
// Help ›, the site's own pages and the keyboard shortcuts (⌘/ / Ctrl+/ from
|
|
11
|
-
// anywhere); and Log out. Every row opens a real destination: Settings'
|
|
12
|
-
// pages through `showSettings` (open.ts), which the app answers with the
|
|
13
|
-
// site's Settings at /settings (App.tsx) and the shell with its own pane; the plans on the
|
|
14
|
-
// pay site (`leave`); the site's pages through `site()`, so hanzo.team names
|
|
15
|
-
// hanzo.ai (help.ts).
|
|
16
|
-
//
|
|
17
|
-
// THE ACCOUNT'S › LEADS WITH THE PLAN: @hanzo/build's `Meter`, the plan by its
|
|
18
|
-
// family (`Max` with `20x` beside it) and, on a plan, its windows as shares; the
|
|
19
|
-
// free allowance left today on Free; the balance only for an account with no
|
|
20
|
-
// plan, whose meter it is. Then every organization the token names — the
|
|
21
|
-
// personal one first, with its plan — switched with `onOrg`; Create
|
|
22
|
-
// organization, Organization settings, and Hanzo Team (opened in the same
|
|
23
|
-
// organization for a team, offered as "Create a team" for a personal one); and
|
|
24
|
-
// All organizations for a SuperAdmin, which opens the chooser (Gate.tsx).
|
|
25
|
-
//
|
|
26
|
-
// Its words go through `t`; names, plans, addresses and keys are drawn as they
|
|
27
|
-
// are, a key isolated left to right so its `+` and `,` keep their places in a
|
|
28
|
-
// right-to-left menu, which opens toward the content from the rail's side.
|
|
29
|
-
//
|
|
30
|
-
// IAM is the source of every fact here: names and roles from the token's `orgs`
|
|
31
|
-
// claim, display names and which org is personal from `GET /v1/iam/organizations`,
|
|
32
|
-
// the plan from billing and the limits. An organization is created by the same
|
|
33
|
-
// `POST /v1/account/orgs` the no-organization gate uses (Gate.tsx); the next load
|
|
34
|
-
// mints a token that carries it.
|
|
3
|
+
// Unified profile trigger & HoverCard for the signed-in shell:
|
|
4
|
+
// - Hovering shows membership tier, live usage/credit stats, Developer mode toggle,
|
|
5
|
+
// workspace switcher, Upgrade CTA, and quick actions.
|
|
6
|
+
// - Clicking the profile button itself remembers the current route and opens
|
|
7
|
+
// `/settings/account` in 1 click.
|
|
8
|
+
// - A subtle `⋯` menu inside the hover card exposes multi-account switching,
|
|
9
|
+
// language selection, keyboard shortcuts, and organization creation.
|
|
35
10
|
import { phrase, locales } from '@hanzo/i18n';
|
|
36
11
|
import { useI18n } from '@hanzo/i18n/react';
|
|
37
12
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
38
13
|
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
39
|
-
import { ArrowUpRight, Activity, BookOpen, Building2, Check,
|
|
14
|
+
import { ArrowUpRight, Activity, BookOpen, Building2, Check, ChevronDown, ChevronRight, CircleHelp, CircleUserRound, Download, FileText, FlaskConical, Info, Keyboard, Languages, LifeBuoy, LogOut, MessagesSquare, MoreHorizontal, Palette, Plus, ScrollText, Settings, ShieldCheck, Sparkles, UserPlus, Users, X, } from 'lucide-react';
|
|
40
15
|
import { label, Meter, said as spoken, useStanding } from '@hanzo/build';
|
|
41
16
|
import { useOrganizations } from '@hanzo/iam/react';
|
|
42
|
-
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, Input, Kbd, } from '@hanzo/ui';
|
|
17
|
+
import { Button, Dialog, DialogContent, DialogTitle, DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuSub, DropdownMenuSubContent, DropdownMenuSubTrigger, DropdownMenuTrigger, HoverCard, HoverCardContent, HoverCardTrigger, Input, Kbd, Switch, Text, } from '@hanzo/ui';
|
|
43
18
|
import { label as accountLabel, useAccounts } from './lib/accounts.js';
|
|
44
19
|
import { api } from './lib/api.js';
|
|
45
20
|
import { createOrg, say } from './lib/org.js';
|
|
@@ -48,15 +23,20 @@ import { onServed } from './lib/served.js';
|
|
|
48
23
|
import { subscribeTokens, totalRecordedTokens } from './lib/tokens.js';
|
|
49
24
|
import { choose, org as current, orgs, renew, reopen, scope, superAdmin } from './lib/session.js';
|
|
50
25
|
import { ENTRY, settings } from './lib/host.js';
|
|
26
|
+
import { rememberSettingsReturn, useDevMode } from './lib/dev-mode.js';
|
|
27
|
+
import { InfoHint } from './lib/info-hint.js';
|
|
51
28
|
import { leave } from './dev.js';
|
|
52
|
-
import {
|
|
53
|
-
import { asked, KEYS, legal, out, pages } from './help.js';
|
|
29
|
+
import { KEYS, legal, out, pages } from './help.js';
|
|
54
30
|
import { showSettings } from './open.js';
|
|
55
31
|
import { MARK } from './ground.js';
|
|
56
32
|
import { site, where } from './where.js';
|
|
57
33
|
import { BAD } from './lib/mix.js';
|
|
58
34
|
/** An organization this tab created, until the token carries it. */
|
|
59
35
|
const MADE = 'hanzo:org:made';
|
|
36
|
+
const INK = 'var(--foreground)';
|
|
37
|
+
const SOFT = 'var(--text-secondary, var(--muted-foreground))';
|
|
38
|
+
const STRONG = 'var(--border-strong)';
|
|
39
|
+
const FOCUS_RING = { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' };
|
|
60
40
|
/** Each Help page's icon, by its key in help.ts. */
|
|
61
41
|
const ICONS = {
|
|
62
42
|
help: _jsx(CircleHelp, { size: 16, "aria-hidden": true }),
|
|
@@ -70,9 +50,9 @@ const ICONS = {
|
|
|
70
50
|
};
|
|
71
51
|
/** IAM's roles as a person reads them, through `t`. */
|
|
72
52
|
const ROLES = { owner: phrase('Owner'), admin: phrase('Admin'), member: phrase('Member') };
|
|
73
|
-
/** A role as a person reads it: `owner`
|
|
53
|
+
/** A role as a person reads it: `owner` -> Owner; one IAM names that these do not, capitalised as it comes. */
|
|
74
54
|
const said = (role, t) => ROLES[role] ? t(ROLES[role]) : role ? role.charAt(0).toUpperCase() + role.slice(1) : '';
|
|
75
|
-
/** The first letters of a name, at most two: Antje Worring
|
|
55
|
+
/** The first letters of a name, at most two: Antje Worring -> AW. */
|
|
76
56
|
export const initials = (name) => name
|
|
77
57
|
.split(/[\s@._-]+/)
|
|
78
58
|
.filter(Boolean)
|
|
@@ -85,7 +65,7 @@ export const planOf = (tier) => (tier ? spoken(label(tier.plan, tier.tier?.name,
|
|
|
85
65
|
* The token's organizations with IAM's rows beside them: display name, and which
|
|
86
66
|
* one is the person's own. The personal organization leads, then the token's order.
|
|
87
67
|
*/
|
|
88
|
-
function useOrgs(
|
|
68
|
+
function useOrgs(currentOrg) {
|
|
89
69
|
const { roles } = useOrganizations();
|
|
90
70
|
const names = orgs();
|
|
91
71
|
const [rows, setRows] = useState([]);
|
|
@@ -102,21 +82,21 @@ function useOrgs(current) {
|
|
|
102
82
|
})
|
|
103
83
|
.catch(() => { });
|
|
104
84
|
return () => stop.abort();
|
|
105
|
-
}, [key,
|
|
85
|
+
}, [key, currentOrg]);
|
|
106
86
|
const drawn = names.map((name) => {
|
|
107
87
|
const row = rows.find((r) => r?.name === name);
|
|
108
88
|
return { name, display: row?.displayName || name, personal: Boolean(row?.isPersonal), role: roles?.[name] ?? '' };
|
|
109
89
|
});
|
|
110
90
|
return [...drawn.filter((o) => o.personal), ...drawn.filter((o) => !o.personal)];
|
|
111
91
|
}
|
|
112
|
-
/** The plan of an organization
|
|
113
|
-
function usePlan(
|
|
92
|
+
/** The plan of an organization: billing, asked in its name. */
|
|
93
|
+
function usePlan(orgName, enabled) {
|
|
114
94
|
const [plan, setPlan] = useState('');
|
|
115
95
|
useEffect(() => {
|
|
116
|
-
if (!enabled || !
|
|
96
|
+
if (!enabled || !orgName)
|
|
117
97
|
return;
|
|
118
98
|
const stop = new AbortController();
|
|
119
|
-
fetch(`${api()}/v1/billing/tier`, { headers: { ...scope(), 'X-Org-Id':
|
|
99
|
+
fetch(`${api()}/v1/billing/tier`, { headers: { ...scope(), 'X-Org-Id': orgName }, signal: stop.signal })
|
|
120
100
|
.then((r) => (r.ok ? r.json() : null))
|
|
121
101
|
.then((t) => {
|
|
122
102
|
if (!stop.signal.aborted)
|
|
@@ -124,7 +104,7 @@ function usePlan(org, enabled) {
|
|
|
124
104
|
})
|
|
125
105
|
.catch(() => { });
|
|
126
106
|
return () => stop.abort();
|
|
127
|
-
}, [
|
|
107
|
+
}, [orgName, enabled]);
|
|
128
108
|
return plan;
|
|
129
109
|
}
|
|
130
110
|
/** The person's picture, or their initials. */
|
|
@@ -135,14 +115,14 @@ export function Face({ host, size = 28 }) {
|
|
|
135
115
|
useEffect(() => {
|
|
136
116
|
setFailed(false);
|
|
137
117
|
}, [cleanSrc]);
|
|
138
|
-
return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor:
|
|
118
|
+
return (_jsx(XStack, { width: size, height: size, rounded: 9999, items: "center", justify: "center", bg: "$raised", overflow: "hidden", shrink: 0, borderWidth: 1, borderColor: STRONG, children: cleanSrc && !failed ? (_jsx("img", { src: cleanSrc, alt: "", width: size, height: size, onError: () => setFailed(true) })) : (_jsx(SizableText, { size: size >= 30 ? '$2' : '$1', fontWeight: "600", color: "$ink", children: initials(p?.name || p?.email || '') })) }));
|
|
139
119
|
}
|
|
140
120
|
/** A row's face: its icon in a 20px well, its words, and what trails them. */
|
|
141
121
|
function Line({ icon, children, sub, trail }) {
|
|
142
122
|
return (_jsxs(_Fragment, { children: [icon !== undefined ? (_jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: icon })) : null, _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", color: "$ink", numberOfLines: 1, children: children }), sub ? (_jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: sub })) : null] }), trail] }));
|
|
143
123
|
}
|
|
144
124
|
/** An organization's mark in the list: its initials on a rounded square. */
|
|
145
|
-
const Mark = ({ org }) => (_jsx(XStack, { width: 18, height: 18, rounded: "$2", items: "center", justify: "center", bg: "$raised", shrink: 0, children: org.personal ? (_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", children: initials(org.display).charAt(0) })) : (_jsx(Building2, { size: 12, "aria-hidden": true })) }));
|
|
125
|
+
const Mark = ({ org }) => (_jsx(XStack, { width: 18, height: 18, rounded: "$2", items: "center", justify: "center", bg: "$raised", borderWidth: 1, borderColor: "$edge", shrink: 0, children: org.personal ? (_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$ink", children: initials(org.display).charAt(0) })) : (_jsx(Building2, { size: 12, color: INK, "aria-hidden": true })) }));
|
|
146
126
|
/**
|
|
147
127
|
* The plans row, named by the plan the organization is on: Enterprise and
|
|
148
128
|
* Agency are plans a person stays on, so the row names theirs; every other
|
|
@@ -154,49 +134,49 @@ const mac = () => typeof navigator !== 'undefined' && /Mac|iPhone|iPad/.test(nav
|
|
|
154
134
|
export function Account({ host, narrow = false, above = false, onOrg, defaultAccountOpen = false, }) {
|
|
155
135
|
const { t, dir, locale, setLocale } = useI18n();
|
|
156
136
|
const rtl = dir === 'rtl';
|
|
157
|
-
const [
|
|
137
|
+
const [devMode, setDevMode] = useDevMode();
|
|
138
|
+
const [hoverOpen, setHoverOpen] = useState(false);
|
|
139
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
140
|
+
const [workspacesOpen, setWorkspacesOpen] = useState(false);
|
|
158
141
|
const [account, setAccount] = useState(defaultAccountOpen ?? false);
|
|
159
|
-
const [
|
|
142
|
+
const [orgsOpen, setOrgsOpen] = useState(false);
|
|
160
143
|
const [lang, setLang] = useState(false);
|
|
161
144
|
const [langQuery, setLangQuery] = useState('');
|
|
162
145
|
const [help, setHelp] = useState(false);
|
|
163
146
|
const [creating, setCreating] = useState(false);
|
|
164
147
|
const [keys, setKeys] = useState(false);
|
|
165
148
|
const row = useRef(null);
|
|
166
|
-
const
|
|
167
|
-
// Every other account signed in on this browser, one press away, a new one
|
|
168
|
-
// (lib/accounts: the sign-in with login_hint, and with prompt=login) and a way
|
|
169
|
-
// out of this one alone.
|
|
149
|
+
const currentOrg = host.org;
|
|
170
150
|
const signedIn = useAccounts();
|
|
171
151
|
const others = signedIn.accounts.filter((a) => a.sub !== signedIn.current?.sub);
|
|
172
152
|
const several = signedIn.accounts.length > 1;
|
|
173
|
-
const all = useOrgs(
|
|
174
|
-
const here = all.find((o) => o.name ===
|
|
153
|
+
const all = useOrgs(currentOrg);
|
|
154
|
+
const here = all.find((o) => o.name === currentOrg) ?? null;
|
|
175
155
|
const personal = all.find((o) => o.personal) ?? null;
|
|
176
156
|
const target = useMemo(() => ({ api: host.api, token: host.token, org: host.org }), [host.api, host.token, host.org]);
|
|
177
|
-
const read = useStanding(target,
|
|
178
|
-
const currentTierPlan = usePlan(
|
|
157
|
+
const read = useStanding(target, Boolean(host.person));
|
|
158
|
+
const currentTierPlan = usePlan(currentOrg, Boolean(host.person));
|
|
179
159
|
const [tokenTick, setTokenTick] = useState(0);
|
|
180
160
|
useEffect(() => {
|
|
181
161
|
const offServed = onServed(() => {
|
|
182
162
|
setTokenTick((n) => n + 1);
|
|
183
|
-
if (
|
|
163
|
+
if (hoverOpen || menuOpen)
|
|
184
164
|
read.reload();
|
|
185
165
|
});
|
|
186
166
|
const offTokens = subscribeTokens(() => {
|
|
187
167
|
setTokenTick((n) => n + 1);
|
|
188
|
-
if (
|
|
168
|
+
if (hoverOpen || menuOpen)
|
|
189
169
|
read.reload();
|
|
190
170
|
});
|
|
191
171
|
return () => {
|
|
192
172
|
offServed();
|
|
193
173
|
offTokens();
|
|
194
174
|
};
|
|
195
|
-
}, [
|
|
175
|
+
}, [hoverOpen, menuOpen, read]);
|
|
196
176
|
useEffect(() => {
|
|
197
|
-
if (account &&
|
|
177
|
+
if (hoverOpen || (account && menuOpen))
|
|
198
178
|
read.reload();
|
|
199
|
-
}, [account,
|
|
179
|
+
}, [hoverOpen, account, menuOpen, read]);
|
|
200
180
|
useEffect(() => {
|
|
201
181
|
if (typeof window === 'undefined')
|
|
202
182
|
return;
|
|
@@ -236,40 +216,31 @@ export function Account({ host, narrow = false, above = false, onOrg, defaultAcc
|
|
|
236
216
|
},
|
|
237
217
|
};
|
|
238
218
|
}, [read, tokenTick]);
|
|
239
|
-
const other = usePlan(personal && personal.name !==
|
|
240
|
-
// THE TWO ACCOUNTS, apart: the organization's plan (hanzo · Enterprise) and the
|
|
241
|
-
// person's own (Personal · Pro, or none and the way to one). A business plan is
|
|
242
|
-
// the organization's; a personal plan is held beside it, never instead of it.
|
|
243
|
-
const team = here && !here.personal ? here : (all.find((o) => !o.personal) ?? null);
|
|
244
|
-
const teamOther = usePlan(team && team.name !== current ? team.name : null, open);
|
|
219
|
+
const other = usePlan(personal && personal.name !== currentOrg ? personal.name : null, hoverOpen || menuOpen);
|
|
245
220
|
const plan = spoken(read.value?.label ?? null) || currentTierPlan;
|
|
246
|
-
const planFor = (o) => (o.name ===
|
|
221
|
+
const planFor = (o) => (o.name === currentOrg ? plan : o.personal ? other : '');
|
|
247
222
|
const who = host.person?.name || host.person?.email || '';
|
|
248
|
-
const teamPlan = team ? (team.name === current ? plan : teamOther) : '';
|
|
249
|
-
const ownPlan = personal ? (personal.name === current ? plan : other) : '';
|
|
250
223
|
const isFree = !plan || plan.toLowerCase() === 'free';
|
|
251
|
-
const planName = plan ||
|
|
252
|
-
|
|
253
|
-
const working = [here ? (here.personal ? t('Personal') : here.display) : current, planName].filter(Boolean).join(' - ');
|
|
254
|
-
// A personal plan is bought for the personal organization, beside any business one.
|
|
255
|
-
// The plans row's name (a phrase of `upgrade`'s).
|
|
224
|
+
const planName = plan || t('Free');
|
|
225
|
+
const working = [here ? (here.personal ? t('Personal') : here.display) : currentOrg, planName].filter(Boolean).join(' - ');
|
|
256
226
|
const plans = upgrade(read.value?.label?.name);
|
|
257
|
-
const getPro = () => (personal ? window.location.assign(payUrl('/cart', { org: personal.name, returnUrl: window.location.href })) : window.location.assign(payUrl('/cart', { returnUrl: window.location.href })));
|
|
258
227
|
const apple = mac();
|
|
259
|
-
|
|
260
|
-
|
|
228
|
+
const goSettings = (section) => {
|
|
229
|
+
setHoverOpen(false);
|
|
230
|
+
setMenuOpen(false);
|
|
231
|
+
rememberSettingsReturn();
|
|
232
|
+
showSettings(section);
|
|
233
|
+
};
|
|
234
|
+
const triggerUpgrade = () => {
|
|
235
|
+
setHoverOpen(false);
|
|
236
|
+
setMenuOpen(false);
|
|
237
|
+
if (read.value?.label?.name === 'Enterprise' || read.value?.label?.name === 'Agency') {
|
|
238
|
+
rememberSettingsReturn();
|
|
239
|
+
showSettings('billing');
|
|
261
240
|
return;
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
e.preventDefault();
|
|
266
|
-
setOpen(false);
|
|
267
|
-
setKeys(true);
|
|
268
|
-
};
|
|
269
|
-
window.addEventListener('keydown', press);
|
|
270
|
-
return () => window.removeEventListener('keydown', press);
|
|
271
|
-
}, [above]);
|
|
272
|
-
// Focus goes back to the row only when nothing the menu opened (a dialog) took it.
|
|
241
|
+
}
|
|
242
|
+
leave('here');
|
|
243
|
+
};
|
|
273
244
|
const back = (e) => {
|
|
274
245
|
e.preventDefault();
|
|
275
246
|
requestAnimationFrame(() => {
|
|
@@ -280,57 +251,91 @@ export function Account({ host, narrow = false, above = false, onOrg, defaultAcc
|
|
|
280
251
|
};
|
|
281
252
|
if (!host.person)
|
|
282
253
|
return null;
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
if (next)
|
|
254
|
+
const tierPill = (_jsx(XStack, { "data-slot": "me-tier-pill", px: "$2", py: 2, rounded: "$10", items: "center", justify: "center", shrink: 0, borderWidth: 1, bg: isFree ? '$panel' : '$raised', borderColor: isFree ? '$edge' : STRONG, children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: isFree ? '$aside' : '$ink', numberOfLines: 1, children: planName }) }));
|
|
255
|
+
return (_jsxs(_Fragment, { children: [_jsxs(HoverCard, { open: hoverOpen, onOpenChange: (next) => {
|
|
256
|
+
if (!next && menuOpen)
|
|
286
257
|
return;
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
},
|
|
292
|
-
// Toward the content from the rail, and aligned as the row's own edge is: mirrored right to left.
|
|
293
|
-
placement: narrow && !above ? (rtl ? 'left-end' : 'right-end') : above !== rtl ? 'top-end' : 'top-start',
|
|
294
|
-
// Clear of the rail's mark (or the row) it opens from, and flush with its foot.
|
|
295
|
-
offset: 8, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsxs(XStack, { ref: (el) => {
|
|
258
|
+
setHoverOpen(next);
|
|
259
|
+
if (!next)
|
|
260
|
+
setWorkspacesOpen(false);
|
|
261
|
+
}, openDelay: 120, closeDelay: 180, children: [_jsx(HoverCardTrigger, { asChild: true, children: _jsxs(XStack, { ref: (el) => {
|
|
296
262
|
row.current = el instanceof HTMLElement ? el : null;
|
|
297
|
-
}, render: "button", "data-slot": "me", "aria-label": t('Account: {name}', { name: [who,
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
263
|
+
}, render: _jsx("button", { type: "button" }), "data-slot": "me", "aria-label": t('Account: {name}', { name: [who, currentOrg].filter(Boolean).join(' · ') }), width: narrow ? (above ? 44 : MARK) : '100%', height: narrow ? (above ? 44 : MARK) : undefined, minH: narrow ? (above ? 44 : MARK) : 42, $touchable: narrow ? { width: 44, height: 44, minH: 44 } : { minH: 44 }, px: narrow ? 0 : '$2', py: narrow ? 0 : '$1', gap: "$2", rounded: narrow ? 12 : '$3', borderWidth: narrow && above ? 1 : 0, borderColor: narrow && above ? STRONG : undefined, bg: narrow && above ? '$panel' : narrow && hoverOpen ? '$hover' : 'transparent', items: "center", justify: narrow ? 'center' : 'flex-start', hoverStyle: { bg: '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: FOCUS_RING, cursor: "pointer", onClick: () => goSettings('account'), children: [_jsx(Face, { host: host, size: narrow ? (above ? 32 : 26) : 28 }), narrow ? null : (_jsxs(_Fragment, { children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, text: "start", children: who }) }), tierPill] }))] }) }), _jsx(HoverCardContent, { "data-slot": "me-hover-card", side: narrow && !above ? (rtl ? 'left' : 'right') : 'top', align: narrow && !above ? 'end' : 'start', sideOffset: 8, bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$5", p: "$4", width: 284, maxW: "calc(100vw - 24px)", z: "var(--z-popover)", boxShadow: "var(--shadow-floating)", children: _jsxs(YStack, { gap: "$3", width: "100%", children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2.5", flex: 1, minW: 0, children: [_jsx(Face, { host: host, size: 34 }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), tierPill] }), host.person.email ? (_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", numberOfLines: 1, children: host.person.email })) : null] })] }), _jsxs(DropdownMenu, { open: menuOpen, onOpenChange: (next) => {
|
|
264
|
+
setMenuOpen(next);
|
|
265
|
+
if (next)
|
|
266
|
+
return;
|
|
267
|
+
setAccount(false);
|
|
268
|
+
setOrgsOpen(false);
|
|
269
|
+
setLang(false);
|
|
270
|
+
setHelp(false);
|
|
271
|
+
}, placement: rtl ? 'bottom-start' : 'bottom-end', offset: 6, children: [_jsx(DropdownMenuTrigger, { asChild: true, children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-more", "aria-label": t('More account options'), width: 28, height: 28, "$max-sm": { width: 44, height: 44 }, rounded: "$2", items: "center", justify: "center", cursor: "pointer", borderWidth: 1, borderColor: menuOpen ? STRONG : 'transparent', bg: menuOpen ? '$hover' : 'transparent', hoverStyle: { bg: '$hover', borderColor: STRONG }, focusVisibleStyle: FOCUS_RING, children: _jsx(MoreHorizontal, { size: 15, color: SOFT, "aria-hidden": true }) }) }), _jsxs(DropdownMenuContent, { minW: 250, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, "aria-labelledby": undefined, "aria-label": t('Account'), onCloseAutoFocus: back, children: [_jsxs(DropdownMenuSub, { open: account, onOpenChange: setAccount, children: [_jsxs(DropdownMenuSubTrigger, { minH: 44, gap: "$2.5", "data-slot": "me-account", children: [_jsx(Face, { host: host, size: 26 }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(SizableText, { size: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: who }), _jsx(SizableText, { size: "$1", color: "$soft", numberOfLines: 1, children: host.person.email || working })] })] }), account ? (_jsxs(DropdownMenuSubContent, { minW: 230, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(DropdownMenuItem, { onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), children: t('Profile') }) }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('personalization'), children: _jsx(Line, { icon: _jsx(Palette, { size: 16, "aria-hidden": true }), children: t('Personalization') }) }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: () => window.location.assign(site('/beta')), children: _jsx(Line, { icon: _jsx(FlaskConical, { size: 16, "aria-hidden": true }), children: t('Beta') }) })] })) : null] }), others.map((a) => {
|
|
272
|
+
const { title, line } = accountLabel(a);
|
|
273
|
+
return (_jsx(DropdownMenuItem, { "data-slot": "me-switch", onSelect: () => void signedIn.switchTo(a), children: _jsx(Line, { icon: _jsx(CircleUserRound, { size: 16, "aria-hidden": true }), sub: line || undefined, children: title }) }, a.sub));
|
|
274
|
+
}), _jsx(DropdownMenuItem, { "data-slot": "me-add", onSelect: () => void signedIn.add(), children: _jsx(Line, { icon: _jsx(UserPlus, { size: 16, "aria-hidden": true }), children: t('Add account') }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: orgsOpen, onOpenChange: setOrgsOpen, children: [_jsx(DropdownMenuSubTrigger, { "data-slot": "me-orgs", children: _jsx(Line, { icon: _jsx(Mark, { org: here ?? all[0] }), trail: _jsx(Check, { size: 16, "aria-label": t('Current') }), children: t('{org} · {plan}', { org: (here ? (here.personal ? t('Personal') : here.display) : currentOrg), plan: planName || t('No plan') }) }) }), orgsOpen ? (_jsxs(DropdownMenuSubContent, { minW: 250, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(DropdownMenuLabel, { children: t('Organizations') }), all.map((o) => (_jsx(DropdownMenuItem, { onSelect: () => o.name !== currentOrg && onOrg(o.name), children: _jsx(Line, { icon: _jsx(Mark, { org: o }), sub: [o.personal ? t('Personal') : said(o.role, t), planFor(o) || (isFree && o.personal ? t('Free') : '')].filter(Boolean).join(' - '), trail: o.name === currentOrg ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: o.display }) }, o.name))), _jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Plus, { size: 16, "aria-hidden": true }), children: t('Create organization') }) }), _jsx(DropdownMenuItem, { onSelect: () => out(site(settings('organization'))), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), children: t('Organization settings') }) }), where().team ? null : here && !here.personal ? (_jsx(DropdownMenuItem, { onSelect: () => out(`${ENTRY}&org=${encodeURIComponent(here.name)}`), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), trail: _jsx(ArrowUpRight, { size: 14, color: "var(--text-tertiary)", "aria-hidden": true }), children: t('Open in Hanzo Team') }) })) : (_jsx(DropdownMenuItem, { onSelect: () => setCreating(true), children: _jsx(Line, { icon: _jsx(Users, { size: 16, "aria-hidden": true }), children: t('Create a team') }) })), superAdmin() ? (_jsx(DropdownMenuItem, { onSelect: choose, children: _jsx(Line, { icon: _jsx(Building2, { size: 16, "aria-hidden": true }), children: t('All organizations') }) })) : null] })) : null] }), _jsx(DropdownMenuItem, { onSelect: () => goSettings('usage'), children: _jsx(Line, { icon: _jsx(Activity, { size: 16, "aria-hidden": true }), children: t('Usage') }) }), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+, Meta+,", onSelect: () => goSettings('account'), children: _jsx(Line, { icon: _jsx(Settings, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) }), children: t('Settings') }) }), _jsx(DropdownMenuItem, { onSelect: triggerUpgrade, children: _jsx(Line, { icon: _jsx(Sparkles, { size: 16, "aria-hidden": true }), children: t(plans) }) }), _jsx(DropdownMenuSeparator, {}), _jsxs(DropdownMenuSub, { open: lang, onOpenChange: (next) => {
|
|
275
|
+
setLang(next);
|
|
276
|
+
if (!next)
|
|
277
|
+
setLangQuery('');
|
|
278
|
+
}, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(Languages, { size: 16, "aria-hidden": true }), children: t('Language') }) }), lang ? (_jsxs(DropdownMenuSubContent, { minW: 220, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [_jsx(XStack, { px: "$2", pt: "$1.5", pb: "$1", children: _jsx(SizableText, { render: _jsx("input", { type: "search", value: langQuery, onChange: (e) => setLangQuery(e.target.value), onKeyDown: (e) => e.stopPropagation(), placeholder: t('Search language...'), "aria-label": t('Search language') }), width: "100%", height: 32, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: STRONG, bg: "$panel", color: "$ink", focusVisibleStyle: FOCUS_RING, size: "$2" }) }), _jsx(YStack, { maxH: 260, overflowY: "auto", children: locales
|
|
279
|
+
.filter((l) => !l.review || l.code === locale)
|
|
280
|
+
.filter((l) => {
|
|
281
|
+
const q = langQuery.trim().toLowerCase();
|
|
282
|
+
if (!q)
|
|
283
|
+
return true;
|
|
284
|
+
return (l.name.toLowerCase().includes(q) ||
|
|
285
|
+
l.englishName.toLowerCase().includes(q) ||
|
|
286
|
+
l.code.toLowerCase().includes(q));
|
|
287
|
+
})
|
|
288
|
+
.map((l) => (_jsx(DropdownMenuItem, { onSelect: () => void setLocale(l.code), children: _jsx(Line, { trail: l.code === locale ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null, children: l.englishName !== l.name ? `${l.name} (${l.englishName})` : l.name }) }, l.code))) })] })) : null] }), _jsxs(DropdownMenuSub, { open: help, onOpenChange: setHelp, children: [_jsx(DropdownMenuSubTrigger, { children: _jsx(Line, { icon: _jsx(LifeBuoy, { size: 16, "aria-hidden": true }), children: t('Help') }) }), help ? (_jsxs(DropdownMenuSubContent, { minW: 240, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, pointerEvents: "auto", children: [pages().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], trail: p.key === 'help' ? _jsx(ArrowUpRight, { size: 14, color: "var(--text-tertiary)", "aria-hidden": true }) : null, children: t(p.label) }) }, p.key))), _jsx(DropdownMenuItem, { "aria-keyshortcuts": "Control+/ Meta+/", onSelect: () => setKeys(true), children: _jsx(Line, { icon: _jsx(Keyboard, { size: 16, "aria-hidden": true }), trail: _jsx(DropdownMenuShortcut, { "aria-hidden": true, children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘/' : 'Ctrl+/' }) }), children: t('Keyboard shortcuts') }) }), _jsx(DropdownMenuSeparator, {}), legal().map((p) => (_jsx(DropdownMenuItem, { onSelect: () => out(p.href), children: _jsx(Line, { icon: ICONS[p.key], children: t(p.label) }) }, p.key)))] })) : null] }), several && signedIn.current ? (_jsx(DropdownMenuItem, { "data-slot": "me-leave", onSelect: () => void signedIn.leave(signedIn.current), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: t('Sign out {name}', { name: accountLabel(signedIn.current).title }) }) })) : null, host.signOut ? (_jsx(DropdownMenuItem, { onSelect: () => host.signOut?.(), children: _jsx(Line, { icon: _jsx(LogOut, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }), children: several ? t('Sign out of all accounts') : t('Log out') }) })) : null] })] })] }), _jsx(YStack, { "data-slot": "me-stats", role: "button", tabIndex: 0, "aria-label": t('Usage'), rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: STRONG, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, onPress: () => goSettings('usage'), onKeyDown: (e) => {
|
|
289
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
290
|
+
e.preventDefault?.();
|
|
291
|
+
goSettings('usage');
|
|
292
|
+
}
|
|
293
|
+
}, children: _jsx(Meter, { read: liveRead, onPlans: triggerUpgrade, onBilling: () => goSettings('billing') }) }), _jsxs(XStack, { "data-slot": "me-dev-row", items: "center", justify: "space-between", gap: "$2", minH: 40, "$max-sm": { minH: 44 }, px: "$2.5", py: "$2", rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, flex: 1, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, children: t('Developer mode') }), _jsx(InfoHint, { text: t('Show GitHub repositories, branches, terminals, and technical settings.') })] }), _jsx(Switch, { size: "sm", checked: devMode, onCheckedChange: setDevMode, "aria-label": t('Developer mode'), "data-slot": "me-dev-mode" })] }), _jsx(XStack, { height: 1, bg: "$edge", width: "100%" }), _jsxs(YStack, { gap: "$0.5", children: [isFree ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-upgrade", onClick: triggerUpgrade, items: "center", gap: "$2", minH: 36, "$max-sm": { minH: 44 }, px: "$2.5", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "$raised", borderWidth: 1, borderColor: STRONG, hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Sparkles, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, text: "start", children: t('Upgrade plan') })] })) : null, _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-settings", onClick: () => goSettings('account'), items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Settings, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", flex: 1, text: "start", children: t('Open settings') }), _jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$aside", children: _jsx("bdi", { dir: "ltr", children: apple ? '⌘,' : 'Ctrl+,' }) })] }), all.length > 1 ? (_jsxs(YStack, { gap: "$0.5", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-workspaces", "aria-expanded": workspacesOpen, onClick: () => setWorkspacesOpen((v) => !v), items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Building2, { size: 14, color: INK, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", flex: 1, text: "start", numberOfLines: 1, children: t('Switch workspace') }), workspacesOpen ? (_jsx(ChevronDown, { size: 13, color: SOFT, "aria-hidden": true })) : (_jsx(ChevronRight, { size: 13, color: SOFT, "aria-hidden": true }))] }), workspacesOpen ? (_jsx(YStack, { pl: "$4", gap: "$0.5", children: all.map((o) => (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
294
|
+
if (o.name !== currentOrg) {
|
|
295
|
+
setHoverOpen(false);
|
|
296
|
+
onOrg(o.name);
|
|
297
|
+
}
|
|
298
|
+
}, items: "center", gap: "$2", minH: 32, "$max-sm": { minH: 44 }, px: "$2", py: "$1", rounded: "$2", cursor: "pointer", bg: o.name === currentOrg ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Mark, { org: o }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", flex: 1, text: "start", numberOfLines: 1, children: o.personal ? t('Personal') : o.display }), o.name === currentOrg ? _jsx(Check, { size: 12, color: INK, "aria-hidden": true }) : null] }, o.name))) })) : null] })) : null, host.signOut ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "me-hover-logout", onClick: () => {
|
|
299
|
+
setHoverOpen(false);
|
|
300
|
+
host.signOut?.();
|
|
301
|
+
}, items: "center", gap: "$2", minH: 34, "$max-sm": { minH: 44 }, px: "$2", py: "$1.5", rounded: "$3", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(LogOut, { size: 14, color: SOFT, "aria-hidden": true, "data-i18n-mirror": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$aside", flex: 1, text: "start", children: t('Log out') })] })) : null] })] }) })] }), _jsx(Create, { open: creating, onOpenChange: setCreating }), _jsx(Shortcuts, { open: keys, onOpenChange: setKeys, apple: apple })] }));
|
|
302
|
+
}
|
|
303
|
+
/** Split a printed shortcut into discrete keycap tokens: `⌘⇧O` → `['⌘','⇧','O']`, `Ctrl+Shift+O` → `['Ctrl','Shift','O']`. */
|
|
304
|
+
function splitShortcut(combo) {
|
|
305
|
+
if (combo.includes('+'))
|
|
306
|
+
return combo.split('+').filter(Boolean);
|
|
307
|
+
const mods = [];
|
|
308
|
+
let rest = combo;
|
|
309
|
+
while (rest.length > 1 && /^[⌘⌃⌥⇧]/.test(rest)) {
|
|
310
|
+
mods.push(rest[0]);
|
|
311
|
+
rest = rest.slice(1);
|
|
312
|
+
}
|
|
313
|
+
return rest ? [...mods, rest] : mods;
|
|
323
314
|
}
|
|
324
|
-
|
|
325
|
-
|
|
315
|
+
const SHORTCUT_GROUPS = ['Navigation', 'Workspace', 'Chat', 'Window'];
|
|
316
|
+
/** The app's keys (help.ts `KEYS`), categorized with crisp `--border-strong` keycaps for this platform. */
|
|
317
|
+
export function Shortcuts({ open, onOpenChange, apple }) {
|
|
326
318
|
const { t } = useI18n();
|
|
327
|
-
|
|
319
|
+
const sections = useMemo(() => {
|
|
320
|
+
const byGroup = new Map();
|
|
321
|
+
for (const k of KEYS) {
|
|
322
|
+
const g = k.group ?? 'Navigation';
|
|
323
|
+
const list = byGroup.get(g);
|
|
324
|
+
if (list)
|
|
325
|
+
list.push(k);
|
|
326
|
+
else
|
|
327
|
+
byGroup.set(g, [k]);
|
|
328
|
+
}
|
|
329
|
+
return SHORTCUT_GROUPS.map((g) => ({ group: g, items: byGroup.get(g) ?? [] })).filter((s) => s.items.length > 0);
|
|
330
|
+
}, []);
|
|
331
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { "data-slot": "shortcuts-dialog", width: 480, maxW: "calc(100vw - 24px)", maxH: "82dvh", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$6", gap: "$3", overflow: "hidden", children: [_jsxs(YStack, { gap: "$1", shrink: 0, children: [_jsx(DialogTitle, { children: t('Keyboard shortcuts') }), _jsx(SizableText, { size: "$2", color: "$quiet", children: t('Global commands and conversation controls.') })] }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", gap: "$4", pr: "$1", children: sections.map((section) => (_jsxs(YStack, { gap: "$1", children: [_jsx(SizableText, { size: "$1", fontWeight: "600", color: "$quiet", pb: "$1", children: t(section.group) }), _jsx(YStack, { rounded: "$4", borderWidth: 1, borderColor: "$edge", bg: "$panel", overflow: "hidden", children: section.items.map((k, idx) => {
|
|
332
|
+
const caps = splitShortcut(apple ? k.mac : k.pc);
|
|
333
|
+
return (_jsxs(XStack, { items: "center", justify: "space-between", gap: "$3", px: "$3", minH: 38, "$max-sm": { minH: 44 }, borderTopWidth: idx === 0 ? 0 : 1, borderColor: "$edge", children: [_jsx(SizableText, { size: "$2", color: "$ink", flex: 1, minW: 0, numberOfLines: 1, children: t(k.does) }), _jsx(XStack, { items: "center", gap: "$1", shrink: 0, "data-i18n-ltr": "", children: _jsx("bdi", { dir: "ltr", children: _jsx(XStack, { items: "center", gap: "$1", children: caps.map((cap, ci) => (_jsx(Kbd, { variant: "cap", children: cap }, `${k.does}-${ci}`))) }) }) })] }, k.does));
|
|
334
|
+
}) })] }, section.group))) })] }) }));
|
|
328
335
|
}
|
|
329
336
|
/**
|
|
330
337
|
* The sheet that creates an organization: a name, then `POST /v1/account/orgs`,
|
|
331
|
-
* the creator's own.
|
|
332
|
-
* reloads in the new organization; `Made` says so if the new token does not carry
|
|
333
|
-
* it yet.
|
|
338
|
+
* the creator's own.
|
|
334
339
|
*/
|
|
335
340
|
function Create({ open, onOpenChange }) {
|
|
336
341
|
const { t } = useI18n();
|
|
@@ -360,9 +365,6 @@ function Create({ open, onOpenChange }) {
|
|
|
360
365
|
/* the next load simply says nothing */
|
|
361
366
|
}
|
|
362
367
|
renew();
|
|
363
|
-
// The app again, where the person is, in the new organization. Not `/`: on
|
|
364
|
-
// hanzo.ai that is the landing for everyone (owner, 2026-10-29), so a
|
|
365
|
-
// person who made an organization from /chat was left on the marketing page.
|
|
366
368
|
reopen(org);
|
|
367
369
|
}
|
|
368
370
|
catch (e) {
|
|
@@ -370,10 +372,10 @@ function Create({ open, onOpenChange }) {
|
|
|
370
372
|
setBusy(false);
|
|
371
373
|
}
|
|
372
374
|
};
|
|
373
|
-
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, {
|
|
375
|
+
return (_jsx(Dialog, { open: open, onOpenChange: onOpenChange, children: _jsxs(DialogContent, { width: 440, maxW: "calc(100vw - 24px)", bg: "var(--popover)", borderWidth: 1, borderColor: STRONG, rounded: "$6", gap: "$3", children: [_jsx(DialogTitle, { children: t('Create organization') }), _jsx(SizableText, { size: "$2", color: "$soft", children: t('You own it. Agents, credits and members belong to it, and you switch to it from this menu.') }), _jsx(Input, { autoFocus: true, value: name, onChangeText: setName, "aria-label": t('Organization name'), placeholder: t('Acme'), maxLength: 80, onKeyDown: (e) => {
|
|
374
376
|
if (e.key === 'Enter')
|
|
375
377
|
void submit();
|
|
376
|
-
} }), refused ? (_jsx(SizableText, { size: "$1", color: BAD, role: "alert", children: refused })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", rounded: 999, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsx(Button, { size: "sm", rounded: 999, disabled: busy || !name.trim(), onPress: () => void submit(), children: t(busy ? 'Creating…' : 'Create') })] })] }) }));
|
|
378
|
+
} }), refused ? (_jsx(SizableText, { size: "$1", color: BAD, role: "alert", children: refused })) : null, _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "outline", borderColor: STRONG, rounded: 999, onPress: () => onOpenChange(false), children: t('Cancel') }), _jsx(Button, { size: "sm", variant: "primary", tone: "accent", rounded: 999, disabled: busy || !name.trim(), onPress: () => void submit(), children: t(busy ? 'Creating…' : 'Create') })] })] }) }));
|
|
377
379
|
}
|
|
378
380
|
/**
|
|
379
381
|
* What became of an organization this tab created: nothing to say once the token
|
|
@@ -389,7 +391,6 @@ export function Made() {
|
|
|
389
391
|
return;
|
|
390
392
|
if (orgs().includes(kept.org))
|
|
391
393
|
return sessionStorage.removeItem(MADE);
|
|
392
|
-
// Still out of the token: go on working where the person was.
|
|
393
394
|
if (kept.from && current() !== kept.from && orgs().includes(kept.from)) {
|
|
394
395
|
return reopen(kept.from);
|
|
395
396
|
}
|
|
@@ -410,5 +411,5 @@ export function Made() {
|
|
|
410
411
|
}
|
|
411
412
|
setMade(null);
|
|
412
413
|
};
|
|
413
|
-
return (_jsxs(XStack, { "data-slot": "made", role: "status", items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$5", borderWidth: 1, borderColor:
|
|
414
|
+
return (_jsxs(XStack, { "data-slot": "made", role: "status", items: "flex-start", gap: "$2", px: "$3", py: "$2.5", rounded: "$5", borderWidth: 1, borderColor: STRONG, bg: "$panel", children: [_jsx(SizableText, { flex: 1, minW: 0, size: "$1", color: "$ink", children: t('{name} was created, and your sign-in does not include it yet, so you are still in this organization. It appears here once IAM adds you to it.', { name: made.name }) }), _jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-label": t('Dismiss'), onClick: dismiss, p: "$1", rounded: 999, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: _jsx(X, { size: 13, color: SOFT, "aria-hidden": true }) })] }));
|
|
414
415
|
}
|