@hanzo/app 0.3.94 → 0.3.95
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 +113 -47
- 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/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.js +210 -151
- 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 +1 -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.js +18 -13
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +6 -2
- package/dist/bots/kit.d.ts +1 -0
- package/dist/bots/kit.js +1 -1
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- 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/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 +6 -0
- package/dist/lib/todo.js +37 -25
- 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/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Gate.js
CHANGED
|
@@ -59,10 +59,54 @@ import { Header } from './Header.js';
|
|
|
59
59
|
import { site, where } from './where.js';
|
|
60
60
|
/** A template to set up once the organization is live. */
|
|
61
61
|
const SETUP = 'hanzo:org:template';
|
|
62
|
+
/** Query parameters that reference an entity inside one specific organization. */
|
|
63
|
+
const ORG_ENTITY_PARAMS = ['thread', 'session', 'channel', 'room', 'bucket'];
|
|
64
|
+
/**
|
|
65
|
+
* Context-preserving pathname when switching organizations: keeps safe workspace
|
|
66
|
+
* routes (`/chat`, `/dev`, `/settings/billing`, `/board`, etc.) intact instead of
|
|
67
|
+
* snapping back to `/`, while stepping up out of org-specific entity deep IDs.
|
|
68
|
+
*/
|
|
69
|
+
function preservedPath(pathname, search = '') {
|
|
70
|
+
const clean = pathname.replace(/\/+$/, '') || '/';
|
|
71
|
+
let next = clean;
|
|
72
|
+
if (clean.startsWith('/chat/') && clean !== '/chat/shared') {
|
|
73
|
+
next = '/chat';
|
|
74
|
+
}
|
|
75
|
+
else if (clean.startsWith('/dev/run/')) {
|
|
76
|
+
next = '/dev';
|
|
77
|
+
}
|
|
78
|
+
else if (clean.startsWith('/dev/projects/')) {
|
|
79
|
+
next = '/dev/projects';
|
|
80
|
+
}
|
|
81
|
+
else if (clean.startsWith('/dev/automations/') && clean !== '/dev/automations/new') {
|
|
82
|
+
next = '/dev/automations';
|
|
83
|
+
}
|
|
84
|
+
if (!search)
|
|
85
|
+
return next;
|
|
86
|
+
const params = new URLSearchParams(search);
|
|
87
|
+
for (const key of ORG_ENTITY_PARAMS)
|
|
88
|
+
params.delete(key);
|
|
89
|
+
const qs = params.toString();
|
|
90
|
+
return qs ? `${next}?${qs}` : next;
|
|
91
|
+
}
|
|
92
|
+
/** Keeps the reader's current pathname on org switch, normalizing only org-specific deep entity IDs. */
|
|
93
|
+
function preserveRouteOnOrgSwitch() {
|
|
94
|
+
if (typeof window === 'undefined')
|
|
95
|
+
return;
|
|
96
|
+
const currentAddress = `${window.location.pathname}${window.location.search}`;
|
|
97
|
+
const safe = preservedPath(window.location.pathname, window.location.search);
|
|
98
|
+
if (safe !== currentAddress) {
|
|
99
|
+
window.history.replaceState(null, '', safe);
|
|
100
|
+
if (typeof window.dispatchEvent === 'function') {
|
|
101
|
+
const ev = typeof PopStateEvent !== 'undefined' ? new PopStateEvent('popstate') : new Event('popstate');
|
|
102
|
+
window.dispatchEvent(ev);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
62
106
|
/** Checkout for a plan, coming back to this page. */
|
|
63
107
|
function checkout(plan) {
|
|
64
108
|
const origin = typeof window !== 'undefined' ? window.location.origin : 'https://hanzo.app';
|
|
65
|
-
const path = typeof window !== 'undefined' ? window.location.pathname : chat();
|
|
109
|
+
const path = typeof window !== 'undefined' ? preservedPath(window.location.pathname) : chat();
|
|
66
110
|
return checkoutUrl(plan.id, `${origin}${path}`);
|
|
67
111
|
}
|
|
68
112
|
/** Whether the current Chat navigation is an anonymous preview session. */
|
|
@@ -153,9 +197,11 @@ export function Gate({ children, front = false, forward, signup = false, }) {
|
|
|
153
197
|
return () => window.removeEventListener(CHOOSE, ask);
|
|
154
198
|
}, []);
|
|
155
199
|
const choose = useCallback((o) => {
|
|
200
|
+
if (current && o !== current)
|
|
201
|
+
preserveRouteOnOrgSwitch();
|
|
156
202
|
pick(o);
|
|
157
203
|
setChoosing(false);
|
|
158
|
-
}, []);
|
|
204
|
+
}, [current]);
|
|
159
205
|
// The organization a link arrives for. hanzo.ai opens the workspace at
|
|
160
206
|
// `?signin&org=<the org it is working in>` (Account.tsx); once signed in, an org
|
|
161
207
|
// the token's `orgs` names is chosen and the parameter leaves the address, the
|
|
@@ -403,7 +449,58 @@ function Create() {
|
|
|
403
449
|
const { t } = useI18n();
|
|
404
450
|
const [open, setOpen] = useState(false);
|
|
405
451
|
const [details, setDetails] = useState(false);
|
|
406
|
-
return (_jsxs(Page, { label: t('Organizations'), children: [_jsxs(Column, { children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: 16, flexWrap: "wrap", children: [_jsxs(YStack, { children: [_jsx(Text, { render: "h1", fontSize: "$10", fontWeight: "500", letterSpacing: -0.32, color: "var(--text-primary)", children: t('Organizations') }), _jsx(Text, { render: "p", mt: 6, fontSize: "$4", color: muted, children: t('You do not belong to one yet.') })] }), _jsxs(Button, { variant: "primary", size: "lg", onClick: () => setOpen(true), children: [_jsx(Plus, { size: 16, "aria-hidden": true }), t('New organization')] })] }), _jsx(Rule, {}), _jsxs(YStack, { items: "center", py: 28, children: [_jsx(Text, { render: "p", fontSize: "$6", fontWeight: "500", color: "var(--foreground)", text: "center", children: t('No organizations yet') }), _jsx(Button, { variant: "linkMuted", size: "sm", mt: 8, onClick: () => setDetails((d) => !d), children: t(details ? '- Details' : '+ Details') }), details ? (_jsx(Text, { render: "p", mt: 12, maxW: 440, fontSize: "$4", color: muted, lineHeight: 23.25, text: "center", children: t('An organization owns every agent, credit and member. Create one and you are its owner.') })) : null] }), _jsx(Rule, {})] }), open ? _jsx(CreateDialog, { onClose: () => setOpen(false) }) : null] }));
|
|
452
|
+
return (_jsxs(Page, { label: t('Organizations'), children: [_jsxs(Column, { children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: 16, flexWrap: "wrap", children: [_jsxs(YStack, { children: [_jsx(Text, { render: "h1", fontSize: "$10", fontWeight: "500", letterSpacing: -0.32, color: "var(--text-primary)", children: t('Organizations') }), _jsx(Text, { render: "p", mt: 6, fontSize: "$4", color: muted, children: t('You do not belong to one yet.') })] }), _jsxs(Button, { variant: "primary", size: "lg", onClick: () => setOpen(true), children: [_jsx(Plus, { size: 16, "aria-hidden": true }), t('New organization')] })] }), _jsx(Rule, {}), _jsxs(YStack, { items: "center", py: 28, children: [_jsx(Text, { render: "p", fontSize: "$6", fontWeight: "500", color: "var(--foreground)", text: "center", children: t('No organizations yet') }), _jsx(Button, { variant: "linkMuted", size: "sm", mt: 8, "aria-expanded": details, onClick: () => setDetails((d) => !d), children: t(details ? '- Details' : '+ Details') }), details ? (_jsx(Text, { render: "p", mt: 12, maxW: 440, fontSize: "$4", color: muted, lineHeight: 23.25, text: "center", children: t('An organization owns every agent, credit and member. Create one and you are its owner.') })) : null] }), _jsx(Rule, {})] }), open ? _jsx(CreateDialog, { onClose: () => setOpen(false) }) : null] }));
|
|
453
|
+
}
|
|
454
|
+
/** Monochrome custom dropdown selector — replaces native OS `<select>` menus cleanly. */
|
|
455
|
+
function MonoSelect({ value, options, onChange, label, slotName, }) {
|
|
456
|
+
const [open, setOpen] = useState(false);
|
|
457
|
+
const rootRef = useRef(null);
|
|
458
|
+
const triggerRef = useRef(null);
|
|
459
|
+
const close = useCallback((restoreFocus = false) => {
|
|
460
|
+
setOpen(false);
|
|
461
|
+
if (restoreFocus)
|
|
462
|
+
queueMicrotask(() => triggerRef.current?.focus?.());
|
|
463
|
+
}, []);
|
|
464
|
+
useEffect(() => {
|
|
465
|
+
if (!open || typeof document === 'undefined')
|
|
466
|
+
return;
|
|
467
|
+
const onPointerDown = (e) => {
|
|
468
|
+
if (rootRef.current?.contains(e.target))
|
|
469
|
+
return;
|
|
470
|
+
close(false);
|
|
471
|
+
};
|
|
472
|
+
const onKeyDown = (e) => {
|
|
473
|
+
if (e.key === 'Escape') {
|
|
474
|
+
e.preventDefault();
|
|
475
|
+
e.stopPropagation();
|
|
476
|
+
close(true);
|
|
477
|
+
}
|
|
478
|
+
};
|
|
479
|
+
document.addEventListener('pointerdown', onPointerDown, true);
|
|
480
|
+
document.addEventListener('keydown', onKeyDown, true);
|
|
481
|
+
return () => {
|
|
482
|
+
document.removeEventListener('pointerdown', onPointerDown, true);
|
|
483
|
+
document.removeEventListener('keydown', onKeyDown, true);
|
|
484
|
+
};
|
|
485
|
+
}, [open, close]);
|
|
486
|
+
const selected = options.find((o) => o.value === value) ?? options[0];
|
|
487
|
+
const display = selected ? (selected.meta ? `${selected.label} · ${selected.meta}` : selected.label) : '';
|
|
488
|
+
return (_jsxs(YStack, { ref: (node) => {
|
|
489
|
+
rootRef.current = node ?? null;
|
|
490
|
+
}, position: "relative", width: "100%", children: [_jsxs(XStack, { ref: (node) => {
|
|
491
|
+
triggerRef.current = node ?? null;
|
|
492
|
+
}, render: _jsx("button", { type: "button" }), "data-slot": slotName, "aria-haspopup": "listbox", "aria-expanded": open, "aria-label": label, onClick: () => setOpen((v) => !v), onKeyDown: (e) => {
|
|
493
|
+
if (e.key === 'ArrowDown' || e.key === 'ArrowUp') {
|
|
494
|
+
e.preventDefault?.();
|
|
495
|
+
setOpen(true);
|
|
496
|
+
}
|
|
497
|
+
}, width: "100%", minH: 44, px: 16, py: 12, rounded: 12, borderWidth: 1, borderColor: open ? 'var(--border-strong)' : 'var(--border)', bg: "var(--background)", items: "center", justify: "space-between", gap: 10, cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(Text, { fontSize: "$4", color: "var(--foreground)", numberOfLines: 1, flex: 1, minW: 0, text: "start", children: display }), _jsx(View, { shrink: 0, "$platform-web": { color: muted }, "aria-hidden": true, children: _jsx("svg", { width: 16, height: 16, viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: 2, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": true, children: _jsx("path", { d: "m6 9 6 6 6-6" }) }) })] }), open ? (_jsx(YStack, { role: 'listbox', "aria-label": label, "data-slot": `${slotName}-menu`, position: "absolute", t: "100%", mt: 6, l: 0, r: 0, z: "var(--z-popover)", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", rounded: 12, p: 6, gap: 2, maxH: 260, overflowY: "auto", children: options.map((opt) => {
|
|
498
|
+
const active = opt.value === value;
|
|
499
|
+
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), role: "option", "aria-selected": active, onClick: () => {
|
|
500
|
+
onChange(opt.value);
|
|
501
|
+
close(true);
|
|
502
|
+
}, width: "100%", minH: 40, "$max-sm": { minH: 44 }, px: 10, py: 8, rounded: 8, borderWidth: 1, borderColor: active ? 'var(--border-strong)' : 'transparent', bg: active ? '$panel' : 'transparent', items: "center", justify: "space-between", gap: 8, cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsxs(XStack, { items: "center", gap: 6, flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: active ? '600' : '400', color: "var(--foreground)", numberOfLines: 1, text: "start", children: opt.label }), opt.meta ? (_jsxs(Text, { fontSize: "$2", color: muted, numberOfLines: 1, shrink: 0, children: ["\u00B7 ", opt.meta] })) : null] }), active ? _jsx(Check, { size: 15, color: "var(--foreground)", "aria-hidden": true }) : null] }, opt.value || '__empty'));
|
|
503
|
+
}) })) : null] }));
|
|
407
504
|
}
|
|
408
505
|
/** Name it, pick what it runs and its plan: a paid plan goes to checkout, Free goes straight in. */
|
|
409
506
|
function CreateDialog({ onClose }) {
|
|
@@ -417,7 +514,11 @@ function CreateDialog({ onClose }) {
|
|
|
417
514
|
const chosen = ladder.find((p) => p.id === rung) ?? ladder.find((p) => !p.priceMonthly) ?? ladder[0] ?? null;
|
|
418
515
|
const personal = priced(chosen);
|
|
419
516
|
const [name, setName] = useState('');
|
|
420
|
-
const [kind, setKind] = useState('org');
|
|
517
|
+
const [kind, setKind] = useState(() => (alone ? 'personal' : 'org'));
|
|
518
|
+
useEffect(() => {
|
|
519
|
+
if (!alone && kind === 'personal')
|
|
520
|
+
setKind('org');
|
|
521
|
+
}, [alone, kind]);
|
|
421
522
|
// A team organization runs on the per-seat Team plan; a personal one on the
|
|
422
523
|
// rung chosen below, Free unless another is. Checkout sets the seats and the term.
|
|
423
524
|
const { plan, price } = kind === 'org' ? team : personal;
|
|
@@ -507,13 +608,20 @@ function CreateDialog({ onClose }) {
|
|
|
507
608
|
}
|
|
508
609
|
};
|
|
509
610
|
return (_jsx(YStack, { role: "dialog", "aria-modal": true, "aria-label": t('Create an organization'), position: "fixed", inset: 0, z: DIALOG, bg: shade(28), overflowY: "auto", py: "6vh", px: 16, onClick: onClose, children: _jsxs(YStack, { render: "form", onSubmit: submit, onClick: (e) => e.stopPropagation(), width: "100%", maxW: 640, mx: "auto", bg: "var(--background)", rounded: 16, boxShadow: `0 24px 64px ${shade(28)}`, pt: 28, px: 28, pb: 20, children: [_jsxs(XStack, { items: "flex-start", justify: "space-between", gap: 12, children: [_jsxs(YStack, { shrink: 1, minW: "auto", children: [_jsx(Text, { render: "h2", fontSize: "$8", fontWeight: "500", color: "var(--text-primary)", children: t('Create an organization') }), _jsx(Text, { render: "p", mt: 8, fontSize: "$4", color: muted, lineHeight: 22.5, children: t('You are its owner. Agents, credits and members all hang off it; you can switch between organizations from the rail.') })] }), _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", marginInlineEnd: -8, onClick: onClose, "aria-label": t('Close'), children: _jsx(X, { size: 16, "aria-hidden": true }) })] }), _jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, mt: 22, children: [_jsx(Text, { render: "legend", display: "block", fontSize: "$4", fontWeight: "500", mb: 10, color: "var(--foreground)", children: t('Plan') }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: 10, children: [
|
|
611
|
+
['personal', phrase('Personal'), phrase('Just you. Starts free and opens right away.'), personal],
|
|
510
612
|
['org', phrase('Organization'), phrase('A team. Invite members, share agents and credit.'), team],
|
|
511
|
-
['personal', phrase('Personal'), phrase('Just you. Named after your account.'), personal],
|
|
512
613
|
].filter(([k]) => alone || k === 'org').map(([k, label, hint, offer]) => (_jsxs(XStack, { render: "label", gap: 10, items: "flex-start", px: 14, py: 12, rounded: 12, borderWidth: 1, borderColor: kind === k ? 'var(--foreground)' : 'var(--border)', cursor: "pointer", children: [_jsx("input", { type: "radio", name: "kind", value: k, checked: kind === k, onChange: () => setKind(k) }), _jsxs(YStack, { shrink: 1, children: [_jsxs(Text, { fontSize: "$4", fontWeight: "500", color: "var(--foreground)", children: [t(label), offer.plan ? (_jsxs(Text, { color: muted, fontWeight: "400", children: [' ', "\u2014", ' ', offer.plan.priceMonthly
|
|
513
614
|
? offer.plan.pricePerUser
|
|
514
615
|
? t('{price} / seat / month', { price: offer.price })
|
|
515
616
|
: t('{price} / month', { price: offer.price })
|
|
516
|
-
: offer.plan.name] })) : null] }), _jsx(Text, { fontSize: "$3", color: muted, mt: 2, children: t(hint) })] })] }, k))) })] }), kind === 'personal' && ladder.length > 1 ? (_jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, mt: 20, children: [_jsx(Text, { render: "legend", display: "block", fontSize: "$4", fontWeight: "500", mb: 10, color: "var(--foreground)", children: t('Personal plan') }), _jsx(View, { display: "grid", gap: 8, children: ladder.map((p) => (_jsxs(XStack, { render: "label", gap: 10, items: "center", px: 14, py: 10, rounded: 12, borderWidth: 1, borderColor: chosen?.id === p.id ? 'var(--foreground)' : 'var(--border)', cursor: "pointer", children: [_jsx("input", { type: "radio", name: "rung", value: p.id, checked: chosen?.id === p.id, onChange: () => setRung(p.id) }), _jsx(Text, { fontSize: "$4", fontWeight: "500", color: "var(--foreground)", children: p.name }), p.priceMonthly ? (_jsx(Text, { marginInlineStart: "auto", fontSize: "$3", color: muted, children: t('{price} / month', { price: priced(p).price }) })) : null] }, p.id))) })] })) : null, kind === 'org' ? (_jsxs(View, { render: "label", display: "block", mt: 20, children: [_jsx(Text, { display: "block", fontSize: "$4", fontWeight: "500", mb: 8, color: "var(--foreground)", children: t('Name') }), _jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "Acme", autoFocus: true }), ...FIELD }), _jsx(Text, { display: "block", fontSize: "$3", color: muted, mt: 8, children: t('What the rail and every invoice call it.') })] })) : null, templates.length > 0 ? (_jsxs(View, {
|
|
617
|
+
: offer.plan.name] })) : null] }), _jsx(Text, { fontSize: "$3", color: muted, mt: 2, children: t(hint) })] })] }, k))) })] }), kind === 'personal' && ladder.length > 1 ? (_jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, mt: 20, children: [_jsx(Text, { render: "legend", display: "block", fontSize: "$4", fontWeight: "500", mb: 10, color: "var(--foreground)", children: t('Personal plan') }), _jsx(View, { display: "grid", gap: 8, children: ladder.map((p) => (_jsxs(XStack, { render: "label", gap: 10, items: "center", px: 14, py: 10, rounded: 12, borderWidth: 1, borderColor: chosen?.id === p.id ? 'var(--foreground)' : 'var(--border)', cursor: "pointer", children: [_jsx("input", { type: "radio", name: "rung", value: p.id, checked: chosen?.id === p.id, onChange: () => setRung(p.id) }), _jsx(Text, { fontSize: "$4", fontWeight: "500", color: "var(--foreground)", children: p.name }), p.priceMonthly ? (_jsx(Text, { marginInlineStart: "auto", fontSize: "$3", color: muted, children: t('{price} / month', { price: priced(p).price }) })) : null] }, p.id))) })] })) : null, kind === 'org' ? (_jsxs(View, { render: "label", display: "block", mt: 20, children: [_jsx(Text, { display: "block", fontSize: "$4", fontWeight: "500", mb: 8, color: "var(--foreground)", children: t('Name') }), _jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), placeholder: "Acme", autoFocus: true }), ...FIELD }), _jsx(Text, { display: "block", fontSize: "$3", color: muted, mt: 8, children: t('What the rail and every invoice call it.') })] })) : null, templates.length > 0 ? (_jsxs(View, { display: "block", mt: 20, children: [_jsx(Text, { display: "block", fontSize: "$4", fontWeight: "500", mb: 8, color: "var(--foreground)", children: t('Template') }), _jsx(MonoSelect, { slotName: "create-template-select", label: t('Template'), value: template, onChange: setTemplate, options: [
|
|
618
|
+
{ value: '', label: t('None — start empty') },
|
|
619
|
+
...templates.map((row) => ({
|
|
620
|
+
value: row.slug,
|
|
621
|
+
label: row.title || row.name || row.slug,
|
|
622
|
+
meta: row.category,
|
|
623
|
+
})),
|
|
624
|
+
] }), _jsx(Text, { display: "block", fontSize: "$3", color: muted, mt: 8, children: t('What it runs, set up as soon as the organization opens. Choose none to start empty.') })] })) : null, plan && !paid ? (_jsx(Text, { render: "p", mt: 22, fontSize: "$4", color: muted, lineHeight: 23.25, children: t('A personal organization starts on {plan} and opens as soon as it is made. Choose a paid plan above to go to checkout instead.', { plan: plan.name }) })) : plan ? (_jsxs(Text, { render: "p", mt: 22, fontSize: "$4", color: muted, lineHeight: 23.25, children: [plan.pricePerUser
|
|
517
625
|
? t('A team organization runs on {plan} at {price} per seat a month, at least {seats} seats.', { plan: plan.name, price, seats: Number(plan.limits?.minSeats ?? 1) })
|
|
518
626
|
: t('A personal organization runs on {plan} at {price} a month.', { plan: plan.name, price }), ' ', t('Nothing in it works until that plan is live, so creating one takes you straight to checkout, where you choose the seats and the term.'), ' ', t('Each plan includes session and daily usage limits; usage never draws your credit balance.'), ' ', t("Payment is on the provider's hosted page.")] })) : null, refused ? (_jsx(Text, { render: "p", role: "alert", mt: 14, fontSize: "$3", color: "var(--foreground)", children: refused })) : null, _jsxs(XStack, { justify: "flex-end", gap: 10, mt: 24, flexWrap: "wrap", children: [_jsx(Button, { type: "button", size: "lg", onClick: onClose, children: t('Cancel') }), _jsx(Button, { type: "submit", variant: "primary", size: "lg", shrink: 1, py: "$2", disabled: !plan || busy, children: _jsx(Text, { fontFamily: "$body", fontSize: "$3", color: "inherit", text: "center", children: busy
|
|
519
627
|
? t('Creating…')
|
|
@@ -523,6 +631,23 @@ function CreateDialog({ onClose }) {
|
|
|
523
631
|
: t('Create and subscribe — {price} / month', { price })
|
|
524
632
|
: t('Create') }) })] }), _jsx(Rule, { mt: 18, mb: 8 }), _jsx(Text, { render: "p", text: "end", fontSize: "$2", color: muted, fontFamily: "$mono", children: t('Esc to close') })] }) }));
|
|
525
633
|
}
|
|
634
|
+
/** Workspace type (`Personal` vs `Team`) read off the org record when present. */
|
|
635
|
+
function workspaceKind(rec) {
|
|
636
|
+
if (!rec)
|
|
637
|
+
return undefined;
|
|
638
|
+
if (rec.isPersonal === true || rec.type === 'personal')
|
|
639
|
+
return 'personal';
|
|
640
|
+
if (rec.isPersonal === false || rec.type === 'team' || rec.type === 'organization')
|
|
641
|
+
return 'team';
|
|
642
|
+
return undefined;
|
|
643
|
+
}
|
|
644
|
+
/** Plan label read off an org record when billing has not answered separately. */
|
|
645
|
+
function recordPlan(rec) {
|
|
646
|
+
const raw = rec?.plan || rec?.tier;
|
|
647
|
+
if (!raw)
|
|
648
|
+
return undefined;
|
|
649
|
+
return spoken(label(raw)) || raw;
|
|
650
|
+
}
|
|
526
651
|
/**
|
|
527
652
|
* A page of IAM's organization list (`GET /v1/iam/organizations`): the reader's
|
|
528
653
|
* own organizations whole on the first page, then, for a SuperAdmin only, every
|
|
@@ -591,10 +716,10 @@ function Mark({ org }) {
|
|
|
591
716
|
const emoji = org.mark?.avatar ? '' : org.mark?.emoji;
|
|
592
717
|
return (_jsx(Avatar, { size: "xl", shape: "rounded", src: org.mark?.avatar || (emoji ? null : org.mark?.logo) || null, name: org.display, colorSeed: org.name, icon: emoji ? _jsx(Text, { fontSize: "$7", children: emoji }) : undefined, alt: "" }));
|
|
593
718
|
}
|
|
594
|
-
/** One organization: its mark,
|
|
719
|
+
/** One organization: its mark, name and slug, workspace type, reader's role, and plan; the current one checked. */
|
|
595
720
|
function Choice({ org, current = false, note, disabled, onPress }) {
|
|
596
721
|
const { t } = useI18n();
|
|
597
|
-
return (_jsx(View, { render: "li", display: "block", children: _jsxs(XStack, { render: "button", onClick: onPress, disabled: disabled, "aria-current": current || undefined, width: "100%", items: "center", gap: 12, px: 12, py: 10, rounded: 12, borderWidth: 1, borderColor: current ? '
|
|
722
|
+
return (_jsx(View, { render: "li", display: "block", children: _jsxs(XStack, { render: _jsx("button", { type: "button", disabled: disabled }), onClick: onPress, disabled: disabled, "aria-current": current || undefined, width: "100%", minH: 44, items: "center", gap: 12, px: 12, py: 10, rounded: 12, borderWidth: 1, borderColor: current ? 'var(--border-strong)' : '$edge', bg: current ? '$panel' : 'transparent', cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, children: [_jsx(Mark, { org: org }), _jsxs(YStack, { flex: 1, minW: 0, gap: 4, children: [_jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$ink", numberOfLines: 1, text: "start", children: org.display }), _jsxs(XStack, { items: "center", gap: 6, flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$2", fontFamily: "$mono", color: "$soft", numberOfLines: 1, 'data-i18n-ltr': '', children: org.name }), org.kind ? (_jsx(Tag, { variant: "outline", color: "gray", "data-slot": "org-kind-badge", children: org.kind === 'personal' ? t('Personal') : t('Team') })) : null, org.role ? (_jsx(Tag, { variant: "outline", color: "gray", "data-slot": "org-role-badge", children: said(org.role, t) })) : null, org.plan ? (_jsx(Tag, { variant: "soft", color: "gray", weight: "medium", "data-slot": "org-plan-badge", children: org.plan })) : null, note ? (_jsx(Text, { fontSize: "$2", color: "$soft", children: note })) : null] })] }), current ? _jsx(Check, { size: 16, "aria-label": t('Current') }) : null] }) }));
|
|
598
723
|
}
|
|
599
724
|
/**
|
|
600
725
|
* WHICH ORGANIZATION, THIS TIME — and, for a SuperAdmin, any organization.
|
|
@@ -621,7 +746,8 @@ function Pick({ members, current, onPick, onClose, }) {
|
|
|
621
746
|
display: marks[name]?.displayName || name,
|
|
622
747
|
mark: marks[name],
|
|
623
748
|
role: role(name) ?? '',
|
|
624
|
-
plan: plans[name],
|
|
749
|
+
plan: plans[name] || recordPlan(marks[name]),
|
|
750
|
+
kind: workspaceKind(marks[name]),
|
|
625
751
|
}));
|
|
626
752
|
const shown = mine.filter((o) => matches(o, q));
|
|
627
753
|
useEffect(() => {
|
|
@@ -690,13 +816,20 @@ function Everyone({ q, skip }) {
|
|
|
690
816
|
const enter = (org) => {
|
|
691
817
|
setStepping(org);
|
|
692
818
|
setRefused(null);
|
|
819
|
+
preserveRouteOnOrgSwitch();
|
|
693
820
|
support(org).catch((e) => {
|
|
694
821
|
setRefused(e instanceof Error ? e.message : t('IAM did not step in.'));
|
|
695
822
|
setStepping(null);
|
|
696
823
|
});
|
|
697
824
|
};
|
|
698
825
|
const others = rows.filter((o) => !skip.includes(o.name));
|
|
699
|
-
return (_jsxs(YStack, { render: "section", "aria-label": t('All organizations'), mt: 36, children: [_jsx(Text, { render: "h2", fontSize: "$6", fontWeight: "500", color: "$ink", children: t('All organizations') }), _jsx(Text, { render: "p", mt: 4, fontSize: "$3", color: "$soft", lineHeight: 21, children: t('Support mode. Step into any organization to see it as it does; IAM records every step under your name.') }), _jsx(YStack, { render: "ul", "aria-label": t('Every organization'), m: 0, p: 0, mt: 14, gap: 8, children: others.map((o) => (_jsx(Choice, { org: {
|
|
826
|
+
return (_jsxs(YStack, { render: "section", "aria-label": t('All organizations'), mt: 36, children: [_jsx(Text, { render: "h2", fontSize: "$6", fontWeight: "500", color: "$ink", children: t('All organizations') }), _jsx(Text, { render: "p", mt: 4, fontSize: "$3", color: "$soft", lineHeight: 21, children: t('Support mode. Step into any organization to see it as it does; IAM records every step under your name.') }), _jsx(YStack, { render: "ul", "aria-label": t('Every organization'), m: 0, p: 0, mt: 14, gap: 8, children: others.map((o) => (_jsx(Choice, { org: {
|
|
827
|
+
name: o.name,
|
|
828
|
+
display: o.displayName || o.name,
|
|
829
|
+
mark: o,
|
|
830
|
+
kind: workspaceKind(o),
|
|
831
|
+
plan: recordPlan(o),
|
|
832
|
+
}, note: stepping === o.name ? t('Stepping in…') : undefined, disabled: stepping !== null, onPress: () => enter(o.name) }, o.name))) }), !loading && others.length === 0 && !refused ? (_jsx(Text, { render: "p", mt: 8, fontSize: "$3", color: "$soft", children: t('No organization matches.') })) : null, refused ? (_jsx(Text, { render: "p", role: "alert", mt: 8, fontSize: "$3", color: BAD, children: refused })) : null, cursor ? (_jsx(Button, { self: "flex-start", mt: 10, onClick: () => void load(q, cursor), disabled: loading, children: t(loading ? 'Loading…' : 'More') })) : null] }));
|
|
700
833
|
}
|
|
701
834
|
/**
|
|
702
835
|
* FOUND AN ORGANIZATION: its name, then the slug IAM keys it by.
|
|
@@ -754,6 +887,7 @@ function Found({ onClose }) {
|
|
|
754
887
|
throw new Error(t('{org} is made, and it is still called {org}: {reason}', { org: made, reason: say(err, t) }));
|
|
755
888
|
});
|
|
756
889
|
}
|
|
890
|
+
preserveRouteOnOrgSwitch();
|
|
757
891
|
reopen(made);
|
|
758
892
|
}
|
|
759
893
|
catch (err) {
|
|
@@ -878,8 +1012,17 @@ function Start({ founded = null, onFounded, first, members = [], onSwitch, }) {
|
|
|
878
1012
|
})) : (_jsxs(_Fragment, { children: [email, ' ', _jsx(Text, { role: "alert", color: BAD, children: s.refused })] })) }) }, s.email));
|
|
879
1013
|
}) })) : null, _jsx(XStack, { gap: 10, flexWrap: "wrap", mt: 24, children: sent.length ? (_jsx(Button, { type: "button", variant: "primary", size: "lg", onClick: () => setStep('plan'), children: t('Continue') })) : (_jsxs(_Fragment, { children: [_jsx(Button, { type: "submit", variant: "primary", size: "lg", disabled: busy, children: busy ? t('Inviting…') : emails.trim() ? t('Invite and continue') : t('Continue') }), _jsx(Button, { type: "button", size: "lg", onClick: () => setStep('plan'), children: t('Skip for now') })] })) })] })) }) }));
|
|
880
1014
|
}
|
|
881
|
-
/** Where a checkout from the setup returns: Home
|
|
882
|
-
const home = () =>
|
|
1015
|
+
/** Where a checkout from the setup returns: Home during initial `/start`, or the preserved pathname otherwise. */
|
|
1016
|
+
const home = (setup = true) => {
|
|
1017
|
+
if (typeof window === 'undefined')
|
|
1018
|
+
return '';
|
|
1019
|
+
if (!setup) {
|
|
1020
|
+
const path = preservedPath(window.location.pathname);
|
|
1021
|
+
if (path && path !== '/start' && path !== '/login')
|
|
1022
|
+
return `${window.location.origin}${path}`;
|
|
1023
|
+
}
|
|
1024
|
+
return `${window.location.origin}${where().home}`;
|
|
1025
|
+
};
|
|
883
1026
|
/**
|
|
884
1027
|
* THE PLAN: how many seats, billed monthly or annually, then checkout.
|
|
885
1028
|
*
|
|
@@ -919,5 +1062,5 @@ function Plan({ org, members, onSwitch, outage, onRetry, seats: wanted = 1, setu
|
|
|
919
1062
|
? t('A team runs on the {plan} plan, and nothing in it works until that plan is live.', { plan: plan.name })
|
|
920
1063
|
: t('Its plan is not live yet.') }), outage && onRetry ? (_jsx(XStack, { mt: 16, children: _jsx(Button, { size: "lg", onClick: onRetry, children: t('Try again') }) })) : null, _jsx(Rule, {}), plan ? (_jsxs(_Fragment, { children: [_jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, children: [_jsx(Text, { render: "legend", display: "block", p: 0, fontSize: "$4", fontWeight: "500", mb: 10, color: "$ink", children: t('Seats') }), _jsxs(XStack, { items: "center", gap: 10, children: [_jsx(Button, { type: "button", size: "icon", "aria-label": t('One seat fewer'), disabled: seats <= floor, onClick: () => setSeats(Math.max(floor, seats - 1)), children: _jsx(Minus, { size: 16, "aria-hidden": true }) }), _jsx(Text, { render: _jsx("input", { "aria-label": t('Seats'), type: "number", inputMode: "numeric", min: floor, value: seats, onChange: (e) => setSeats(Math.max(floor, Math.floor(Number(e.target.value) || floor))) }), ...FIELD, width: 80, height: 36, py: 0, fontSize: "$4", rounded: "$3", text: "center" }), _jsx(Button, { type: "button", size: "icon", "aria-label": t('One seat more'), onClick: () => setSeats(seats + 1), children: _jsx(Plus, { size: 16, "aria-hidden": true }) })] }), _jsx(Text, { display: "block", fontSize: "$3", color: "$soft", mt: 8, children: floor === 1
|
|
921
1064
|
? t('At least 1 seat. Each person in the team takes one.')
|
|
922
|
-
: t('At least {seats} seats. Each person in the team takes one.', { seats: floor }) })] }), _jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, mt: 24, children: [_jsx(Text, { render: "legend", display: "block", p: 0, fontSize: "$4", fontWeight: "500", mb: 10, color: "$ink", children: t('Billing') }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: 10, children: terms.map(([value, label, price]) => (_jsxs(XStack, { render: "label", gap: 10, items: "flex-start", px: 14, py: 12, rounded: "$3", borderWidth: 1, borderColor: term === value ? '$ink' : '$edge', cursor: "pointer", children: [_jsx("input", { type: "radio", name: "term", value: value, checked: term === value, onChange: () => setTerm(value) }), _jsxs(YStack, { shrink: 1, children: [_jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$ink", children: label }), _jsx(Text, { fontSize: "$3", color: "$soft", mt: 2, children: price })] })] }, value))) })] }), _jsxs(Text, { render: "p", mt: 22, fontSize: "$4", color: "$soft", lineHeight: 23.25, children: [sum, " ", t("Payment is on the provider's hosted page.")] })] })) : null, _jsxs(XStack, { gap: 10, flexWrap: "wrap", mt: 24, children: [plan ? (_jsx(Button, { asChild: true, variant: "primary", size: "lg", children: _jsx("a", { href: cartUrl(plan.id, seats, term, org, home()), children: t('Continue to checkout') }) })) : null, members.length > 1 && onSwitch ? (_jsx(Button, { size: "lg", onClick: onSwitch, children: t('Switch organization') })) : null] })] }) }));
|
|
1065
|
+
: t('At least {seats} seats. Each person in the team takes one.', { seats: floor }) })] }), _jsxs(View, { render: "fieldset", display: "block", borderWidth: 0, p: 0, m: 0, mt: 24, children: [_jsx(Text, { render: "legend", display: "block", p: 0, fontSize: "$4", fontWeight: "500", mb: 10, color: "$ink", children: t('Billing') }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fit, minmax(220px, 1fr))", gap: 10, children: terms.map(([value, label, price]) => (_jsxs(XStack, { render: "label", gap: 10, items: "flex-start", px: 14, py: 12, rounded: "$3", borderWidth: 1, borderColor: term === value ? '$ink' : '$edge', cursor: "pointer", children: [_jsx("input", { type: "radio", name: "term", value: value, checked: term === value, onChange: () => setTerm(value) }), _jsxs(YStack, { shrink: 1, children: [_jsx(Text, { fontSize: "$4", fontWeight: "500", color: "$ink", children: label }), _jsx(Text, { fontSize: "$3", color: "$soft", mt: 2, children: price })] })] }, value))) })] }), _jsxs(Text, { render: "p", mt: 22, fontSize: "$4", color: "$soft", lineHeight: 23.25, children: [sum, " ", t("Payment is on the provider's hosted page.")] })] })) : null, _jsxs(XStack, { gap: 10, flexWrap: "wrap", mt: 24, children: [plan ? (_jsx(Button, { asChild: true, variant: "primary", size: "lg", children: _jsx("a", { href: cartUrl(plan.id, seats, term, org, home(setup)), children: t('Continue to checkout') }) })) : null, members.length > 1 && onSwitch ? (_jsx(Button, { size: "lg", onClick: onSwitch, children: t('Switch organization') })) : null] })] }) }));
|
|
923
1066
|
}
|
package/dist/Home.js
CHANGED
|
@@ -12,7 +12,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
12
12
|
// its ModelSelector, attachment control or mode chips" — so the source chips go
|
|
13
13
|
// THERE and the package needs no change to carry them. The four options above
|
|
14
14
|
// it are this surface's, for the same reason: a home decides what it starts.
|
|
15
|
-
import { dev } from './lib/host.js';
|
|
15
|
+
import { dev, go, talk } from './lib/host.js';
|
|
16
16
|
import { phrase } from '@hanzo/i18n';
|
|
17
17
|
import { useI18n } from '@hanzo/i18n/react';
|
|
18
18
|
import { useEffect, useMemo, useState } from 'react';
|
|
@@ -20,10 +20,8 @@ import { AtSign, Blocks, Bot, FolderGit2, Hash, Plus, UserPlus } from 'lucide-re
|
|
|
20
20
|
import { useAgents, usePeople, useSessions, useThreads } from '@hanzo/ai/react';
|
|
21
21
|
import { Composer } from '@hanzo/ui/chat';
|
|
22
22
|
import { MARKS } from '@hanzo/build';
|
|
23
|
-
import {
|
|
24
|
-
import { Box, Text, XStack, YStack } from '@hanzo/ui';
|
|
23
|
+
import { Box, Text, View, XStack, YStack } from '@hanzo/ui';
|
|
25
24
|
import { tap } from './lib/tap.js';
|
|
26
|
-
import { Grid } from '@hanzo/ui/grid';
|
|
27
25
|
import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
28
26
|
import { hasSession } from './lib/session.js';
|
|
29
27
|
import { useAi } from './lib/ai.js';
|
|
@@ -34,12 +32,16 @@ import { failed } from './failed.js';
|
|
|
34
32
|
import { watch } from './watch.js';
|
|
35
33
|
import { Directory } from './Directory.js';
|
|
36
34
|
import { Bar } from './progress.js';
|
|
37
|
-
import {
|
|
35
|
+
import { Go, INK, Quiet, Row, SOFT, CHOSEN } from './card.js';
|
|
38
36
|
import { Talk } from './Talk.js';
|
|
39
37
|
import { useMe } from './roster.js';
|
|
40
38
|
import { fromKey, teamKey, useChannels } from './channels.js';
|
|
41
39
|
import { invite, apps, projects } from './lib/home.js';
|
|
42
40
|
import { BAD } from './lib/mix.js';
|
|
41
|
+
import { useDevMode } from './lib/dev-mode.js';
|
|
42
|
+
function HomeCard({ kind, icon, title, action, children, }) {
|
|
43
|
+
return (_jsxs(YStack, { "data-card": kind, gap: "$3", p: "$4", borderWidth: 1, borderColor: "$edge", rounded: "$5", bg: "var(--surface-card)", minW: 0, transition: "quickest", hoverStyle: { bg: 'var(--surface-card-emphasis)', borderColor: 'var(--border-strong)' }, children: [_jsxs(XStack, { items: "center", gap: "$2.5", children: [_jsx(View, { width: 28, height: 28, rounded: "$3", bg: "$raised", display: "flex", items: "center", justify: "center", shrink: 0, children: _jsx(Text, { display: "flex", items: "center", justify: "center", color: "var(--foreground)", children: icon }) }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: INK, flex: 1, minW: 0, numberOfLines: 1, children: title }), action] }), children] }));
|
|
44
|
+
}
|
|
43
45
|
/** What a question can start here. Four, in the order they escalate. */
|
|
44
46
|
const MODES = [
|
|
45
47
|
{ id: 'chat', label: phrase('Chat'), asks: phrase('Ask anything') },
|
|
@@ -65,13 +67,10 @@ const GROUNDS = (mode) => mode === 'news' || mode === 'research';
|
|
|
65
67
|
*/
|
|
66
68
|
export function Home({ ask }) {
|
|
67
69
|
const { t } = useI18n();
|
|
70
|
+
const [devMode] = useDevMode();
|
|
68
71
|
const [mode, setMode] = useState('chat');
|
|
69
72
|
const [draft, setDraft] = useState('');
|
|
70
73
|
const [picked, setPicked] = useState([]);
|
|
71
|
-
// Connecting an app happens in the Directory, so the home mounts the
|
|
72
|
-
// Directory rather than linking somewhere that is not it. It is a Dialog —
|
|
73
|
-
// closed, it draws nothing — so a second instance beside the shell's costs a
|
|
74
|
-
// component and no pixels, and there is still ONE directory in the codebase.
|
|
75
74
|
const [directory, setDirectory] = useState(false);
|
|
76
75
|
const { channel, openChannel } = useOpen();
|
|
77
76
|
const held = useChannels();
|
|
@@ -90,16 +89,19 @@ export function Home({ ask }) {
|
|
|
90
89
|
ask(question, mode, hints);
|
|
91
90
|
return;
|
|
92
91
|
}
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
92
|
+
if (mode === 'dev') {
|
|
93
|
+
const target = dev();
|
|
94
|
+
const sep = target.includes('?') ? '&' : '?';
|
|
95
|
+
window.location.href = `${target}${sep}q=${encodeURIComponent(question)}`;
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
96
98
|
const q = hints.length ? `${question} ${hints.map((s) => `@${s}`).join(' ')}` : question;
|
|
97
99
|
window.location.href = `/chat?q=${encodeURIComponent(q)}`;
|
|
98
100
|
};
|
|
99
|
-
return (_jsxs(YStack, { "data-home": true, flex: 1, minH: 0, width: "100%", overflowY: "auto", overflowX: "hidden", children: [_jsxs(YStack, { width: "100%", maxW:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
101
|
+
return (_jsxs(YStack, { "data-home": true, flex: 1, minH: 0, width: "100%", overflowY: "auto", overflowX: "hidden", children: [_jsxs(YStack, { width: "100%", maxW: 680, mx: "auto", px: "$4", pt: "$8", gap: "$4", $sm: { pt: '$9' }, "$max-sm": { px: '$3', pt: '$6', gap: '$4' }, children: [_jsx(Text, { render: "h1", m: 0, fontSize: "$8", lineHeight: "$8", fontWeight: "600", letterSpacing: -0.5, color: INK, text: "center", children: t('What are we building?') }), _jsxs(YStack, { width: "100%", gap: "$2.5", children: [_jsx(XStack, { justify: "center", children: _jsx(XStack, { items: "center", gap: "$1", p: 4, rounded: "$10", bg: "var(--surface-card)", borderWidth: 1, borderColor: "var(--border-strong)", flexWrap: "wrap", children: MODES.map((one) => (_jsx(Box, { "data-tab": one.id, render: _jsx("button", { type: "button" }), onClick: () => setMode(one.id), "aria-current": mode === one.id, display: "inline-flex", items: "center", justify: "center", minH: 32, "$max-sm": { minH: 40 }, px: "$3.5", py: "$1.5", rounded: "$10", borderWidth: 0, bg: mode === one.id ? CHOSEN : 'transparent', hoverStyle: { bg: mode === one.id ? CHOSEN : '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, cursor: "pointer", transition: "quickest", children: _jsx(Text, { fontSize: "$2", fontWeight: mode === one.id ? '600' : '500', color: mode === one.id ? INK : SOFT, children: t(one.label) }) }, one.id))) }) }), _jsx(YStack, { "data-slot": "home-composer", width: "100%", rounded: 17, borderWidth: 1, borderColor: "var(--border-strong)", bg: "var(--surface-card)", hoverStyle: { borderColor: 'var(--border-focus)' }, children: _jsx(Composer, { value: draft, onChange: setDraft, onSend: send, placeholder: t(here.asks), label: t(here.asks), rows: 2, maxHeight: 240, children: grounded && devMode ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", shrink: 1, minW: 0, children: SOURCES.map((s) => {
|
|
102
|
+
const on = picked.includes(s);
|
|
103
|
+
return (_jsx(Box, { "data-chip": s, render: _jsx("button", { type: "button" }), "aria-pressed": on, onClick: () => setPicked((held) => (on ? held.filter((h) => h !== s) : [...held, s])), display: "inline-flex", items: "center", justify: "center", px: "$2", py: "$1", "$max-sm": { minH: 36, px: '$2.5' }, rounded: "$10", borderWidth: 0, cursor: "pointer", bg: on ? CHOSEN : 'transparent', hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsxs(Text, { "data-i18n-ltr": true, fontSize: "$2", color: on ? INK : SOFT, children: ["@", s] }) }, s));
|
|
104
|
+
}) })) : null }) })] })] }), _jsx(YStack, { width: "100%", maxW: 960, mx: "auto", px: "$4", pt: "$7", pb: "$8", gap: "$5", "$max-sm": { px: '$3', pt: '$5', pb: '$6' }, children: _jsxs(View, { "data-slot": "home-cards", display: "grid", gridTemplateColumns: "repeat(3, minmax(0, 1fr))", gap: 16, "$max-lg": { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))' }, "$max-md": { gridTemplateColumns: 'repeat(2, minmax(0, 1fr))', gap: 12 }, "$max-sm": { gridTemplateColumns: 'minmax(0, 1fr)', gap: 12 }, children: [_jsx(Channels, { ...held }), _jsx(Projects, {}), _jsx(Chats, {}), _jsx(Next, { onConnect: () => setDirectory(true) }), _jsx(Apps, { onConnect: () => setDirectory(true) }), _jsx(Team, {})] }) }), _jsx(Directory, { open: directory, onClose: () => setDirectory(false) })] }));
|
|
103
105
|
}
|
|
104
106
|
/**
|
|
105
107
|
* The open channel, in place of the question and the cards.
|
|
@@ -123,7 +125,7 @@ function Open({ at, channels, back, }) {
|
|
|
123
125
|
: channels.wrong
|
|
124
126
|
? say(channels.wrong, t('this channel'), 'read', t)
|
|
125
127
|
: t('That channel is not here.');
|
|
126
|
-
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center",
|
|
128
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", px: "$6", pt: "$6", pb: "$12", "$max-sm": { px: '$4', pb: '$8' }, gap: "$4", children: [_jsx(Text, { fontSize: "$3", color: SOFT, text: "center", maxW: 460, lineHeight: "$4", children: line }), reading ? null : (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: back, ...tap, display: "inline-flex", items: "center", justify: "center", minH: 36, "$max-sm": { minH: 44 }, px: "$3.5", rounded: "$3", bg: "transparent", borderWidth: 1, borderColor: "var(--border-strong)", cursor: "pointer", transition: "quickest", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: INK, children: t('Back to home') }) }))] }));
|
|
127
129
|
}
|
|
128
130
|
/* ─────────────────────────────────────────────────────────────────────────────
|
|
129
131
|
The cards. Each one owns its own read, so a card that cannot answer says so
|
|
@@ -165,12 +167,12 @@ function Channels({ channels, wrong, open }) {
|
|
|
165
167
|
setOpening(false);
|
|
166
168
|
}
|
|
167
169
|
};
|
|
168
|
-
return (_jsxs(
|
|
170
|
+
return (_jsxs(HomeCard, { kind: "channels", icon: _jsx(Hash, { size: 14, "aria-hidden": true }), title: t('Channels'), children: [channels === null ? (_jsx(Waiting, { wrong: wrong, subject: t('your channels') })) : channels.length === 0 ? (_jsx(Quiet, { children: t('No channels yet.') })) : (_jsx(YStack, { gap: "$1.5", children: channels.slice(0, 6).map((one) => (_jsx(Row, { icon: one.direct ? _jsx(AtSign, { size: 12, "aria-hidden": true }) : _jsx(Hash, { size: 12, "aria-hidden": true }), onPress: () => openChannel(teamKey(one)), children: one.name || t('Direct message') }, teamKey(one)))) })), !me ? null : naming ? (_jsxs(YStack, { gap: "$1.5", children: [_jsxs(XStack, { gap: "$1.5", items: "center", children: [_jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
169
171
|
if (e.key === 'Enter')
|
|
170
172
|
void make();
|
|
171
173
|
if (e.key === 'Escape')
|
|
172
174
|
setNaming(false);
|
|
173
|
-
}, placeholder: t('Name'), "aria-label": t('Channel name'), autoFocus: true }), flex: 1, minW: 0, bg: "transparent", borderWidth: 1, borderColor: "var(--border)", rounded:
|
|
175
|
+
}, placeholder: t('Name'), "aria-label": t('Channel name'), autoFocus: true }), flex: 1, minW: 0, minH: 34, "$max-sm": { minH: 44 }, bg: "transparent", borderWidth: 1, borderColor: "var(--border-strong)", outlineStyle: "none", focusStyle: { borderColor: 'var(--ring)' }, rounded: "$2", px: 8, py: 6, color: "inherit", fontSize: "$2" }), _jsx(Box, { render: _jsx("button", { type: "button", disabled: opening || !name.trim() }), onClick: () => void make(), "aria-disabled": opening || !name.trim(), opacity: opening || !name.trim() ? 0.5 : 1, display: "inline-flex", items: "center", justify: "center", minH: 34, "$max-sm": { minH: 44 }, px: "$2.5", rounded: "$2", bg: "transparent", borderWidth: 1, borderColor: "var(--border-strong)", cursor: opening || !name.trim() ? 'default' : 'pointer', transition: "quickest", hoverStyle: opening || !name.trim() ? undefined : { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: INK, children: t('Open it') }) })] }), refused ? (_jsx(Text, { fontSize: "$2", color: BAD, children: refused })) : null] })) : (_jsx(Row, { icon: _jsx(Plus, { size: 12, "aria-hidden": true }), onPress: () => setNaming(true), children: t('New channel') }))] }));
|
|
174
176
|
}
|
|
175
177
|
/**
|
|
176
178
|
* A read the SDK has no hook for.
|
|
@@ -233,13 +235,16 @@ const useApps = () => useRead(apps);
|
|
|
233
235
|
function Projects() {
|
|
234
236
|
const { t } = useI18n();
|
|
235
237
|
const { held, wrong } = useProjects();
|
|
236
|
-
return (_jsxs(
|
|
238
|
+
return (_jsxs(HomeCard, { kind: "projects", icon: _jsx(FolderGit2, { size: 14, "aria-hidden": true }), title: t('Projects'), children: [held === null ? (_jsx(Waiting, { wrong: wrong, subject: t('your projects') })) : held.length === 0 ? (_jsx(Quiet, { children: t('Nothing deployed yet.') })) : (_jsx(YStack, { gap: "$1.5", children: held.slice(0, 3).map((p) => (_jsx(Row, { href: p.liveUrl, children: p.name || p.slug }, p.slug))) })), _jsx(Go, { href: dev(), children: t('Ship one') })] }));
|
|
237
239
|
}
|
|
238
240
|
function Chats() {
|
|
239
241
|
const { t } = useI18n();
|
|
240
242
|
const { threads, loading } = useThreads();
|
|
241
|
-
const { open } = useOpen();
|
|
242
|
-
return (
|
|
243
|
+
const { open, empty } = useOpen();
|
|
244
|
+
return (_jsxs(HomeCard, { kind: "chats", icon: _jsx(MARKS.chat.icon, { size: 14, "aria-hidden": true }), title: t('Chats'), children: [loading && threads.length === 0 ? (_jsx(Waiting, { subject: t('your chats') })) : threads.length === 0 ? (_jsx(Quiet, { children: t('No chats yet.') })) : (_jsx(YStack, { gap: "$1.5", children: threads.slice(0, 3).map((one) => (_jsx(Row, { onPress: () => open(one.id), children: one.title || t('Untitled') }, one.id))) })), _jsx(Go, { onPress: () => {
|
|
245
|
+
empty();
|
|
246
|
+
go(talk());
|
|
247
|
+
}, children: t('New chat') })] }));
|
|
243
248
|
}
|
|
244
249
|
/**
|
|
245
250
|
* What is going, then what to do next.
|
|
@@ -278,52 +283,25 @@ function Next({ onConnect }) {
|
|
|
278
283
|
out.push({ key: 'connect', say: t('Connect an app'), press: onConnect });
|
|
279
284
|
return out;
|
|
280
285
|
}, [safeSessions, unread, reload, safeAgents, held, connected, onConnect, t]);
|
|
281
|
-
return (_jsxs(
|
|
286
|
+
return (_jsxs(HomeCard, { kind: "next", icon: _jsx(Bot, { size: 14, "aria-hidden": true }), title: t('Next'), children: [running.length ? (_jsx(YStack, { gap: "$2", children: running.slice(0, 2).map((s) => (_jsxs(YStack, { gap: "$1", children: [_jsx(Row, { href: "/work", children: s.title || s.agent || t('Run') }), _jsx(Bar, { run: s, label: false })] }, s.id))) })) : null, rows.length === 0 && running.length === 0 ? (_jsx(Quiet, { children: t('Nothing needs you.') })) : (_jsx(YStack, { gap: "$1.5", children: rows.slice(0, 3).map((r) => (_jsx(Row, { href: r.href, onPress: r.press, children: r.say }, r.key))) }))] }));
|
|
282
287
|
}
|
|
283
|
-
/**
|
|
284
|
-
* The apps the org has connected.
|
|
285
|
-
*
|
|
286
|
-
* A connected provider has no page on this site — `/integrations/<slug>` is the
|
|
287
|
-
* SDK guide catalogue (openai-sdk, langchain, cursor …) and shares no ids with
|
|
288
|
-
* the cloud's connectors — so a name here is a name, and the ACTION opens the
|
|
289
|
-
* Directory, which is where connecting actually happens.
|
|
290
|
-
*/
|
|
291
288
|
function Apps({ onConnect }) {
|
|
292
289
|
const { t } = useI18n();
|
|
293
290
|
const { held, wrong } = useApps();
|
|
294
291
|
const on = held?.filter((a) => a.connected) ?? [];
|
|
295
|
-
return (_jsxs(
|
|
292
|
+
return (_jsxs(HomeCard, { kind: "apps", icon: _jsx(Blocks, { size: 14, "aria-hidden": true }), title: t('Apps'), children: [held === null ? (_jsx(Waiting, { wrong: wrong, subject: t('connected apps') })) : on.length === 0 ? (_jsx(Quiet, { children: t('Nothing connected.') })) : (_jsx(YStack, { gap: "$1.5", children: on.slice(0, 3).map((a) => (_jsx(Row, { children: a.name }, a.id))) })), _jsx(Go, { onPress: onConnect, children: t('Connect') })] }));
|
|
296
293
|
}
|
|
297
|
-
/**
|
|
298
|
-
* THE ONE CARD A PRERENDER CANNOT DRAW.
|
|
299
|
-
*
|
|
300
|
-
* Every other read here starts empty on the server AND on the first client
|
|
301
|
-
* render, so the two agree and hydration is quiet. `useOrganizations` does not:
|
|
302
|
-
* it resolves the org from the SDK synchronously, so the client's first render
|
|
303
|
-
* already knows the reader and the server's never did — a TEXT mismatch, which
|
|
304
|
-
* React answers by throwing the whole tree away and re-rendering it.
|
|
305
|
-
*
|
|
306
|
-
* `useHydrated` is false on the server and false on that first client render,
|
|
307
|
-
* so both draw the same line and the real answer arrives on the render
|
|
308
|
-
* hydration was going to perform anyway.
|
|
309
|
-
*/
|
|
310
294
|
function Team() {
|
|
311
295
|
const { t } = useI18n();
|
|
312
296
|
const hydrated = useHydrated();
|
|
313
297
|
const { currentOrgId } = useOrganizations();
|
|
314
298
|
if (!hydrated || !currentOrgId) {
|
|
315
|
-
return (_jsxs(
|
|
299
|
+
return (_jsxs(HomeCard, { kind: "team", icon: _jsx(UserPlus, { size: 14, "aria-hidden": true }), title: t('Team'), children: [_jsx(Waiting, { subject: t('your team') }), _jsx(Go, { href: invite(), children: t('Invite') })] }));
|
|
316
300
|
}
|
|
317
301
|
return _jsx(Mates, { owner: currentOrgId });
|
|
318
302
|
}
|
|
319
|
-
/** The org's people. Split out because `usePeople` needs an owner and a hook
|
|
320
|
-
* cannot be called conditionally. */
|
|
321
303
|
function Mates({ owner }) {
|
|
322
304
|
const { t } = useI18n();
|
|
323
305
|
const { people, loading } = usePeople({ owner, service: false });
|
|
324
|
-
return (_jsxs(
|
|
325
|
-
}
|
|
326
|
-
function Build() {
|
|
327
|
-
const { t } = useI18n();
|
|
328
|
-
return (_jsxs(Card, { kind: "build", icon: _jsx(MARKS.dev.icon, { size: 14, "aria-hidden": true }), title: t('Build'), children: [_jsx(Quiet, { children: t('Hanzo Dev writes it, runs it, ships it.') }), _jsx(Go, { href: dev(), children: t('Open Dev') })] }));
|
|
306
|
+
return (_jsxs(HomeCard, { kind: "team", icon: _jsx(UserPlus, { size: 14, "aria-hidden": true }), title: t('Team'), children: [loading && people.length === 0 ? (_jsx(Waiting, { subject: t('your team') })) : people.length < 2 ? (_jsx(Quiet, { children: t('Just you.') })) : (_jsx(Quiet, { children: t('{n} people', { n: people.length }) })), _jsx(Go, { href: invite(), children: t('Invite') })] }));
|
|
329
307
|
}
|