@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/Sidebar.js
CHANGED
|
@@ -1,66 +1,55 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The
|
|
4
|
-
//
|
|
5
|
-
//
|
|
6
|
-
//
|
|
7
|
-
//
|
|
8
|
-
//
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
13
|
-
//
|
|
14
|
-
//
|
|
15
|
-
//
|
|
16
|
-
//
|
|
17
|
-
//
|
|
18
|
-
// Dev's places are @hanzo/build's `own`: New run, Projects, Issues, Templates.
|
|
19
|
-
// A place the rail holds (Library, Scheduled tasks, Customize) takes the sidebar
|
|
20
|
-
// instead (Rail.tsx `raised`): Back, the place's name, and its own rows
|
|
21
|
-
// (Customize's tabs, the Library's kinds), never Dev's beside them. Settings is
|
|
22
|
-
// the site's pages at /settings, with a column of their own.
|
|
23
|
-
//
|
|
24
|
-
// Its width is the edge's in the gutter at its end: dragged, keyed or
|
|
25
|
-
// double-clicked back (@hanzo/build's `Grip`), kept per browser. Pulled in past
|
|
26
|
-
// its floor it shuts (`onShut`), as the sidebar's toggle shuts it. Right to left
|
|
27
|
-
// the column stands at the window's right, so the grip is on its left edge.
|
|
28
|
-
//
|
|
29
|
-
// Its words go through `t`; Dev's places and the places' rows are
|
|
30
|
-
// @hanzo/build's own labels, drawn as the package names them.
|
|
3
|
+
// The single unified desktop sidebar (and mobile drawer column):
|
|
4
|
+
// 1. Single Top Header Row (`data-slot="app-head"`): `Hanzo` wordmark (or `← Back` + section
|
|
5
|
+
// title in a sub-page like Library / Scheduled tasks / Customize), Activity bell,
|
|
6
|
+
// Search (⌘K) button, and ONE fold button (`PanelLeftClose`, `Fold sidebar to icons`).
|
|
7
|
+
// 2. Primary New Action (`+ New chat` / `+ New run` / `+ New design`).
|
|
8
|
+
// 3. Unified Product Menu (5 core items `Chat`, `Dev`, `Design`, `Library`, `Tabs` + user-pinned
|
|
9
|
+
// items with drag-to-reorder), monochrome active state (`bg="$raised"`),
|
|
10
|
+
// hover `⋯` (`Pin/Unpin`, `Open in new tab`, `Copy link`), and active item's sub-links
|
|
11
|
+
// indented cleanly underneath with a quiet vertical guide hairline.
|
|
12
|
+
// 4. Conversations / Runs (`<Recents>`) below a subtle `$edge` hairline; the part that scrolls.
|
|
13
|
+
// `More` is ONE row under it (`place-more`) that pops a menu (never an inline list, so the
|
|
14
|
+
// sidebar never changes height): every other place, each pinnable to the top from the menu.
|
|
15
|
+
// 5. Single Bottom-Left Profile Row (`<Account host={host} onOrg={handleOrg} />`), zero duplicate
|
|
16
|
+
// Settings button next to Profile.
|
|
31
17
|
import { locales, phrase } from '@hanzo/i18n';
|
|
32
18
|
import { useI18n } from '@hanzo/i18n/react';
|
|
33
19
|
import { Text, XStack, YStack } from '@hanzo/gui';
|
|
34
|
-
import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, Cloud, Globe, Image as ImageMark, Monitor, Puzzle, Search, Settings, Sparkles } from 'lucide-react';
|
|
20
|
+
import { ArrowLeft, ArrowRight, Bell, ChevronDown, ChevronUp, CircleHelp, Cloud, ExternalLink, Globe, GripVertical, Image as ImageMark, Info, Link2, Monitor, MoreHorizontal, PanelLeftClose, Pin, PinOff, Plus, Puzzle, Search, Settings, Sparkles, } from 'lucide-react';
|
|
35
21
|
import { DOTS, Gutter, library, MARKS, NEW, own, tabs, useLanguage, useScheduled, useSessions } from '@hanzo/build';
|
|
36
22
|
import { tidy } from './lib/title.js';
|
|
37
|
-
import { Button, DropdownMenu, Switch } from '@hanzo/ui';
|
|
23
|
+
import { Button, DropdownMenu, Switch, Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, toast } from '@hanzo/ui';
|
|
38
24
|
import { Sidebar as Base, SidebarIconButton, SidebarItem, StatusDot } from '@hanzo/ui/chat';
|
|
39
25
|
import { useEffect, useId, useMemo, useState } from 'react';
|
|
40
|
-
import { Made } from './Account.js';
|
|
26
|
+
import { Account, Made } from './Account.js';
|
|
41
27
|
import { useBetas } from './Betas.js';
|
|
42
28
|
import { Recents } from './Recents.js';
|
|
43
|
-
import {
|
|
29
|
+
import { fullNavUrl, raised, useNavEntries } from './Rail.js';
|
|
30
|
+
import { MoreMenu } from './MoreMenu.js';
|
|
44
31
|
import { Setup } from './Setup.js';
|
|
45
32
|
import { ago, UNTITLED_RUN } from './recent.js';
|
|
46
|
-
import { empty
|
|
33
|
+
import { empty } from './open.js';
|
|
47
34
|
import { useSpan } from './span.js';
|
|
48
|
-
import {
|
|
49
|
-
import { hosted, talk } from './lib/host.js';
|
|
35
|
+
import { useDevMode } from './lib/dev-mode.js';
|
|
36
|
+
import { app, design, flow, hosted, studio, talk, TERMINALS } from './lib/host.js';
|
|
50
37
|
import { HOSTED_APPS } from './lib/hosted.js';
|
|
51
|
-
import {
|
|
52
|
-
import { brand,
|
|
38
|
+
import { pick } from './lib/session.js';
|
|
39
|
+
import { brand, site } from './where.js';
|
|
53
40
|
import { dragWindow, toggleWindowMaximize } from './WindowControls.js';
|
|
54
41
|
import { BAND, HEAD as LINE, SIDE, TOUCH_HEAD } from './ground.js';
|
|
55
42
|
/** The sidebar fills the column. Its `width` is typed in px alone, though its frame takes any gui size — the type is
|
|
56
43
|
* @hanzo/ui's to widen. */
|
|
57
44
|
const FILL = { width: '100%' };
|
|
58
|
-
/** The sidebar's width, px: its default, and the two a drag holds it between. */
|
|
45
|
+
/** The sidebar's width, px: its default (256px), and the two a drag holds it between. */
|
|
59
46
|
const WIDTH = SIDE;
|
|
60
47
|
const FLOOR = 200;
|
|
61
48
|
const CEIL = 420;
|
|
62
49
|
/** Per reader, per browser. */
|
|
63
50
|
const SPAN = 'hanzo.app.column';
|
|
51
|
+
/** A row on a touch screen, px: a thumb's 44. */
|
|
52
|
+
const TOUCH = 44;
|
|
64
53
|
/** Enter and Space press a row the way a click does. */
|
|
65
54
|
const keys = (press) => ({
|
|
66
55
|
onKeyDown: (e) => {
|
|
@@ -70,22 +59,174 @@ const keys = (press) => ({
|
|
|
70
59
|
press();
|
|
71
60
|
},
|
|
72
61
|
});
|
|
73
|
-
/** A row of the sidebar: a full-width
|
|
74
|
-
const ROW = {
|
|
62
|
+
/** A row of the sidebar: a full-width pill, 44px on a touch screen, lit where the reader is. */
|
|
63
|
+
const ROW = {
|
|
64
|
+
rounded: '$3',
|
|
65
|
+
minH: 34,
|
|
66
|
+
py: 0,
|
|
67
|
+
px: '$2.5',
|
|
68
|
+
gap: '$2.5',
|
|
69
|
+
width: '100%',
|
|
70
|
+
$touchable: { minH: TOUCH },
|
|
71
|
+
'$max-sm': { minH: TOUCH },
|
|
72
|
+
};
|
|
75
73
|
/** A sidebar link row spans the column width so hover and active pills align with Recents. */
|
|
76
74
|
const COMPACT_ROW = ROW;
|
|
77
75
|
/** The run activity behind the bell: the runs that moved last, newest first. */
|
|
78
76
|
const RECENT = 6;
|
|
79
77
|
/** What a place that takes the sidebar is called at its head. */
|
|
80
78
|
const TITLE = { library: phrase('Library'), scheduled: phrase('Scheduled tasks'), customize: phrase('Customize') };
|
|
81
|
-
/** A header mark: a 15px glyph in a
|
|
82
|
-
const HEAD = { width: 32, height: 32, rounded: '$3', $touchable: { width:
|
|
79
|
+
/** A header mark: a 15px glyph in a 32px target, a thumb's 44 on a touch screen. */
|
|
80
|
+
const HEAD = { width: 32, height: 32, rounded: '$3', $touchable: { width: TOUCH, height: TOUCH } };
|
|
81
|
+
/** Compact sub-page header mark so longer titles like "Scheduled tasks" never clip at 256px. */
|
|
82
|
+
const SUB_HEAD = { width: 28, height: 28, rounded: '$3', $touchable: { width: TOUCH, height: TOUCH } };
|
|
83
|
+
function resolvePlaceHref(id, mode) {
|
|
84
|
+
if (mode === 'flow') {
|
|
85
|
+
return id === 'canvas' ? flow('') : flow(id);
|
|
86
|
+
}
|
|
87
|
+
switch (id) {
|
|
88
|
+
case NEW:
|
|
89
|
+
return mode === 'dev' ? app('') : mode === 'design' ? design('') : mode === 'studio' ? studio('') : mode === 'tabs' ? TERMINALS : talk();
|
|
90
|
+
case 'projects':
|
|
91
|
+
return app('-/projects');
|
|
92
|
+
case 'issues':
|
|
93
|
+
return app('-/issues');
|
|
94
|
+
case 'templates':
|
|
95
|
+
return app('-/templates');
|
|
96
|
+
case 'agents':
|
|
97
|
+
return app('-/customize/agents');
|
|
98
|
+
case 'bots':
|
|
99
|
+
return app('-/customize/bots');
|
|
100
|
+
case 'skills':
|
|
101
|
+
return app('-/customize/skills');
|
|
102
|
+
case 'connectors':
|
|
103
|
+
return app('-/customize/connectors');
|
|
104
|
+
case 'plugins':
|
|
105
|
+
return app('-/customize/plugins');
|
|
106
|
+
case 'upload':
|
|
107
|
+
case 'all':
|
|
108
|
+
case 'images':
|
|
109
|
+
case 'documents':
|
|
110
|
+
return app('-/artifacts');
|
|
111
|
+
default:
|
|
112
|
+
if (id.startsWith('app-'))
|
|
113
|
+
return hosted(id.slice('app-'.length));
|
|
114
|
+
return null;
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function fullPlaceUrl(path) {
|
|
118
|
+
if (/^https?:\/\//.test(path))
|
|
119
|
+
return path;
|
|
120
|
+
if (typeof window === 'undefined')
|
|
121
|
+
return path;
|
|
122
|
+
return new URL(site(path), window.location.href).href;
|
|
123
|
+
}
|
|
124
|
+
function NavMenuRow({ item, pinned, onTogglePin, onMove, draggable = false, dragging = false, dropTarget = false, onDragStart, onDragOver, onDragLeave, onDrop, onDragEnd, t, }) {
|
|
125
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
126
|
+
const canPin = item.pinnable !== false;
|
|
127
|
+
const handleTogglePin = () => {
|
|
128
|
+
onTogglePin(item.id);
|
|
129
|
+
toast.success(pinned
|
|
130
|
+
? t('Moved {name} back to More', { name: item.label })
|
|
131
|
+
: t('Pinned {name} to top', { name: item.label }));
|
|
132
|
+
};
|
|
133
|
+
const menuItems = [
|
|
134
|
+
...(canPin
|
|
135
|
+
? [
|
|
136
|
+
{
|
|
137
|
+
key: 'pin',
|
|
138
|
+
label: pinned ? t('Unpin from top') : t('Pin to top'),
|
|
139
|
+
icon: pinned ? _jsx(PinOff, { size: 15, "aria-hidden": true }) : _jsx(Pin, { size: 15, "aria-hidden": true }),
|
|
140
|
+
onSelect: handleTogglePin,
|
|
141
|
+
},
|
|
142
|
+
]
|
|
143
|
+
: []),
|
|
144
|
+
...(onMove?.up ? [{ key: 'move-up', label: t('Move up'), icon: _jsx(ChevronUp, { size: 15, "aria-hidden": true }), onSelect: onMove.up }] : []),
|
|
145
|
+
...(onMove?.down ? [{ key: 'move-down', label: t('Move down'), icon: _jsx(ChevronDown, { size: 15, "aria-hidden": true }), onSelect: onMove.down }] : []),
|
|
146
|
+
{
|
|
147
|
+
key: 'new-tab',
|
|
148
|
+
label: t('Open in new tab'),
|
|
149
|
+
icon: _jsx(ExternalLink, { size: 15, "aria-hidden": true }),
|
|
150
|
+
onSelect: () => {
|
|
151
|
+
if (typeof window !== 'undefined') {
|
|
152
|
+
window.open(fullNavUrl(item.href), '_blank', 'noopener,noreferrer');
|
|
153
|
+
}
|
|
154
|
+
},
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
key: 'copy-link',
|
|
158
|
+
label: t('Copy link'),
|
|
159
|
+
icon: _jsx(Link2, { size: 15, "aria-hidden": true }),
|
|
160
|
+
onSelect: async () => {
|
|
161
|
+
try {
|
|
162
|
+
await navigator.clipboard.writeText(fullNavUrl(item.href));
|
|
163
|
+
toast.success(t('Link copied'));
|
|
164
|
+
}
|
|
165
|
+
catch {
|
|
166
|
+
toast.error(t('The browser would not copy the link.'));
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
},
|
|
170
|
+
];
|
|
171
|
+
return (_jsxs(XStack, { group: true, position: "relative", width: "100%", items: "center", minW: 0, borderTopWidth: dropTarget ? 2 : 0, borderTopColor: dropTarget ? 'var(--foreground)' : 'transparent', opacity: dragging ? 0.45 : 1, ...(draggable
|
|
172
|
+
? {
|
|
173
|
+
draggable: true,
|
|
174
|
+
onDragStart,
|
|
175
|
+
onDragOver,
|
|
176
|
+
onDragLeave,
|
|
177
|
+
onDrop,
|
|
178
|
+
onDragEnd,
|
|
179
|
+
}
|
|
180
|
+
: null), children: [draggable ? (_jsx(XStack, { position: "absolute", insetInlineStart: 1, t: 0, b: 0, width: 10, items: "center", justify: "center", pointerEvents: "none", opacity: dragging ? 0.9 : 0, "$group-hover": { opacity: 0.55 }, $touchable: { display: 'none' }, "$platform-web": { color: 'var(--muted-foreground)' }, "aria-hidden": true, children: _jsx(GripVertical, { size: 12, "aria-hidden": true }) })) : null, _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": item.slot, "data-nav-id": item.id, "aria-label": item.label, "aria-current": item.on ? 'page' : undefined, onClick: item.onPress, flex: 1, minW: 0, minH: 34, px: "$2.5", py: "$1", paddingInlineEnd: canPin ? 54 : 30, rounded: "$3", borderWidth: 0, items: "center", gap: "$2.5", cursor: "pointer", "$platform-web": draggable ? { cursor: dragging ? 'grabbing' : 'grab' } : undefined, bg: item.on ? '$raised' : 'transparent', hoverStyle: { bg: item.on ? '$raised' : '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, children: [_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: item.on ? 1 : 0.78, children: item.icon }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", fontWeight: item.on ? '500' : '400', color: item.on ? '$ink' : '$aside', numberOfLines: 1, text: "start", children: item.label }), item.external ? _jsx(ExternalLink, { size: 12, opacity: 0.45, "aria-hidden": true }) : null] }), _jsxs(XStack, { position: "absolute", insetInlineEnd: 4, t: 0, b: 0, items: "center", gap: 2, children: [canPin ? (_jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "nav-item-pin", "aria-label": pinned ? t('Unpin {name}', { name: item.label }) : t('Pin {name} to top', { name: item.label }), ...{ title: pinned ? t('Unpin from top') : t('Pin to top') }, width: 24, height: 24, rounded: "$2", borderWidth: 0, items: "center", justify: "center", cursor: "pointer", bg: "transparent", "$platform-web": { color: 'var(--muted-foreground)' }, opacity: menuOpen ? 1 : 0, "$group-hover": { opacity: 1 }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, $touchable: { opacity: 0.7, minW: TOUCH, minH: TOUCH }, "$max-sm": { minW: TOUCH, minH: TOUCH }, hoverStyle: { bg: '$hover' }, onClick: (e) => {
|
|
181
|
+
e.stopPropagation?.();
|
|
182
|
+
handleTogglePin();
|
|
183
|
+
}, children: pinned ? _jsx(PinOff, { size: 13, "aria-hidden": true }) : _jsx(Pin, { size: 13, "aria-hidden": true }) })) : null, _jsx(DropdownMenu, { open: menuOpen, onOpenChange: setMenuOpen, placement: "bottom-end", minWidth: 180, items: menuItems, trigger: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "nav-item-options", "aria-label": t('{name} options', { name: item.label }), width: 24, height: 24, rounded: "$2", borderWidth: 0, items: "center", justify: "center", cursor: "pointer", bg: menuOpen ? '$hover' : 'transparent', opacity: menuOpen ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, $touchable: { opacity: 1, minW: TOUCH, minH: TOUCH }, "$max-sm": { minW: TOUCH, minH: TOUCH }, hoverStyle: { bg: '$hover' }, onClick: (e) => e.stopPropagation?.(), children: _jsx(MoreHorizontal, { size: 14, "aria-hidden": true }) }) })] })] }));
|
|
184
|
+
}
|
|
185
|
+
function PlaceRow({ link, mode, makeIcon, compact = false, t, }) {
|
|
186
|
+
const [menuOpen, setMenuOpen] = useState(false);
|
|
187
|
+
const routePath = resolvePlaceHref(link.id, mode);
|
|
188
|
+
const MakeIcon = makeIcon;
|
|
189
|
+
const menuItems = [
|
|
190
|
+
...(routePath
|
|
191
|
+
? [
|
|
192
|
+
{
|
|
193
|
+
key: 'new-tab',
|
|
194
|
+
label: t('Open in new tab'),
|
|
195
|
+
icon: _jsx(ExternalLink, { size: 15, "aria-hidden": true }),
|
|
196
|
+
onSelect: () => {
|
|
197
|
+
if (typeof window !== 'undefined') {
|
|
198
|
+
window.open(fullPlaceUrl(routePath), '_blank', 'noopener,noreferrer');
|
|
199
|
+
}
|
|
200
|
+
},
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
key: 'copy-link',
|
|
204
|
+
label: t('Copy link'),
|
|
205
|
+
icon: _jsx(Link2, { size: 15, "aria-hidden": true }),
|
|
206
|
+
onSelect: async () => {
|
|
207
|
+
try {
|
|
208
|
+
await navigator.clipboard.writeText(fullPlaceUrl(routePath));
|
|
209
|
+
toast.success(t('Link copied'));
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
toast.error(t('The browser would not copy the link.'));
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
},
|
|
216
|
+
]
|
|
217
|
+
: []),
|
|
218
|
+
];
|
|
219
|
+
const hasInfo = Boolean(link.hint);
|
|
220
|
+
const hasMenu = menuItems.length > 0;
|
|
221
|
+
const trailSpace = hasInfo && hasMenu ? 54 : hasInfo || hasMenu ? 30 : '$2.5';
|
|
222
|
+
return (_jsxs(XStack, { group: true, role: "listitem", position: "relative", width: "100%", minW: 0, items: "center", children: [_jsx(SidebarItem, { ...COMPACT_ROW, minH: compact ? 30 : 34, px: compact ? '$2' : '$2.5', gap: "$2.5", paddingInlineEnd: trailSpace, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, bg: link.active ? '$raised' : 'transparent', hoverStyle: { bg: link.active ? '$raised' : '$hover' }, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: compact ? 16 : 18, height: compact ? 16 : 18, items: "center", justify: "center", shrink: 0, opacity: link.active ? 1 : 0.72, children: link.icon ?? _jsx(MakeIcon, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: "$2", fontWeight: link.active ? '500' : '400', color: link.active ? '$ink' : compact ? '$soft' : '$aside', numberOfLines: 1, children: link.label }) }), hasInfo || hasMenu ? (_jsxs(XStack, { position: "absolute", insetInlineEnd: 4, t: 0, b: 0, items: "center", gap: 2, children: [link.hint ? (_jsxs(Tooltip, { placement: "right", offset: 8, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "place-info", "aria-label": t('About {name}', { name: link.label }), width: 22, height: 22, rounded: "$2", borderWidth: 0, bg: "transparent", items: "center", justify: "center", cursor: "pointer", "$platform-web": { color: 'var(--muted-foreground)' }, opacity: 0.55, hoverStyle: { opacity: 1, bg: '$hover' }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, $touchable: { opacity: 0.85, minW: TOUCH, minH: TOUCH }, "$max-sm": { minW: TOUCH, minH: TOUCH }, onClick: (e) => e.stopPropagation?.(), children: _jsx(Info, { size: 13, "aria-hidden": true }) }) }), _jsx(TooltipContent, { maxW: 230, px: "$2.5", py: "$1.5", rounded: "$3", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", z: "var(--z-tooltip)", children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", children: link.hint }) })] })) : null, hasMenu ? (_jsx(DropdownMenu, { open: menuOpen, onOpenChange: setMenuOpen, placement: "bottom-end", minWidth: 180, items: menuItems, trigger: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "place-options", "aria-label": t('{name} options', { name: link.label }), width: 24, height: 24, rounded: "$2", borderWidth: 0, items: "center", justify: "center", cursor: "pointer", bg: menuOpen ? '$hover' : 'transparent', opacity: menuOpen ? 1 : 0, "$group-hover": { opacity: 1 }, focusStyle: { opacity: 1 }, focusVisibleStyle: { opacity: 1, outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, $touchable: { opacity: 1, minW: TOUCH, minH: TOUCH }, "$max-sm": { minW: TOUCH, minH: TOUCH }, hoverStyle: { bg: '$hover' }, onClick: (e) => e.stopPropagation?.(), children: _jsx(MoreHorizontal, { size: 14, "aria-hidden": true }) }) })) : null] })) : null] }));
|
|
223
|
+
}
|
|
83
224
|
export function dispatchTabsAction(detail) {
|
|
84
225
|
if (typeof window === 'undefined')
|
|
85
226
|
return;
|
|
86
227
|
window.dispatchEvent(new CustomEvent('hanzo:tabs-action', { detail }));
|
|
87
228
|
}
|
|
88
|
-
function useTabsGroups(t, active) {
|
|
229
|
+
function useTabsGroups(t, active, devMode) {
|
|
89
230
|
const [fleet, setFleet] = useState([]);
|
|
90
231
|
const [bind, setBind] = useState({});
|
|
91
232
|
useEffect(() => {
|
|
@@ -142,45 +283,47 @@ function useTabsGroups(t, active) {
|
|
|
142
283
|
const quickLinks = [
|
|
143
284
|
{
|
|
144
285
|
id: 'new-terminal',
|
|
145
|
-
label: t('
|
|
146
|
-
|
|
286
|
+
label: t('Terminal'),
|
|
287
|
+
hint: t('Cloud command-line shell with saved files.'),
|
|
288
|
+
icon: _jsx(MARKS.tabs.make, { size: 15, "aria-hidden": true }),
|
|
147
289
|
onPress: () => dispatchTabsAction({ kind: 'shell' }),
|
|
148
290
|
},
|
|
149
291
|
{
|
|
150
292
|
id: 'new-desktop',
|
|
151
|
-
label: t('
|
|
152
|
-
|
|
293
|
+
label: t('Desktop'),
|
|
294
|
+
hint: t('Full visual cloud desktop in your browser.'),
|
|
295
|
+
icon: _jsx(Monitor, { size: 15, "aria-hidden": true }),
|
|
153
296
|
onPress: () => dispatchTabsAction({ kind: 'desktop' }),
|
|
154
297
|
},
|
|
155
298
|
{
|
|
156
299
|
id: 'new-browser',
|
|
157
|
-
label: t('
|
|
158
|
-
|
|
300
|
+
label: t('Browser'),
|
|
301
|
+
hint: t('Isolated workspace browser for live previews.'),
|
|
302
|
+
icon: _jsx(Globe, { size: 15, "aria-hidden": true }),
|
|
159
303
|
onPress: () => dispatchTabsAction({ kind: 'page' }),
|
|
160
304
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
305
|
+
...(devMode
|
|
306
|
+
? [
|
|
307
|
+
{
|
|
308
|
+
id: 'new-cloud',
|
|
309
|
+
label: t('Cloud sandbox'),
|
|
310
|
+
hint: t('Spin up a fresh isolated cloud environment.'),
|
|
311
|
+
icon: _jsx(Cloud, { size: 15, "aria-hidden": true }),
|
|
312
|
+
onPress: () => dispatchTabsAction({ kind: 'cloud' }),
|
|
313
|
+
},
|
|
314
|
+
]
|
|
315
|
+
: []),
|
|
167
316
|
];
|
|
168
317
|
const liveFleet = fleet.filter((h) => h.status !== 'offline');
|
|
169
|
-
const
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
}))
|
|
176
|
-
:
|
|
177
|
-
|
|
178
|
-
id: 'sandbox-launch',
|
|
179
|
-
label: t('Launch cloud sandbox'),
|
|
180
|
-
icon: _jsx(Cloud, { size: 16, "aria-hidden": true }),
|
|
181
|
-
onPress: () => dispatchTabsAction({ kind: 'cloud' }),
|
|
182
|
-
},
|
|
183
|
-
];
|
|
318
|
+
const deviceLinks = liveFleet.map((h) => ({
|
|
319
|
+
id: `sandbox-${h.machine}`,
|
|
320
|
+
label: h.label ? `${h.machine} · ${h.label}` : h.machine,
|
|
321
|
+
hint: h.desktop
|
|
322
|
+
? t('Connect to this device’s live desktop session.')
|
|
323
|
+
: t('Open a terminal shell on this connected device.'),
|
|
324
|
+
icon: h.desktop ? _jsx(Monitor, { size: 15, "aria-hidden": true }) : _jsx(Cloud, { size: 15, "aria-hidden": true }),
|
|
325
|
+
onPress: () => dispatchTabsAction({ kind: h.desktop ? 'desktop' : 'shell', machine: h.machine }),
|
|
326
|
+
}));
|
|
184
327
|
const knownMachines = fleet.length > 0 ? new Set(liveFleet.map((h) => h.machine)) : null;
|
|
185
328
|
const recentLinks = Object.entries(bind)
|
|
186
329
|
.filter(([, b]) => {
|
|
@@ -199,7 +342,7 @@ function useTabsGroups(t, active) {
|
|
|
199
342
|
return {
|
|
200
343
|
id: `tab-${id}`,
|
|
201
344
|
label: b.machine ? `${t('Desktop')} · ${b.machine}` : t('Desktop'),
|
|
202
|
-
icon: _jsx(Monitor, { size:
|
|
345
|
+
icon: _jsx(Monitor, { size: 15, "aria-hidden": true }),
|
|
203
346
|
onPress: () => dispatchTabsAction({ kind: 'focus', id }),
|
|
204
347
|
};
|
|
205
348
|
}
|
|
@@ -216,7 +359,7 @@ function useTabsGroups(t, active) {
|
|
|
216
359
|
return {
|
|
217
360
|
id: `tab-${id}`,
|
|
218
361
|
label: hostLabel,
|
|
219
|
-
icon: _jsx(Globe, { size:
|
|
362
|
+
icon: _jsx(Globe, { size: 15, "aria-hidden": true }),
|
|
220
363
|
onPress: () => dispatchTabsAction({ kind: 'focus', id }),
|
|
221
364
|
};
|
|
222
365
|
}
|
|
@@ -225,21 +368,22 @@ function useTabsGroups(t, active) {
|
|
|
225
368
|
return {
|
|
226
369
|
id: `tab-${id}`,
|
|
227
370
|
label: machine ? `${machine}${name ? ` (${name})` : ''}` : t('Terminal'),
|
|
228
|
-
icon: _jsx(MARKS.tabs.icon, { size:
|
|
371
|
+
icon: _jsx(MARKS.tabs.icon, { size: 15, "aria-hidden": true }),
|
|
229
372
|
onPress: () => dispatchTabsAction({ kind: 'focus', id }),
|
|
230
373
|
};
|
|
231
374
|
});
|
|
232
375
|
return [
|
|
233
376
|
{ id: 'tabs-actions', label: '', links: quickLinks },
|
|
234
|
-
{ id: '
|
|
377
|
+
...(deviceLinks.length > 0 ? [{ id: 'devices', label: t('Devices'), links: deviceLinks }] : []),
|
|
235
378
|
...(recentLinks.length > 0 ? [{ id: 'recent-tabs', label: t('Open tabs'), links: recentLinks }] : []),
|
|
236
379
|
];
|
|
237
|
-
}, [active, bind, fleet, t]);
|
|
380
|
+
}, [active, bind, devMode, fleet, t]);
|
|
238
381
|
}
|
|
239
382
|
function Activity({ host }) {
|
|
240
383
|
const { t } = useI18n();
|
|
241
384
|
const store = useSessions(host);
|
|
242
385
|
const latest = [...store.value].sort((a, b) => (a.updatedAt < b.updatedAt ? 1 : -1)).slice(0, RECENT);
|
|
386
|
+
const hasLive = latest.some((s) => s.status === 'running' || s.status === 'pending' || s.status === 'starting');
|
|
243
387
|
const items = [
|
|
244
388
|
{ type: 'label', key: 'head', label: t('Activity') },
|
|
245
389
|
...(latest.length
|
|
@@ -253,12 +397,16 @@ function Activity({ host }) {
|
|
|
253
397
|
}))
|
|
254
398
|
: [{ key: 'none', label: t('Nothing new'), disabled: true, onSelect: () => { } }]),
|
|
255
399
|
];
|
|
256
|
-
return (_jsx(DropdownMenu, { minWidth: 280, trigger:
|
|
400
|
+
return (_jsx(DropdownMenu, { minWidth: 280, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "activity-bell", "aria-label": t('Activity'), ...{ title: t('Activity') }, ...HEAD, position: "relative", borderWidth: 0, bg: "transparent", items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Bell, { size: 15, "aria-hidden": true }), hasLive ? (_jsx(YStack, { position: "absolute", t: 5, r: 5, width: 6, height: 6, rounded: 999, bg: "var(--state-online)", "aria-hidden": true })) : null] }), items: items }));
|
|
257
401
|
}
|
|
258
|
-
export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer = false, rail, foot, places, made, }) {
|
|
402
|
+
export function Sidebar({ pins, host, mode, thread, go, onShut, onSeek, onBack, onChat, onDev, onDesign, onStudio, onTabs, onOrg, inside = null, drawer = false, rail, foot, places, made, }) {
|
|
259
403
|
const { t, dir } = useI18n();
|
|
404
|
+
const [devMode, setDevMode] = useDevMode();
|
|
405
|
+
const [pinnedIds, togglePin, reorderPin, movePin] = pins;
|
|
406
|
+
const pinnedSet = useMemo(() => new Set(pinnedIds), [pinnedIds]);
|
|
407
|
+
const [dragId, setDragId] = useState(null);
|
|
408
|
+
const [dropId, setDropId] = useState(null);
|
|
260
409
|
const anon = host.person === null;
|
|
261
|
-
const free = useFree(Boolean(host.token?.())) || anon;
|
|
262
410
|
const [anonSettingsOpen, setAnonSettingsOpen] = useState(false);
|
|
263
411
|
const [tailoredOpen, setTailoredOpen] = useState(true);
|
|
264
412
|
const [anonThreadTitle, setAnonThreadTitle] = useState('');
|
|
@@ -288,16 +436,13 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
288
436
|
window.removeEventListener('hanzo:anon-thread', onAnonThread);
|
|
289
437
|
};
|
|
290
438
|
}, [anon]);
|
|
291
|
-
// The desktop sidebar and a phone's drawer can both be in the page: each names its own group labels.
|
|
292
439
|
const uid = useId();
|
|
293
440
|
const span = useSpan(SPAN, WIDTH, FLOOR, CEIL);
|
|
294
441
|
const dev = (p) => host.go(p);
|
|
295
442
|
const at = mode === 'dev' ? raised(host.path) : null;
|
|
296
|
-
// A New row that brings no icon of its own wears its mode's `make` mark.
|
|
297
443
|
const Make = mode === 'chat' || mode === 'dev' || mode === 'tabs' || mode === 'studio' ? MARKS[mode].make : MARKS.chat.make;
|
|
298
|
-
// Each place the rail holds lists its own rows: Library its kinds and Upload, Scheduled tasks its tasks and New task.
|
|
299
444
|
const scheduled = useScheduled(host, dev, at === 'scheduled');
|
|
300
|
-
const tabsGroups = useTabsGroups(t, mode === 'tabs');
|
|
445
|
+
const tabsGroups = useTabsGroups(t, mode === 'tabs', devMode);
|
|
301
446
|
const { open: betaOpen } = useBetas();
|
|
302
447
|
const hostedGroups = useMemo(() => {
|
|
303
448
|
if (mode !== 'hosted')
|
|
@@ -337,7 +482,6 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
337
482
|
window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: next } }));
|
|
338
483
|
}
|
|
339
484
|
};
|
|
340
|
-
// Chat's New; Dev's is the first of its places.
|
|
341
485
|
const create = () => {
|
|
342
486
|
if (anon) {
|
|
343
487
|
setAnonSettings(false);
|
|
@@ -352,50 +496,188 @@ export function Sidebar({ host, mode, thread, go, onShut, onSeek, onBack, drawer
|
|
|
352
496
|
empty();
|
|
353
497
|
go(talk());
|
|
354
498
|
};
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
499
|
+
const createPrimary = () => {
|
|
500
|
+
if (mode === 'dev')
|
|
501
|
+
dev('');
|
|
502
|
+
else if (mode === 'design')
|
|
503
|
+
made ? made.go('') : go(design(''));
|
|
504
|
+
else if (mode === 'studio')
|
|
505
|
+
made ? made.go('') : go(studio(''));
|
|
506
|
+
else if (mode === 'flow')
|
|
507
|
+
made ? made.go('') : go(flow(''));
|
|
508
|
+
else
|
|
509
|
+
create();
|
|
510
|
+
};
|
|
511
|
+
const nav = useNavEntries({
|
|
512
|
+
host,
|
|
513
|
+
mode,
|
|
514
|
+
at: host.path ?? null,
|
|
515
|
+
inside,
|
|
516
|
+
onChat: onChat ?? (() => go(talk())),
|
|
517
|
+
onDev: onDev ?? (() => go(app(''))),
|
|
518
|
+
onDesign: onDesign ?? (() => go(design(''))),
|
|
519
|
+
onStudio: onStudio ?? (() => go(studio(''))),
|
|
520
|
+
onTabs: onTabs ?? (() => go(TERMINALS)),
|
|
521
|
+
go,
|
|
522
|
+
pins,
|
|
523
|
+
});
|
|
524
|
+
// An app that lives in More draws its own row (and sub-links) after the pinned ones while the reader is in it.
|
|
525
|
+
const shown = [...nav.pinnedEntries, ...nav.moreEntries.filter((item) => item.on)];
|
|
526
|
+
const showMore = !at && !anon && nav.moreEntries.length > 0;
|
|
527
|
+
const subGroupsFor = (entryId) => {
|
|
528
|
+
if (at)
|
|
529
|
+
return [];
|
|
530
|
+
if (entryId === 'dev' && mode === 'dev') {
|
|
531
|
+
const links = own(host, dev, t).flatMap((g) => g.links).filter((l) => l.id !== NEW);
|
|
532
|
+
return links.length ? [{ id: 'dev-sub', label: '', links }] : [];
|
|
533
|
+
}
|
|
534
|
+
if (entryId === 'design' && mode === 'design' && places) {
|
|
535
|
+
const links = places
|
|
536
|
+
.flatMap((g) => g.links)
|
|
537
|
+
.filter((l) => l.id !== NEW && !(l.id === 'library' && nav.shownInPrimary.has('library')));
|
|
538
|
+
return links.length ? [{ id: 'design-sub', label: '', links }] : [];
|
|
539
|
+
}
|
|
540
|
+
if (entryId === 'studio' && mode === 'studio' && places) {
|
|
541
|
+
const links = places.flatMap((g) => g.links).filter((l) => l.id !== NEW);
|
|
542
|
+
return links.length ? [{ id: 'studio-sub', label: '', links }] : [];
|
|
543
|
+
}
|
|
544
|
+
if (entryId === 'flow' && mode === 'flow' && places) {
|
|
545
|
+
const links = places.flatMap((g) => g.links).filter((l) => l.id !== NEW);
|
|
546
|
+
return links.length ? [{ id: 'flow-sub', label: '', links }] : [];
|
|
547
|
+
}
|
|
548
|
+
if (entryId === 'tabs' && mode === 'tabs') {
|
|
549
|
+
return tabsGroups.filter((g) => g.links.length > 0);
|
|
550
|
+
}
|
|
551
|
+
return [];
|
|
552
|
+
};
|
|
553
|
+
// The pinned apps as the reader sees them: one that is not offered here is not a place to move to.
|
|
554
|
+
const seen = nav.pinnedEntries.map((e) => e.id);
|
|
555
|
+
const renderNavEntryWithSublinks = (item, allowDrop) => {
|
|
556
|
+
const subGroups = item.on ? subGroupsFor(item.id) : [];
|
|
557
|
+
const canDrag = !anon;
|
|
558
|
+
return (_jsxs(YStack, { gap: 1, width: "100%", children: [_jsx(NavMenuRow, { item: item, pinned: pinnedSet.has(item.id), onTogglePin: togglePin, onMove: canDrag && allowDrop && pinnedSet.has(item.id)
|
|
559
|
+
? {
|
|
560
|
+
up: seen.indexOf(item.id) > 0 ? () => movePin(item.id, -1, seen) : undefined,
|
|
561
|
+
down: seen.indexOf(item.id) < seen.length - 1 ? () => movePin(item.id, 1, seen) : undefined,
|
|
562
|
+
}
|
|
563
|
+
: undefined, draggable: canDrag, dragging: dragId === item.id, dropTarget: allowDrop && dropId === item.id && dragId !== item.id, onDragStart: (e) => {
|
|
564
|
+
setDragId(item.id);
|
|
565
|
+
e.dataTransfer?.setData('text/plain', item.id);
|
|
566
|
+
if (e.dataTransfer)
|
|
567
|
+
e.dataTransfer.effectAllowed = 'move';
|
|
568
|
+
}, onDragOver: allowDrop
|
|
569
|
+
? (e) => {
|
|
570
|
+
const src = dragId || e.dataTransfer?.getData('text/plain');
|
|
571
|
+
if (!src || src === item.id)
|
|
572
|
+
return;
|
|
573
|
+
e.preventDefault();
|
|
574
|
+
if (e.dataTransfer)
|
|
575
|
+
e.dataTransfer.dropEffect = 'move';
|
|
576
|
+
if (dropId !== item.id)
|
|
577
|
+
setDropId(item.id);
|
|
578
|
+
}
|
|
579
|
+
: undefined, onDragLeave: allowDrop
|
|
580
|
+
? () => {
|
|
581
|
+
if (dropId === item.id)
|
|
582
|
+
setDropId(null);
|
|
583
|
+
}
|
|
584
|
+
: undefined, onDrop: allowDrop
|
|
585
|
+
? (e) => {
|
|
586
|
+
e.preventDefault();
|
|
587
|
+
e.stopPropagation();
|
|
588
|
+
const src = dragId || e.dataTransfer?.getData('text/plain');
|
|
589
|
+
if (src && src !== item.id)
|
|
590
|
+
reorderPin(src, item.id);
|
|
591
|
+
setDragId(null);
|
|
592
|
+
setDropId(null);
|
|
593
|
+
}
|
|
594
|
+
: undefined, onDragEnd: () => {
|
|
595
|
+
setDragId(null);
|
|
596
|
+
setDropId(null);
|
|
597
|
+
}, t: t }), subGroups.length > 0 ? (_jsx(YStack, { "data-slot": "nav-sublinks", marginInlineStart: "$4", paddingInlineStart: "$2.5", borderInlineStartWidth: 1, borderColor: "$edge", gap: "$1.5", py: "$1", children: subGroups.map((group, gi) => (_jsxs(YStack, { gap: 1, pt: gi > 0 && group.label ? '$1' : 0, children: [group.label ? (_jsx(Text, { px: "$2", pb: 2, fontSize: "$1", fontWeight: "500", color: "$hint", numberOfLines: 1, children: group.label })) : null, _jsx(YStack, { role: "list", "aria-label": group.label || undefined, gap: 1, children: group.links.map((link) => (_jsx(PlaceRow, { link: link, mode: mode, makeIcon: Make, compact: true, t: t }, link.id))) })] }, group.id))) })) : null] }, item.id));
|
|
598
|
+
};
|
|
599
|
+
const handleOrg = onOrg ??
|
|
600
|
+
((nextOrg) => {
|
|
601
|
+
pick(nextOrg);
|
|
602
|
+
if (typeof window !== 'undefined')
|
|
603
|
+
window.location.reload();
|
|
604
|
+
});
|
|
605
|
+
const primaryNewLabel = mode === 'dev' ? t('New run') : mode === 'design' ? t('New design') : mode === 'studio' ? t('New creation') : mode === 'flow' ? t('New flow') : t('New chat');
|
|
606
|
+
const showPrimaryNew = !at && (mode === 'chat' || (!anon && (mode === 'dev' || mode === 'design' || mode === 'studio' || mode === 'flow')));
|
|
607
|
+
const showRecents = !(mode === 'hosted' || mode === 'beta' || mode === 'tabs' || mode === 'studio' || mode === 'flow' || anon || at);
|
|
608
|
+
return (_jsx(TooltipProvider, { delay: 120, children: _jsxs(YStack, { "data-slot": "app-column", ref: drawer ? undefined : span.ref, ...(drawer ? null : { '$platform-web': { '--span': `${span.span}px`, ...(anon ? { overflow: 'visible' } : null) } }), position: "relative", flex: drawer ? 1 : undefined, shrink: drawer ? 1 : 0, minW: 0, height: "100%", width: drawer ? undefined : `var(--span, ${WIDTH}px)`, maxW: drawer ? undefined : `var(--span, ${WIDTH}px)`, bg: drawer ? undefined : 'var(--side-fill, var(--sheet-2))', rounded: drawer ? undefined : 'var(--pane-round)', borderWidth: drawer ? 0 : 1, borderColor: "var(--pane-edge, var(--edge, var(--white-06)))", children: [_jsxs(Base, { "data-slot": "app-rail", role: "navigation", "aria-label": brand(), bg: "transparent", borderWidth: 0, ...FILL, px: 8, pt: drawer ? 'var(--pane-gap)' : 4, pb: drawer ? 0 : '$2', gap: "$0", "$platform-web": anon && !drawer ? { overflow: 'visible' } : undefined, children: [at ? (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 0, paddingInlineEnd: 0, height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(SidebarIconButton, { label: t('Back'), "data-slot": "place-back", "data-tauri-drag-region": "false", onPress: onBack, ...SUB_HEAD, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$3", fontWeight: "600", color: "$ink", numberOfLines: 1, "data-slot": "place-name", children: t(TITLE[at]) }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...SUB_HEAD, children: _jsx(Search, { size: 15, "aria-hidden": true }) })), drawer || !onShut ? null : (_jsx(SidebarIconButton, { label: t('Fold sidebar to icons'), "data-slot": "sidebar-fold", "data-tauri-drag-region": "false", onPress: onShut, ...SUB_HEAD, children: _jsx(PanelLeftClose, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }))] })) : (_jsxs(XStack, { "data-slot": "app-head", items: "center", gap: 2, paddingInlineStart: 8, paddingInlineEnd: 2, height: drawer ? BAND : LINE, $touchable: drawer ? undefined : { height: TOUCH_HEAD }, shrink: 0, minW: 0, "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, children: [_jsx(XStack, { flex: 1, minW: 0, items: "center", gap: 4, children: _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", numberOfLines: 1, children: brand() }) }), drawer || anon ? null : _jsx(Activity, { host: host }), anon ? null : (_jsx(SidebarIconButton, { label: t('Search'), "data-tauri-drag-region": "false", onPress: onSeek, "aria-haspopup": "dialog", ...(drawer
|
|
609
|
+
? {
|
|
610
|
+
width: 40,
|
|
611
|
+
height: 40,
|
|
612
|
+
rounded: 9999,
|
|
613
|
+
borderWidth: 1,
|
|
614
|
+
borderColor: 'var(--border-strong)',
|
|
615
|
+
bg: 'var(--pane-fill)',
|
|
616
|
+
}
|
|
617
|
+
: HEAD), children: _jsx(Search, { size: drawer ? 18 : 15, "aria-hidden": true }) })), drawer || !onShut ? null : (_jsxs(Tooltip, { placement: "bottom", offset: 6, children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-label": t('Fold sidebar to icons'), "data-slot": "sidebar-fold", "data-tauri-drag-region": "false", onClick: onShut, ...HEAD, borderWidth: 0, bg: "transparent", items: "center", justify: "center", cursor: "pointer", opacity: 0.7, hoverStyle: { bg: '$hover', opacity: 1 }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(PanelLeftClose, { size: 15, "aria-hidden": true, "data-i18n-mirror": true }) }) }), _jsx(TooltipContent, { px: "$2.5", py: "$1.5", rounded: "$3", bg: "var(--popover)", borderWidth: 1, borderColor: "$edge", z: "var(--z-tooltip)", children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", children: t('Fold sidebar to icons') }) })] }))] })), showPrimaryNew ? (_jsxs(YStack, { role: "list", gap: 2, shrink: 0, pt: drawer ? 0 : 2, children: [_jsx(YStack, { role: "listitem", width: "100%", children: _jsx(SidebarItem, { "data-slot": "app-new", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: _jsx(Plus, { size: 15, "aria-hidden": true }) }), onPress: createPrimary, ...keys(createPrimary), children: _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: primaryNewLabel }) }) }), anon && mode === 'chat' ? (_jsxs(_Fragment, { children: [_jsx(YStack, { role: "listitem", self: "flex-start", width: "100%", children: _jsx(SidebarItem, { "data-slot": "app-images", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: _jsx(ImageMark, { size: 15, "aria-hidden": true }) }), onPress: () => {
|
|
618
|
+
create();
|
|
619
|
+
if (typeof window !== 'undefined') {
|
|
620
|
+
window.dispatchEvent(new CustomEvent('hanzo:anon-prompt', { detail: { text: t('Create an image of ') } }));
|
|
621
|
+
}
|
|
622
|
+
}, ...keys(() => {
|
|
623
|
+
create();
|
|
624
|
+
if (typeof window !== 'undefined') {
|
|
625
|
+
window.dispatchEvent(new CustomEvent('hanzo:anon-prompt', { detail: { text: t('Create an image of ') } }));
|
|
626
|
+
}
|
|
627
|
+
}), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Images') }) }) }), _jsx(YStack, { role: "listitem", self: "flex-start", width: "100%", children: _jsx(SidebarItem, { "data-slot": "app-plugins", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: _jsx(Puzzle, { size: 15, "aria-hidden": true }) }), onPress: () => {
|
|
628
|
+
setAnonSettings(false);
|
|
629
|
+
if (typeof window !== 'undefined') {
|
|
630
|
+
window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
|
|
631
|
+
}
|
|
632
|
+
}, ...keys(() => {
|
|
633
|
+
setAnonSettings(false);
|
|
634
|
+
if (typeof window !== 'undefined') {
|
|
635
|
+
window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
|
|
636
|
+
}
|
|
637
|
+
}), children: _jsx(Text, { fontSize: "$2", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : null, at || (drawer && Boolean(rail) && mode !== 'chat' && mode !== 'beta') ? (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => {
|
|
638
|
+
const orderedLinks = [
|
|
639
|
+
...g.links.filter((l) => l.id === NEW),
|
|
640
|
+
...g.links.filter((l) => l.id !== NEW),
|
|
641
|
+
];
|
|
642
|
+
return (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$2", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: orderedLinks.map((link) => (_jsx(PlaceRow, { link: link, mode: mode, makeIcon: Make, t: t }, link.id))) })] }, g.id));
|
|
643
|
+
}) })) : null, !at ? (_jsx(YStack, { "data-slot": "sidebar-nav", render: "nav", "aria-label": t('Products'),
|
|
644
|
+
// The nav takes what it needs; Recents below scrolls in what is left, and More stays under it.
|
|
645
|
+
shrink: 1, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$1.5", gap: "$1", "$platform-web": { scrollbarWidth: 'none' }, children: _jsx(YStack, { "data-slot": "rail-pinned", gap: 1, width: "100%", borderBottomWidth: dropId === '__pinned_end__' ? 2 : 0, borderBottomColor: dropId === '__pinned_end__' ? 'var(--foreground)' : 'transparent', ...(!anon
|
|
362
646
|
? {
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
647
|
+
onDragOver: (e) => {
|
|
648
|
+
if (!dragId)
|
|
649
|
+
return;
|
|
650
|
+
e.preventDefault();
|
|
651
|
+
if (e.dataTransfer)
|
|
652
|
+
e.dataTransfer.dropEffect = 'move';
|
|
653
|
+
},
|
|
654
|
+
onDrop: (e) => {
|
|
655
|
+
e.preventDefault();
|
|
656
|
+
const src = dragId || e.dataTransfer?.getData('text/plain');
|
|
657
|
+
if (src && !pinnedSet.has(src)) {
|
|
658
|
+
togglePin(src);
|
|
659
|
+
}
|
|
660
|
+
setDragId(null);
|
|
661
|
+
setDropId(null);
|
|
662
|
+
},
|
|
369
663
|
}
|
|
370
|
-
:
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
if (typeof window !== 'undefined') {
|
|
378
|
-
window.dispatchEvent(new CustomEvent('hanzo:anon-prompt', { detail: { text: t('Create an image of ') } }));
|
|
379
|
-
}
|
|
380
|
-
}), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Images') }) }) }), _jsx(YStack, { role: "listitem", self: "flex-start", children: _jsx(SidebarItem, { "data-slot": "app-plugins", ...COMPACT_ROW, bg: "transparent", hoverStyle: { bg: '$hover' }, icon: _jsx(XStack, { width: 20, height: 20, items: "center", justify: "center", shrink: 0, children: _jsx(Puzzle, { size: 16, "aria-hidden": true }) }), onPress: () => {
|
|
381
|
-
setAnonSettings(false);
|
|
382
|
-
if (typeof window !== 'undefined') {
|
|
383
|
-
window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
|
|
384
|
-
}
|
|
385
|
-
}, ...keys(() => {
|
|
386
|
-
setAnonSettings(false);
|
|
387
|
-
if (typeof window !== 'undefined') {
|
|
388
|
-
window.dispatchEvent(new CustomEvent('hanzo:anon-plugins'));
|
|
389
|
-
}
|
|
390
|
-
}), children: _jsx(Text, { fontSize: "$3", color: "$ink", children: t('Plugins') }) }) })] })) : null] })) : mode === 'beta' && !drawer ? null : (_jsx(YStack, { "data-slot": "app-places", shrink: 0, pt: drawer ? 0 : 4, children: groups.map((g, i) => (_jsxs(YStack, { pt: i ? '$2' : 0, children: [i && g.label ? (_jsx(Text, { id: `${uid}-${g.id}`, paddingInlineStart: "$2", pb: 2, fontSize: "$3", color: "$soft", children: g.label })) : null, _jsx(YStack, { role: "list", "aria-labelledby": i && g.label ? `${uid}-${g.id}` : undefined, "aria-label": i && g.label ? undefined : g.label || (at ? t(TITLE[at]) : g.id), gap: 1, children: g.links.map((link) => (_jsx(YStack, { role: "listitem", width: "100%", minW: 0, children: _jsx(SidebarItem, { ...COMPACT_ROW, "data-place-id": link.id, ...(link.id === NEW ? { 'data-slot': 'app-new' } : {}), active: link.active, icon: link.icon || link.id === NEW ? (_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, children: link.icon ?? _jsx(Make, { size: 15, "aria-hidden": true }) })) : null, onPress: link.onPress, ...keys(() => link.onPress?.()), children: _jsx(Text, { fontSize: 14, lineHeight: 20, color: link.active ? '$ink' : '$quiet', numberOfLines: 1, children: link.label }) }) }, link.id))) })] }, g.id))) })), rail, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: 4 })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$3", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$3", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : mode === 'hosted' || mode === 'beta' || mode === 'tabs' || mode === 'studio' || mode === 'flow' || anon || at ? (_jsx(YStack, { flex: 1, minH: 0 })) : mode === 'design' ? (
|
|
391
|
-
// Design's own conversations, read and opened through the host Studio is mounted with.
|
|
392
|
-
made ? _jsx(Recents, { host: made, mode: "design", thread: null, onOpen: open, onNew: create }) : _jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), anon ? (_jsx(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: 10, children: _jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: "button", "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", cursor: "pointer", onPress: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, children: [_jsx(Text, { fontSize: 13, lineHeight: 18, fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: 12, lineHeight: 17, color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
|
|
664
|
+
: null), children: shown.map((item) => renderNavEntryWithSublinks(item, pinnedSet.has(item.id))) }) })) : null, rail, showRecents ? _jsx(XStack, { height: 1, bg: "$edge", mx: "$1.5", my: "$2", shrink: 0 }) : null, mode === 'beta' && !drawer ? (_jsx(YStack, { "data-slot": "beta-sidebar-slot", flex: 1, minH: 0, pt: "$2", mt: "$1.5", borderTopWidth: 1, borderColor: "$edge" })) : anon && mode === 'chat' && anonThreadTitle ? (_jsxs(YStack, { "data-slot": "recents", flex: 1, minH: 0, pt: "$3", children: [_jsx(Text, { paddingInlineStart: "$2", pb: "$1", fontSize: "$2", color: "$soft", children: t('Recents') }), _jsx(YStack, { role: "list", gap: 1, children: _jsx(YStack, { role: "listitem", children: _jsx(SidebarItem, { ...ROW, active: !anonSettingsOpen, onPress: () => setAnonSettings(false), children: _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: anonThreadTitle }) }) }) })] })) : !showRecents ? (_jsx(YStack, { flex: 1, minH: 0 })) : mode === 'design' ? (made ? _jsx(Recents, { host: made, mode: "design", thread: null, onOpen: open, onNew: create }) : _jsx(YStack, { flex: 1, minH: 0 })) : (_jsx(Recents, { host: host, mode: mode === 'dev' ? 'dev' : 'chat', thread: thread, onOpen: open, onNew: create })), showMore ? (_jsx(YStack, { "data-slot": "rail-unpinned", shrink: 0, pt: "$1", width: "100%", children: _jsx(MoreMenu, { placement: "top-start", minWidth: 220, maxHeight: 420, entries: nav.moreEntries, onPin: togglePin, t: t, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "place-more", "aria-label": t('More'), "aria-haspopup": "menu", width: "100%", minW: 0, minH: 34, px: "$2.5", py: 0, gap: "$2.5", $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", borderWidth: 0, items: "center", cursor: "pointer", bg: "transparent", hoverStyle: { bg: '$hover' }, pressStyle: { bg: '$raised' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(MoreHorizontal, { size: 15, "aria-hidden": true }) }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", fontWeight: "400", color: "$aside", numberOfLines: 1, text: "start", children: t('More') })] }) }) })) : null, anon ? (_jsxs(YStack, { "data-slot": "anon-foot", gap: "$2", pt: "$2", shrink: 0, z: "var(--z-raised)", children: [_jsxs(YStack, { "data-slot": "anon-tailored", gap: "$2", pt: "$1", pb: "$1", px: "$2", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "aria-expanded": tailoredOpen, "aria-label": t('Get responses tailored to you'), items: "center", justify: "space-between", gap: "$1.5", minH: 32, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, borderWidth: 0, bg: "transparent", cursor: "pointer", onClick: () => setTailoredOpen((v) => !v), hoverStyle: { opacity: 0.85 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$ink", numberOfLines: 1, flex: 1, text: "start", children: t('Get responses tailored to you') }), tailoredOpen ? (_jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })) : (_jsx(ChevronUp, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }))] }), tailoredOpen ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Log in to get answers based on saved chats, plus create images and upload files.') })) : null, _jsxs(XStack, { gap: "$2", pt: "$0.5", children: [_jsx(Button, { size: "sm", variant: "outline", flex: 1, rounded: 9999, "data-slot": "column-login", onPress: () => {
|
|
665
|
+
if (typeof window !== 'undefined')
|
|
666
|
+
window.location.assign('/login?next=%2Fchat');
|
|
667
|
+
}, children: t('Log in') }), _jsx(Button, { size: "sm", flex: 1, rounded: 9999, "data-slot": "column-signup", onPress: () => {
|
|
668
|
+
if (typeof window !== 'undefined')
|
|
669
|
+
window.location.assign('/signup?next=%2Fchat');
|
|
670
|
+
}, children: t('Sign up') })] })] }), !drawer ? (_jsxs(XStack, { items: "center", justify: "space-between", px: "$2", pt: "$1", borderTopWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "anon-pricing", onClick: () => {
|
|
393
671
|
if (typeof window !== 'undefined')
|
|
394
|
-
window.location.assign('/
|
|
395
|
-
},
|
|
672
|
+
window.location.assign('/pricing');
|
|
673
|
+
}, items: "center", gap: "$1", px: "$1.5", py: "$1", minH: 28, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$aside", children: t('Pricing') })] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "anon-help", onClick: () => {
|
|
396
674
|
if (typeof window !== 'undefined')
|
|
397
|
-
window.
|
|
398
|
-
},
|
|
675
|
+
window.open('https://docs.hanzo.ai', '_blank', 'noopener,noreferrer');
|
|
676
|
+
}, items: "center", gap: "$1", px: "$1.5", py: "$1", minH: 28, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(CircleHelp, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$aside", children: t('Help') })] }), _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "anon-settings", onClick: () => {
|
|
677
|
+
if (typeof window !== 'undefined') {
|
|
678
|
+
window.dispatchEvent(new CustomEvent('hanzo:anon-settings', { detail: { open: true } }));
|
|
679
|
+
}
|
|
680
|
+
}, items: "center", gap: "$1", px: "$1.5", py: "$1", minH: 28, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Settings, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$aside", children: t('Settings') })] })] })) : null] })) : at || mode === 'beta' || mode === 'hosted' ? null : devMode ? (_jsxs(YStack, { gap: "$2", pt: "$2", shrink: 0, minW: 0, maxW: "100%", children: [_jsx(Made, {}), _jsx(Setup, { go: go })] })) : (_jsx(Made, {})), _jsx(UpdatePill, {}), !anon && devMode ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "dev-mode-indicator", "aria-label": t('Turn off developer mode'), ...{ title: t('Click to turn off developer mode') }, onClick: () => setDevMode(false), items: "center", justify: "space-between", gap: "$2", px: "$2.5", py: "$1", mx: "$0.5", mt: "$1", minH: 28, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", bg: "$panel", borderWidth: 1, borderColor: "var(--border-strong)", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, shrink: 0, children: [_jsxs(XStack, { items: "center", gap: "$1.5", minW: 0, flex: 1, children: [_jsx(XStack, { width: 6, height: 6, rounded: 999, bg: "var(--state-online)", shrink: 0, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$ink", numberOfLines: 1, children: t('Developer mode · On') })] }), _jsx(Text, { fontSize: "$1", color: "$soft", shrink: 0, children: t('Off') })] })) : null, !anon && !drawer ? (_jsx(YStack, { "data-slot": "sidebar-account", pt: "$2", mt: "$1.5", borderTopWidth: 1, borderColor: "$edge", shrink: 0, children: _jsx(Account, { host: host, onOrg: handleOrg }) })) : null, foot] }), drawer ? null : (_jsx(Gutter, { side: dir === 'rtl' ? 'right' : 'left', span: span.span, floor: FLOOR, ceil: CEIL, reset: WIDTH, onSpan: span.move, onKeep: span.keep, onShut: onShut, label: t('Resize sidebar') }))] }) }));
|
|
399
681
|
}
|
|
400
682
|
function UpdatePill() {
|
|
401
683
|
const { t } = useI18n();
|
|
@@ -411,7 +693,7 @@ function UpdatePill() {
|
|
|
411
693
|
}, []);
|
|
412
694
|
if (!available)
|
|
413
695
|
return null;
|
|
414
|
-
return (_jsxs(XStack, { render: "button", "data-slot": "update-available",
|
|
696
|
+
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "update-available", onClick: () => window.location.reload(), items: "center", justify: "space-between", px: "$3", py: "$1.5", mx: "$1", mt: "$1.5", minH: 32, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", bg: "$hover", borderWidth: 1, borderColor: "$borderColor", cursor: "pointer", hoverStyle: { opacity: 0.9 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", children: t('Update available') }), _jsx(ArrowRight, { size: 13, "aria-hidden": true })] }));
|
|
415
697
|
}
|
|
416
698
|
function readAnonFlag(key, fallback = true) {
|
|
417
699
|
if (typeof window === 'undefined')
|
|
@@ -439,7 +721,6 @@ function writeAnonFlag(key, value) {
|
|
|
439
721
|
}
|
|
440
722
|
}
|
|
441
723
|
function AnonSwitch({ checked, onChange, label, slot, }) {
|
|
442
|
-
// The kit's switch: its track, thumb and focus ring are the system's, in both themes.
|
|
443
724
|
return _jsx(Switch, { checked: checked, onCheckedChange: onChange, "aria-label": label, "data-slot": slot });
|
|
444
725
|
}
|
|
445
726
|
export function AnonSettingsPane({ host, onClose, }) {
|
|
@@ -467,6 +748,7 @@ export function AnonSettingsPane({ host, onClose, }) {
|
|
|
467
748
|
label: t('Auto-detect'),
|
|
468
749
|
onSelect: () => {
|
|
469
750
|
setAutoLang(true);
|
|
751
|
+
speakIn(null);
|
|
470
752
|
},
|
|
471
753
|
},
|
|
472
754
|
...locales.map((loc) => ({
|
|
@@ -480,16 +762,16 @@ export function AnonSettingsPane({ host, onClose, }) {
|
|
|
480
762
|
},
|
|
481
763
|
})),
|
|
482
764
|
];
|
|
483
|
-
return (_jsxs(YStack, { "data-slot": "anon-settings-pane", flex: 1, minW: 0, minH: 0, overflowY: "auto", overflowX: "hidden", children: [_jsxs(XStack, { height: 56, px: "$4", items: "center", justify: "space-between", shrink: 0, children: [_jsx(XStack, { render: "button", "aria-label": t('Back'), "data-slot": "anon-settings-back", width: 36, height: 36, rounded: 9999, borderWidth: 0, items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: '$hover' },
|
|
765
|
+
return (_jsxs(YStack, { "data-slot": "anon-settings-pane", flex: 1, minW: 0, minH: 0, overflowY: "auto", overflowX: "hidden", children: [_jsxs(XStack, { height: 56, px: "$4", items: "center", justify: "space-between", shrink: 0, children: [_jsx(XStack, { render: _jsx("button", { type: "button" }), "aria-label": t('Back'), "data-slot": "anon-settings-back", width: 36, height: 36, $touchable: { minW: TOUCH, minH: TOUCH }, "$max-sm": { minW: TOUCH, minH: TOUCH }, rounded: 9999, borderWidth: 0, bg: "transparent", items: "center", justify: "center", cursor: "pointer", hoverStyle: { bg: '$hover' }, onClick: onClose, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": true }) }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: t('Settings') }), _jsx(XStack, { width: 36, height: 36 })] }), _jsxs(YStack, { width: "100%", maxW: 600, mx: "auto", px: "$4", py: "$5", gap: "$6", children: [_jsxs(YStack, { gap: "$2.5", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('General') }), _jsxs(YStack, { rounded: "$5", borderWidth: 1, borderColor: "$borderColor", bg: "var(--surface-card)", px: "$4", children: [_jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$3", children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: t('Appearance') }), _jsx(DropdownMenu, { minWidth: 160, items: themeItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "anon-settings-appearance", items: "center", gap: "$1.5", px: "$2.5", py: "$1.5", minH: 32, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", borderWidth: 0, bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: themeLabel }), _jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })] }) })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$3", children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: t('Language') }), _jsx(DropdownMenu, { minWidth: 200, items: langItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "anon-settings-language", items: "center", gap: "$1.5", px: "$2.5", py: "$1.5", minH: 32, $touchable: { minH: TOUCH }, "$max-sm": { minH: TOUCH }, rounded: "$3", borderWidth: 0, bg: "transparent", cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)' }, children: [_jsx(Text, { fontSize: "$3", color: "$ink", children: langLabel }), _jsx(ChevronDown, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" })] }) })] })] })] }), _jsxs(YStack, { gap: "$2.5", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", children: t('Data controls') }), _jsxs(YStack, { rounded: "$5", borderWidth: 1, borderColor: "$borderColor", bg: "var(--surface-card)", px: "$4", children: [_jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: t('Improve the model for everyone') }), _jsxs(Text, { fontSize: "$1", color: "$soft", children: [t('Allow your content to be used to train our models, which makes Hanzo better for you and everyone who uses it. We take steps to protect your privacy.'), ' ', _jsx(Text, { render: "a", ...{ href: '/privacy', target: '_blank', rel: 'noopener noreferrer' }, fontSize: "$1", color: "$ink", textDecorationLine: "none", children: t('Learn more') })] })] }), _jsx(AnonSwitch, { checked: improveModel, label: t('Improve the model for everyone'), slot: "anon-switch-improve", onChange: (next) => {
|
|
484
766
|
setImproveModel(next);
|
|
485
767
|
writeAnonFlag('hanzo.anon.improve_model', next);
|
|
486
|
-
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize:
|
|
768
|
+
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: t('Personalize ads') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('Allow Hanzo to use your past chats, activity, and preferences to select ads. Ads may still be based on your current chat.') })] }), _jsx(AnonSwitch, { checked: personalizeAds, label: t('Personalize ads'), slot: "anon-switch-ads", onChange: (next) => {
|
|
487
769
|
setPersonalizeAds(next);
|
|
488
770
|
writeAnonFlag('hanzo.anon.personalize_ads', next);
|
|
489
|
-
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize:
|
|
771
|
+
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: t('Marketing measurement') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('These cookies help us measure the effectiveness of our marketing campaigns.') })] }), _jsx(AnonSwitch, { checked: marketingMeasurement, label: t('Marketing measurement'), slot: "anon-switch-measurement", onChange: (next) => {
|
|
490
772
|
setMarketingMeasurement(next);
|
|
491
773
|
writeAnonFlag('hanzo.anon.marketing_measurement', next);
|
|
492
|
-
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize:
|
|
774
|
+
} })] }), _jsxs(XStack, { py: "$3.5", items: "center", justify: "space-between", gap: "$4", children: [_jsxs(YStack, { flex: 1, minW: 0, gap: "$1", children: [_jsx(Text, { fontSize: "$3", fontWeight: "500", color: "$ink", children: t('Personalized marketing') }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t("This helps us personalize and measure Hanzo's own marketing on third-party platforms.") })] }), _jsx(AnonSwitch, { checked: personalizedMarketing, label: t('Personalized marketing'), slot: "anon-switch-marketing", onChange: (next) => {
|
|
493
775
|
setPersonalizedMarketing(next);
|
|
494
776
|
writeAnonFlag('hanzo.anon.personalized_marketing', next);
|
|
495
777
|
} })] })] })] })] })] }));
|