@hanzo/app 0.3.94 → 0.3.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +114 -48
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/PreferencesDialog.js +5 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.d.ts +10 -0
- package/dist/Shell.js +258 -158
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +16 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +71 -25
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +9 -3
- package/dist/bots/grid.d.ts +36 -0
- package/dist/bots/grid.js +91 -0
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +9 -4
- package/dist/bots/kit.js +3 -2
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +2 -2
- package/dist/ground.js +3 -3
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/durable.d.ts +1 -1
- package/dist/lib/durable.js +1 -1
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +7 -1
- package/dist/lib/todo.js +41 -29
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/seek.d.ts +6 -1
- package/dist/seek.js +13 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/Shell.js
CHANGED
|
@@ -17,23 +17,24 @@ import { createContext, lazy, Suspense, useCallback, useContext, useEffect, useM
|
|
|
17
17
|
import { createPortal } from "react-dom";
|
|
18
18
|
import { phrase } from "@hanzo/i18n";
|
|
19
19
|
import { useI18n } from "@hanzo/i18n/react";
|
|
20
|
-
import { MessageSquare, Code2, Inbox, Bot, ListChecks, HardDrive,
|
|
20
|
+
import { MessageSquare, Code2, Inbox, Bot, ListChecks, HardDrive, Settings, UserPlus, SearchIcon, Hash, AtSign, Lock, Workflow, Plus, ArrowLeft, ArrowRight, Send, Minus, Blocks, Star, FolderOpen, Activity, BookOpen, Share2, PanelLeft, PanelRight, Users, Globe, Cpu, Boxes, Wallet, Video, Calendar, LayoutGrid, ArrowUpLeft, Building2, ChevronDown, LogOut, Sparkles, } from "lucide-react";
|
|
21
21
|
import { AiProvider, useAgents, useInbox, useModels, usePeople, } from "@hanzo/ai/react";
|
|
22
22
|
import { PINNED } from "./recent.js";
|
|
23
23
|
import { ConversationMenu, ThreadRow, useThreadList } from "./thread.js";
|
|
24
24
|
import { useKept } from "./kept.js";
|
|
25
|
-
import { Box, Shortcut, XStack, YStack,
|
|
25
|
+
import { Badge, Box, Button, DropdownMenu, HoverCard, HoverCardContent, HoverCardTrigger, Progress, Shortcut, Switch, Text, toast, View, XStack, YStack, } from "@hanzo/ui";
|
|
26
26
|
// THE PAPER LADDER. `sheet(n)` is a fill AND the light on it, published as a
|
|
27
27
|
// pair by @hanzo/design, so a surface asks for a HEIGHT instead of composing a
|
|
28
28
|
// shadow — which is the only way three panels on one screen end up lit from one
|
|
29
29
|
// direction. `scrim` is the dim under anything that lifts off the page.
|
|
30
30
|
import { scrim, sheet } from "@hanzo/ui/glass";
|
|
31
31
|
import { Sidebar, SidebarIconButton, SidebarNewChat, SidebarScroll, SidebarSection, SidebarItem, SidebarFolder, } from "@hanzo/ui/chat";
|
|
32
|
-
import {
|
|
32
|
+
import { useIam, useOrganizations, } from "@hanzo/iam/react";
|
|
33
33
|
import { Gutter, SideProvider, useSplit } from "@hanzo/build";
|
|
34
|
+
import { label as planLabel } from "@hanzo/build/plan";
|
|
34
35
|
import { restoreActiveMod } from "@hanzo/mod";
|
|
35
36
|
import { HanzoMark, } from "@hanzogui/shell";
|
|
36
|
-
import { BUSINESS_APPS
|
|
37
|
+
import { BUSINESS_APPS } from "@hanzo/ui/product";
|
|
37
38
|
import { useAccounts } from "./lib/accounts.js";
|
|
38
39
|
import { useHydrated } from "./lib/hydrated.js";
|
|
39
40
|
import { useHostname } from "./lib/hostname.js";
|
|
@@ -54,9 +55,13 @@ import { parseModels } from "@hanzo/ui/models/catalog";
|
|
|
54
55
|
import { mark } from "./lib/mark.js";
|
|
55
56
|
import { useOpen } from "./open.js";
|
|
56
57
|
import { useSpan } from "./span.js";
|
|
57
|
-
import {
|
|
58
|
+
import { pane, RAIL, SIDE } from "./ground.js";
|
|
58
59
|
import { useFree } from "./Upgrade.js";
|
|
59
60
|
import { payUrl } from "./lib/pay.js";
|
|
61
|
+
import { rememberSettingsReturn, useDevMode } from "./lib/dev-mode.js";
|
|
62
|
+
import { useLimits } from "./lib/limits.js";
|
|
63
|
+
import { cents } from "./lib/org.js";
|
|
64
|
+
import { useTier } from "./lib/tier.js";
|
|
60
65
|
/** The new-agent row's fields: an outlined box in the shell's own ink. */
|
|
61
66
|
const FIELD = {
|
|
62
67
|
bg: "transparent",
|
|
@@ -79,17 +84,18 @@ import { Face } from "./cast.js";
|
|
|
79
84
|
import { useStarred, titleOf } from "./stars.js";
|
|
80
85
|
import { channelName } from "./network.js";
|
|
81
86
|
import { useChannels, teamKey, channelHref } from "./channels.js";
|
|
82
|
-
import { apex, app, away, chat, CHAT as TALK, dev, ENTRY, leaves, WORKSPACE } from "./lib/host.js";
|
|
87
|
+
import { apex, app, away, chat, CHAT as TALK, dev, ENTRY, FLOW, leaves, WORKSPACE } from "./lib/host.js";
|
|
83
88
|
import { netKey } from "./conversations.js";
|
|
84
89
|
import { FIRST, SettingsList, } from "./Settings.js";
|
|
85
90
|
import { Search } from "./Search.js";
|
|
86
91
|
import { tidy } from "./lib/title.js";
|
|
87
|
-
import {
|
|
92
|
+
import { MAIN, SkipLink } from "./SkipLink.js";
|
|
93
|
+
import { useSidebar } from "./rail-open.js";
|
|
94
|
+
import { useGlobalKeys } from "./keys.js";
|
|
95
|
+
import { useDevHost } from "./dev.js";
|
|
88
96
|
import { called } from "./team.js";
|
|
89
97
|
import { checkoutUrl } from './lib/pay.js';
|
|
90
98
|
import { dragWindow, toggleWindowMaximize, WindowControls } from './WindowControls.js';
|
|
91
|
-
/** Tabs: the terminals, at their own host. */
|
|
92
|
-
const TABS = "https://tabs.hanzo.ai/app";
|
|
93
99
|
/** Where a plan is chosen. `lib/plans` owns the address; this is the door. */
|
|
94
100
|
const BILLING = checkoutUrl();
|
|
95
101
|
/**
|
|
@@ -123,11 +129,13 @@ const TAP = { minWidth: 44, minHeight: 44 };
|
|
|
123
129
|
* element that also carries the border makes the target visible, which is how
|
|
124
130
|
* the sign-in button came to stand half again as tall as the field beside it. */
|
|
125
131
|
const CONTROL = 28;
|
|
132
|
+
/** The workspace shell's top bar height, px: accommodates 44px touch targets without clipping. */
|
|
133
|
+
const SHELL_BAR = 48;
|
|
126
134
|
import { getStoredPeople, getStoredAgents, getCustomThreads, createDirectChat, } from "./contacts-store.js";
|
|
127
135
|
import { bare } from './lib/bare.js';
|
|
128
136
|
import { BAD } from './lib/mix.js';
|
|
129
|
-
import { brand, site, where
|
|
130
|
-
import { Tiles } from './OrgSwitcher.js';
|
|
137
|
+
import { brand, site, where } from './where.js';
|
|
138
|
+
import { Tiles, TopOrgSelector } from './OrgSwitcher.js';
|
|
131
139
|
/** The pane while a settings row is open, loaded when one is: none of it is an app's first screen. */
|
|
132
140
|
const SettingsPane = lazy(() => import('./SettingsPane.js').then((m) => ({ default: m.SettingsPane })));
|
|
133
141
|
/**
|
|
@@ -218,7 +226,7 @@ const PLACES = [
|
|
|
218
226
|
{
|
|
219
227
|
id: "contacts",
|
|
220
228
|
route: "/contacts",
|
|
221
|
-
title: phrase("People &
|
|
229
|
+
title: phrase("People & agents"),
|
|
222
230
|
label: phrase("Contacts"),
|
|
223
231
|
icon: Users,
|
|
224
232
|
},
|
|
@@ -447,7 +455,7 @@ function Chats({ filter = "", onPick, }) {
|
|
|
447
455
|
}, []);
|
|
448
456
|
const { isAuthenticated, user } = useIam();
|
|
449
457
|
const { user: account } = useAccount();
|
|
450
|
-
const {
|
|
458
|
+
const { current: currentBrowserAccount } = useAccounts();
|
|
451
459
|
const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
|
|
452
460
|
const free = useFree(signedIn);
|
|
453
461
|
const mergedThreads = useMemo(() => {
|
|
@@ -669,7 +677,7 @@ function Team({ filter = "", onPick, navigate, }) {
|
|
|
669
677
|
const { channels, wrong } = useChannels();
|
|
670
678
|
const { isAuthenticated, user } = useIam();
|
|
671
679
|
const { user: account } = useAccount();
|
|
672
|
-
const {
|
|
680
|
+
const { current: currentBrowserAccount } = useAccounts();
|
|
673
681
|
const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
|
|
674
682
|
const free = useFree(signedIn);
|
|
675
683
|
const [starred] = useStarred();
|
|
@@ -696,15 +704,15 @@ function Team({ filter = "", onPick, navigate, }) {
|
|
|
696
704
|
openChannel(teamKey(one));
|
|
697
705
|
navigate?.(channelHref(teamKey(one)));
|
|
698
706
|
onPick?.();
|
|
699
|
-
}, children: one.name }, one.id))) })) : null, publicChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Public
|
|
707
|
+
}, children: one.name }, one.id))) })) : null, publicChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Public channels"), defaultOpen: true, children: publicChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Globe, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
700
708
|
openChannel(teamKey(one));
|
|
701
709
|
navigate?.(channelHref(teamKey(one)));
|
|
702
710
|
onPick?.();
|
|
703
|
-
}, children: one.name }, one.id))) })) : null, orgChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Org
|
|
711
|
+
}, children: one.name }, one.id))) })) : null, orgChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Org channels"), defaultOpen: true, children: orgChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Hash, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
704
712
|
openChannel(teamKey(one));
|
|
705
713
|
navigate?.(channelHref(teamKey(one)));
|
|
706
714
|
onPick?.();
|
|
707
|
-
}, children: one.name }, one.id))) })) : null, privateChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Private
|
|
715
|
+
}, children: one.name }, one.id))) })) : null, privateChannels.length > 0 ? (_jsx(SidebarFolder, { name: t("Private channels"), defaultOpen: true, children: privateChannels.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Lock, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
708
716
|
openChannel(teamKey(one));
|
|
709
717
|
navigate?.(channelHref(teamKey(one)));
|
|
710
718
|
onPick?.();
|
|
@@ -885,15 +893,15 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
885
893
|
setBusy(false);
|
|
886
894
|
}
|
|
887
895
|
};
|
|
888
|
-
return (_jsxs(YStack, { children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$3", py: "$1", rounded: "$2", hoverStyle: { bg: "$hover" }, children: [_jsx(Box, { render: "button", onClick: () => navigate?.(show === "agents" ? "/bots" : "/contacts"), flex: 1, minW: 0, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$
|
|
896
|
+
return (_jsxs(YStack, { children: [_jsxs(XStack, { items: "center", gap: "$1.5", px: "$3", py: "$1", rounded: "$2", hoverStyle: { bg: "$hover" }, children: [_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => navigate?.(show === "agents" ? "/bots" : "/contacts"), flex: 1, minW: 0, minH: 28, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, borderWidth: 0, bg: "transparent", cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Text, { fontSize: "$1", fontWeight: "500", color: "$soft", numberOfLines: 1, children: t(show === "agents" ? "Agents" : "People") }), folk.length + shown.length > 0 ? (_jsx(Text, { fontSize: "$1", color: "$hint", fontVariant: ["tabular-nums"], "data-i18n-ltr": "", children: folk.length + shown.length })) : null] }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: (e) => {
|
|
889
897
|
e.stopPropagation();
|
|
890
898
|
setSortMode((m) => (m === "alpha" ? "recent" : "alpha"));
|
|
891
|
-
}, title: t(sortMode === "alpha" ? "Sorting A-Z (Click for Recent)" : "Sorting Recent (Click for A-Z)"), px: "$1.5", py: "$0.5", rounded: "$1", bg: "$raised", hoverStyle: { opacity: 0.8 }, display: "flex", items: "center", justify: "center", $touchable: { minH:
|
|
899
|
+
}, title: t(sortMode === "alpha" ? "Sorting A-Z (Click for Recent)" : "Sorting Recent (Click for A-Z)"), px: "$1.5", py: "$0.5", rounded: "$1", borderWidth: 0, bg: "$raised", cursor: "pointer", hoverStyle: { opacity: 0.8 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, display: "flex", items: "center", justify: "center", $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: t(sortMode === "alpha" ? "A-Z" : "Recent") }) }), show === "agents" ? (_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
892
900
|
if (busy)
|
|
893
901
|
return;
|
|
894
902
|
setOpen(true);
|
|
895
903
|
setMaking((v) => !v);
|
|
896
|
-
}, "aria-disabled": busy, "aria-expanded": making, "aria-label": t("New agent"), p: "$1", rounded: "$2", hoverStyle: { bg: "$raised" }, children: _jsx(Plus, { size: 14, "aria-hidden": true }) })) : null] }), open && making ? (_jsxs(YStack, { paddingInlineStart: "$4", paddingInlineEnd: "$3", py: "$2", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { render: "button", onClick: () => picking.current?.click(), "aria-label": t("Pick a picture"), rounded: 9999, children: _jsx(Face, { src: avatar, emoji: emoji, name: name || "?", size: 32, person: true }) }), _jsx("input", { ref: picking, type: "file", hidden: true, accept: "image/png,image/jpeg,image/gif,image/webp", onChange: (e) => {
|
|
904
|
+
}, "aria-disabled": busy, "aria-expanded": making, "aria-label": t("New agent"), p: "$1", rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", display: "flex", items: "center", justify: "center", $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, hoverStyle: { bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Plus, { size: 14, "aria-hidden": true }) })) : null] }), open && making ? (_jsxs(YStack, { paddingInlineStart: "$4", paddingInlineEnd: "$3", py: "$2", gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => picking.current?.click(), "aria-label": t("Pick a picture"), rounded: 9999, borderWidth: 0, bg: "transparent", cursor: "pointer", $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Face, { src: avatar, emoji: emoji, name: name || "?", size: 32, person: true }) }), _jsx("input", { ref: picking, type: "file", hidden: true, accept: "image/png,image/jpeg,image/gif,image/webp", onChange: (e) => {
|
|
897
905
|
void pick(e.target.files?.[0]);
|
|
898
906
|
e.target.value = "";
|
|
899
907
|
} }), _jsx(Text, { render: _jsx("input", { value: name, onChange: (e) => setName(e.target.value), onKeyDown: (e) => {
|
|
@@ -905,10 +913,10 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
905
913
|
setEmoji(e.target.value);
|
|
906
914
|
if (e.target.value)
|
|
907
915
|
setAvatar("");
|
|
908
|
-
}, placeholder: "\uD83D\uDE42", "aria-label": t("Emoji") }), ...FIELD, width: 44, text: "center", px: 4 }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(ModelPicker, { models: listed, scope: "chat", value: model, onChange: setModel, size: "sm", placeholder: t("Choose a model"), name: t("Model") }) }), _jsx(Box, { render: "button", onClick: () => {
|
|
916
|
+
}, placeholder: "\uD83D\uDE42", "aria-label": t("Emoji") }), ...FIELD, width: 44, text: "center", px: 4 }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(ModelPicker, { models: listed, scope: "chat", value: model, onChange: setModel, size: "sm", placeholder: t("Choose a model"), name: t("Model") }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
909
917
|
if (!busy)
|
|
910
918
|
void add();
|
|
911
|
-
}, "aria-disabled": busy || !name.trim(), opacity: busy || !name.trim() ? 0.5 : 1, px: "$2.5", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: "$raised" }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t(busy ? "Adding" : "Add") }) })] }), wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 2, children: wrong })) : null] })) : null, open ? (_jsxs(YStack, { paddingInlineStart: "$4", gap: "$0.5", children: [broke ? (_jsx(Note, { children: say(broke, t("this org's roster"), "read", t) })) : waiting && empty ? (_jsx(Note, { children: t("Reading the roster.") })) : empty ? (_jsx(Note, { children: t(show === "agents" ? "No agents yet. Add one with +." : "No one here yet. Invite a teammate.") })) : null, folk.map((person) => {
|
|
919
|
+
}, "aria-disabled": busy || !name.trim(), opacity: busy || !name.trim() ? 0.5 : 1, px: "$2.5", py: "$1.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, rounded: "$2", borderWidth: 1, borderColor: "$borderColor", bg: "transparent", cursor: "pointer", hoverStyle: { bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t(busy ? "Adding" : "Add") }) })] }), wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 2, children: wrong })) : null] })) : null, open ? (_jsxs(YStack, { paddingInlineStart: "$4", gap: "$0.5", children: [broke ? (_jsx(Note, { children: say(broke, t("this org's roster"), "read", t) })) : waiting && empty ? (_jsx(Note, { children: t("Reading the roster.") })) : empty ? (_jsx(Note, { children: t(show === "agents" ? "No agents yet. Add one with +." : "No one here yet. Invite a teammate.") })) : null, folk.map((person) => {
|
|
912
920
|
const called = person.displayName || person.name;
|
|
913
921
|
return (_jsx(SidebarItem, { icon: _jsx(Face, { name: called, src: person.avatar, size: 20, person: true }), onPress: () => {
|
|
914
922
|
const threadId = createDirectChat({
|
|
@@ -932,7 +940,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
932
940
|
withAgents([called(agent.name)]);
|
|
933
941
|
navigate?.("/chat");
|
|
934
942
|
onPick?.();
|
|
935
|
-
}, children: called(agent.name) }) }), _jsx(Box, { render: "button", onClick: () => {
|
|
943
|
+
}, children: called(agent.name) }) }), _jsx(Box, { render: _jsx("button", { type: "button" }), onClick: () => {
|
|
936
944
|
if (busy)
|
|
937
945
|
return;
|
|
938
946
|
if (arming === agent.id)
|
|
@@ -941,7 +949,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
941
949
|
setArming(agent.id);
|
|
942
950
|
}, "aria-label": arming === agent.id
|
|
943
951
|
? t("Remove {name}", { name: called(agent.name) })
|
|
944
|
-
: t("Remove {name}?", { name: called(agent.name) }), p: "$1", rounded: "$2", opacity: arming === agent.id ? 1 : 0.45, hoverStyle: { opacity: 1, bg: "$raised" }, children: arming === agent.id ? (_jsx(Text, { fontSize: "$1", color: BAD, children: t("Remove") })) : (_jsx(Minus, { size: 13, "aria-hidden": true })) })] }, agent.id))), _jsx(SidebarItem, { icon: _jsx(Blocks, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
952
|
+
: t("Remove {name}?", { name: called(agent.name) }), p: "$1", $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", opacity: arming === agent.id ? 1 : 0.45, hoverStyle: { opacity: 1, bg: "$raised" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: arming === agent.id ? (_jsx(Text, { fontSize: "$1", color: BAD, children: t("Remove") })) : (_jsx(Minus, { size: 13, "aria-hidden": true })) })] }, agent.id))), _jsx(SidebarItem, { icon: _jsx(Blocks, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
945
953
|
setArming(null);
|
|
946
954
|
onPick?.();
|
|
947
955
|
navigate?.("/contacts");
|
|
@@ -951,11 +959,11 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
951
959
|
const TABS_HEIGHT = "calc(56px + env(safe-area-inset-bottom))";
|
|
952
960
|
/** The sidebar's width, px: the floor a drag holds, the ceiling, and the default a double-click returns to. */
|
|
953
961
|
const FLOOR = 200;
|
|
954
|
-
const CEIL =
|
|
962
|
+
const CEIL = 420;
|
|
955
963
|
/** Per-reader, per-browser. A width that resets is a width you set every load. */
|
|
956
|
-
const SPAN = "hanzo.
|
|
957
|
-
/** The shell's sidebar: its default width, px. */
|
|
958
|
-
const SIDEBAR_WIDTH =
|
|
964
|
+
const SPAN = "hanzo.app.column";
|
|
965
|
+
/** The shell's sidebar: its default width, px (unified with ground.ts SIDE). */
|
|
966
|
+
export const SIDEBAR_WIDTH = SIDE;
|
|
959
967
|
/**
|
|
960
968
|
* Where an app's own column goes, when it has one.
|
|
961
969
|
*
|
|
@@ -1015,17 +1023,18 @@ export function Split({ children, swap, framed = false, bare = false, }) {
|
|
|
1015
1023
|
if (!aside)
|
|
1016
1024
|
setSlot(null);
|
|
1017
1025
|
}, [aside]);
|
|
1018
|
-
return (_jsxs(_Fragment, { children: [_jsxs(YStack, {
|
|
1026
|
+
return (_jsxs(_Fragment, { children: [_jsxs(YStack, { ...MAIN, "data-slot": "pane", gridArea: "pane", position: "relative", ...(framed
|
|
1019
1027
|
? bare
|
|
1020
1028
|
? null
|
|
1021
1029
|
: { ...pane(), overflow: "hidden" }
|
|
1022
1030
|
: {
|
|
1023
1031
|
...sheet(0),
|
|
1032
|
+
backgroundColor: "var(--pane-fill, var(--card))",
|
|
1024
1033
|
// The edge the pane shares with the column before it: the left, or the right in a right-to-left language.
|
|
1025
1034
|
borderInlineStartWidth: 1,
|
|
1026
1035
|
borderInlineStartStyle: "solid",
|
|
1027
|
-
borderColor: "var(--edge, var(--
|
|
1028
|
-
}), ref: split.main, width: "100%", height: "100%", minW: 0, minH: 0, children: [swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })), !aside && !swap ? (_jsx(YStack, { "data-slot": "side-pull", "aria-
|
|
1036
|
+
borderColor: "var(--pane-edge, var(--edge, var(--border)))",
|
|
1037
|
+
}), ref: split.main, width: "100%", height: "100%", minW: 0, minH: 0, children: [swap ?? (_jsx(Framed.Provider, { value: framed, children: _jsx(SideProvider, { value: split.side, children: _jsx(Slot.Provider, { value: slot, children: children }) }) })), !aside && !swap ? (_jsx(YStack, { "data-slot": "side-pull", "aria-hidden": true, ...{ title: t("Drag to open split browser") }, position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: 10, z: 10, items: "center", justify: "center", cursor: "col-resize", display: "none", $lg: { display: "flex" }, ...{ touchAction: "none" }, onDoubleClick: () => showAside("tasks"), onPointerDown: (e) => {
|
|
1029
1038
|
if (e.button !== 0)
|
|
1030
1039
|
return;
|
|
1031
1040
|
e.preventDefault();
|
|
@@ -1081,26 +1090,58 @@ function Leave({ href, children }) {
|
|
|
1081
1090
|
window.location.assign(href);
|
|
1082
1091
|
}, children: children }));
|
|
1083
1092
|
}
|
|
1084
|
-
function
|
|
1093
|
+
function ShellProfileHover({ name, email, avatar, orgId, signedIn, onSettings, onSignOut, children, }) {
|
|
1085
1094
|
const { t } = useI18n();
|
|
1086
|
-
|
|
1095
|
+
const [devMode, setDevMode] = useDevMode();
|
|
1096
|
+
const { limits } = useLimits(signedIn, orgId || null);
|
|
1097
|
+
const { tier } = useTier(signedIn && Boolean(orgId), orgId || null);
|
|
1098
|
+
const planInfo = limits?.plan
|
|
1099
|
+
? planLabel(limits.plan)
|
|
1100
|
+
: tier?.plan
|
|
1101
|
+
? planLabel(tier.plan)
|
|
1102
|
+
: null;
|
|
1103
|
+
const planName = planInfo
|
|
1104
|
+
? `${planInfo.name}${planInfo.tag ? ` ${planInfo.tag}` : ""}`
|
|
1105
|
+
: tier?.tier?.displayName || t("Free");
|
|
1106
|
+
const classEntries = limits ? Object.values(limits.classes).filter(Boolean) : [];
|
|
1107
|
+
const highestUsage = classEntries.length
|
|
1108
|
+
? Math.round(Math.max(0, ...classEntries.flatMap((c) => (c ? [c.percent, ...(c.window ? [c.window.percent] : [])] : []))))
|
|
1109
|
+
: null;
|
|
1110
|
+
const hasCredits = typeof tier?.balance?.effectiveAvailable === "number";
|
|
1111
|
+
const creditsLabel = hasCredits
|
|
1112
|
+
? cents(tier.balance.effectiveAvailable, tier.balance.currency || "usd")
|
|
1113
|
+
: null;
|
|
1114
|
+
return (_jsxs(HoverCard, { openDelay: 120, closeDelay: 150, children: [_jsx(HoverCardTrigger, { asChild: true, children: children }), _jsx(HoverCardContent, { side: "top", align: "start", sideOffset: 8, width: 264, p: "$3.5", rounded: "$5", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", z: "var(--z-popover)", children: _jsxs(YStack, { gap: "$3", minW: 0, children: [_jsxs(XStack, { items: "center", gap: "$2.5", minW: 0, children: [_jsx(Face, { src: avatar, name: name || "You", size: 32, person: true }), _jsxs(YStack, { flex: 1, minW: 0, gap: 1, children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: name || t("You") }), email && email !== name ? (_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$hint", numberOfLines: 1, children: email })) : null] }), _jsx(Badge, { variant: "secondary", size: "sm", children: planName })] }), _jsxs(YStack, { gap: "$1.5", children: [_jsxs(XStack, { justify: "space-between", items: "baseline", gap: "$2", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", children: t("Plan usage") }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$ink", fontVariant: ["tabular-nums"], children: highestUsage !== null ? `${highestUsage}%` : t("Included") })] }), _jsx(Progress, { value: Math.min(100, highestUsage ?? 0), height: 4, indicatorColor: (highestUsage ?? 0) >= 90
|
|
1115
|
+
? "var(--state-error)"
|
|
1116
|
+
: "var(--state-success)", "aria-label": t("Plan usage") }), creditsLabel ? (_jsxs(XStack, { justify: "space-between", items: "center", pt: "$0.5", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$1", color: "$aside", children: t("Extra credits") }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: "$ink", fontVariant: ["tabular-nums"], children: creditsLabel })] })) : null] }), _jsx(View, { height: 1, bg: "$edge" }), _jsxs(XStack, { justify: "space-between", items: "center", gap: "$2", children: [_jsx(Text, { fontFamily: "$body", fontSize: "$2", color: "$ink", children: t("Developer mode") }), _jsx(Switch, { checked: devMode, onCheckedChange: setDevMode, size: "sm", "aria-label": t("Developer mode") })] }), _jsxs(XStack, { gap: "$2", children: [_jsx(Button, { type: "button", size: "xs", variant: "outline", borderColor: "var(--border-strong)", flex: 1, onClick: () => {
|
|
1117
|
+
rememberSettingsReturn();
|
|
1118
|
+
onSettings();
|
|
1119
|
+
}, children: _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "$ink", children: t("Settings") }) }), _jsxs(Button, { type: "button", size: "xs", flex: 1, onClick: () => {
|
|
1120
|
+
window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
|
|
1121
|
+
}, children: [_jsx(Sparkles, { size: 12, "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "600", color: "var(--primary-foreground)", children: t("Upgrade") })] })] }), onSignOut ? (_jsxs(XStack, { render: _jsx("button", { type: "button" }), onClick: onSignOut, items: "center", gap: "$2", px: "$2", py: "$1.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(LogOut, { size: 13, color: "var(--state-error)", "aria-hidden": true }), _jsx(Text, { fontFamily: "$body", fontSize: "$1", fontWeight: "500", color: "var(--state-error)", children: t("Sign out") })] })) : null] }) })] }));
|
|
1122
|
+
}
|
|
1123
|
+
function Rail({ mode, places, team, open, hiddenOnDesktop = false, navigate, onMore, avatarSlot, }) {
|
|
1124
|
+
const { t } = useI18n();
|
|
1125
|
+
return (_jsxs(YStack, { "data-slot": "rail", render: "nav", "aria-label": t("Places"), ...sheet(0), bg: "var(--side-fill, var(--background))", gridArea: "rail", minH: 0, borderInlineEndWidth: 1, borderInlineEndStyle: "solid", borderColor: "var(--pane-edge, var(--edge, var(--white-08)))", $md: hiddenOnDesktop ? { display: "none" } : undefined, "$max-md": {
|
|
1087
1126
|
flexDirection: "row",
|
|
1088
1127
|
items: "center",
|
|
1089
1128
|
borderInlineEndWidth: 0,
|
|
1090
1129
|
borderTopWidth: 1,
|
|
1091
|
-
borderTopColor: "var(--
|
|
1130
|
+
borderTopColor: "var(--pane-edge, var(--white-08))",
|
|
1092
1131
|
},
|
|
1093
1132
|
// Clear of the home indicator on a phone; zero on a flat screen.
|
|
1094
|
-
pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--edge, var(--white-
|
|
1133
|
+
pb: HOME_INDICATOR, children: [_jsx(YStack, { "$max-md": { display: "none" }, borderBottomWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", mx: "$2", children: _jsx(Tiles, {}) }), _jsxs(YStack, { "data-slot": "places", ...bare, items: "center", gap: "$0.5", flex: 1, minW: 0, minH: 0, overflowY: "auto", overflowX: "hidden", pt: "$2", $md: open ? { display: "none" } : undefined, "$max-md": {
|
|
1095
1134
|
display: "grid",
|
|
1096
1135
|
gridAutoFlow: "column",
|
|
1097
1136
|
gridAutoColumns: "minmax(0, 1fr)",
|
|
1098
1137
|
justifyItems: "stretch",
|
|
1099
1138
|
overflow: "hidden",
|
|
1139
|
+
pt: 0,
|
|
1140
|
+
px: "$1",
|
|
1100
1141
|
}, children: [places.map((place, i) => {
|
|
1101
1142
|
const here = place.id === mode;
|
|
1102
|
-
return (_jsxs(Box, { render: "button", onClick: () => navigate?.(place.route), "aria-label": t(place.label), "aria-current": here ? "page" : undefined, title: place.name ?? (place.title ? t(place.title) : t(place.label)), display: "flex", "$max-md": { display: i < 4 ? "flex" : "none", width: "auto", minW: 0 }, flexDirection: "column", width: 40, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, bg: here ? "$
|
|
1103
|
-
}), team ? (_jsx(XStack, { "$max-md": { display: places.length < 4 ? "flex" : "none", width: "auto", minW: 0 }, children: _jsx(Text, { render: _jsx("a", { href: team, "aria-label": t("Workspace"), title: "Hanzo Team" }), display: "flex", width: RAIL, color: "inherit", children: _jsxs(Box, { display: "flex", flex: 1, flexDirection: "column", minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(LayoutGrid, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize:
|
|
1143
|
+
return (_jsxs(Box, { render: _jsx("button", { type: "button" }), onClick: () => navigate?.(place.route), "aria-label": t(place.label), "aria-current": here ? "page" : undefined, title: place.name ?? (place.title ? t(place.title) : t(place.label)), display: "flex", "$max-md": { display: i < 4 ? "flex" : "none", width: "auto", minW: 0 }, flexDirection: "column", width: 40, minH: 44, py: "$1", rounded: "$2", borderWidth: 0, items: "center", justify: "center", gap: 2, cursor: "pointer", bg: here ? "$raised" : "transparent", hoverStyle: { bg: here ? "$raised" : "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(place.icon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, fontWeight: here ? "500" : "400", color: here ? "$ink" : "$quiet", numberOfLines: 1, children: t(place.label) })] }, place.id));
|
|
1144
|
+
}), team ? (_jsx(XStack, { "$max-md": { display: places.length < 4 ? "flex" : "none", width: "auto", minW: 0 }, children: _jsx(Text, { render: _jsx("a", { href: team, "aria-label": t("Workspace"), title: "Hanzo Team" }), display: "flex", width: RAIL, color: "inherit", children: _jsxs(Box, { display: "flex", flex: 1, flexDirection: "column", minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(LayoutGrid, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, color: "$quiet", numberOfLines: 1, children: t("Workspace") })] }) }) })) : null, _jsxs(Box, { "data-slot": "more", render: _jsx("button", { type: "button" }), onClick: onMore, "aria-label": t("More places"), title: t("More"), display: "none", "$max-md": { display: "flex", width: "auto", minW: 0 }, flexDirection: "column", width: RAIL, minH: 44, py: "$1", rounded: "$2", borderWidth: 0, bg: "transparent", cursor: "pointer", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(SearchIcon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", lineHeight: 14, color: "$quiet", children: t("More") })] })] }), avatarSlot ? (_jsx(YStack, { items: "center", pb: "$2", "$max-md": { display: "none" }, $md: open ? { display: "none" } : undefined, children: avatarSlot })) : null] }));
|
|
1104
1145
|
}
|
|
1105
1146
|
/**
|
|
1106
1147
|
* Chat's column: start a chat, the projects, then every conversation. The app
|
|
@@ -1114,19 +1155,56 @@ function App({ filter, onPick, navigate, }) {
|
|
|
1114
1155
|
navigate?.(dev(slug));
|
|
1115
1156
|
onPick?.();
|
|
1116
1157
|
};
|
|
1117
|
-
return (_jsxs(_Fragment, { children: [_jsx(SidebarNewChat, { label: t("New chat"), onPress: () => {
|
|
1158
|
+
return (_jsxs(_Fragment, { children: [_jsx(SidebarNewChat, { label: t("New chat"), gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, onPress: () => {
|
|
1118
1159
|
empty();
|
|
1119
1160
|
onPick?.();
|
|
1120
1161
|
} }), _jsx(SidebarFolder, { name: t("Projects"), open: filter ? true : undefined, children: _jsx(Projects, { filter: filter, onPick: open }) }), _jsx(Chats, { filter: filter, onPick: onPick })] }));
|
|
1121
1162
|
}
|
|
1163
|
+
/**
|
|
1164
|
+
* Dev's column: start a thread, projects first, then threads. Keeps Dev
|
|
1165
|
+
* composable on the canonical shell without falling through to generic Chats.
|
|
1166
|
+
*/
|
|
1167
|
+
function DevIndex({ filter, onPick, navigate, }) {
|
|
1168
|
+
const { t } = useI18n();
|
|
1169
|
+
const { empty } = useOpen();
|
|
1170
|
+
const openProject = (slug) => {
|
|
1171
|
+
navigate?.(dev(slug));
|
|
1172
|
+
onPick?.();
|
|
1173
|
+
};
|
|
1174
|
+
return (_jsxs(YStack, { "data-slot": "dev-index", children: [_jsx(SidebarNewChat, { label: t("New thread"), onPress: () => {
|
|
1175
|
+
empty();
|
|
1176
|
+
navigate?.(dev(""));
|
|
1177
|
+
onPick?.();
|
|
1178
|
+
} }), _jsx(YStack, { "data-slot": "dev-projects", children: _jsx(SidebarFolder, { name: t("Projects"), defaultOpen: true, open: filter ? true : undefined, children: _jsx(Projects, { filter: filter, onPick: openProject }) }) }), _jsx(YStack, { "data-slot": "dev-threads", children: _jsx(SidebarFolder, { name: t("Threads"), defaultOpen: true, open: filter ? true : undefined, children: _jsx(Chats, { filter: filter, onPick: onPick }) }) })] }));
|
|
1179
|
+
}
|
|
1180
|
+
/**
|
|
1181
|
+
* Bots' column: the agents roster with a subtle `/flow` Workflows entry below
|
|
1182
|
+
* a monochrome hairline divider.
|
|
1183
|
+
*/
|
|
1184
|
+
function BotsIndex({ owner, filter, onPick, navigate, }) {
|
|
1185
|
+
const { t } = useI18n();
|
|
1186
|
+
const showWorkflows = matches(t("Workflows"), filter) || matches("flow", filter);
|
|
1187
|
+
return (_jsxs(YStack, { "data-slot": "bots-index", children: [_jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate }), showWorkflows ? (_jsx(YStack, { "data-slot": "bots-workflows", pt: "$2", mt: "$2", borderTopWidth: 1, borderColor: "var(--pane-edge, var(--white-08))", children: _jsx(SidebarSection, { label: t("Automation"), children: _jsx(SidebarItem, { "data-slot": "bots-workflows-link", icon: _jsx(Workflow, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
1188
|
+
if (navigate)
|
|
1189
|
+
navigate(FLOW);
|
|
1190
|
+
else if (typeof window !== "undefined")
|
|
1191
|
+
window.location.assign(FLOW);
|
|
1192
|
+
onPick?.();
|
|
1193
|
+
}, children: t("Workflows") }) }) })) : null] }));
|
|
1194
|
+
}
|
|
1122
1195
|
/** What a place holds, for the list column. */
|
|
1123
|
-
function
|
|
1196
|
+
export function ShellIndex({ mode, owner, filter, onPick, navigate, }) {
|
|
1197
|
+
const { t } = useI18n();
|
|
1124
1198
|
const channels = (_jsxs(_Fragment, { children: [_jsx(Channels, { onPick: onPick, navigate: navigate }), _jsx(Team, { filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
1125
1199
|
if (mode === "chat")
|
|
1126
1200
|
return _jsx(App, { filter: filter, onPick: onPick, navigate: navigate });
|
|
1201
|
+
if (mode === "dev")
|
|
1202
|
+
return _jsx(DevIndex, { filter: filter, onPick: onPick, navigate: navigate });
|
|
1127
1203
|
if (mode === "home")
|
|
1128
1204
|
return (_jsxs(_Fragment, { children: [_jsx(Chats, { filter: filter, onPick: onPick }), channels, _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate }), _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
1129
1205
|
if (mode === "bots")
|
|
1206
|
+
return _jsx(BotsIndex, { owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
1207
|
+
if (mode === "agents")
|
|
1130
1208
|
return _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
1131
1209
|
if (mode === "contacts")
|
|
1132
1210
|
return _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
@@ -1134,6 +1212,12 @@ function Index({ mode, owner, filter, onPick, navigate, }) {
|
|
|
1134
1212
|
return channels;
|
|
1135
1213
|
if (mode === "tasks")
|
|
1136
1214
|
return _jsx(Projects, { filter: filter, onPick: onPick });
|
|
1215
|
+
if (mode === "drive")
|
|
1216
|
+
return (_jsx(SidebarSection, { label: t("Storage"), children: _jsx(Note, { children: t("Browse cloud buckets, project files, and local folders in Drive.") }) }));
|
|
1217
|
+
if (mode === "cal")
|
|
1218
|
+
return (_jsx(SidebarSection, { label: t("Schedule"), children: _jsx(Note, { children: t("Upcoming events and team availability appear in Calendar.") }) }));
|
|
1219
|
+
if (mode === "meet")
|
|
1220
|
+
return (_jsxs(_Fragment, { children: [_jsx(SidebarSection, { label: t("Rooms"), children: _jsx(Note, { children: t("Start or join an instant video room in Meet.") }) }), _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
1137
1221
|
return _jsx(Chats, { filter: filter, onPick: onPick });
|
|
1138
1222
|
}
|
|
1139
1223
|
function Frame({ mode, children, navigate, back, forward, }) {
|
|
@@ -1165,17 +1249,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1165
1249
|
* the server sent "Close sidebar" and the client drew "Open sidebar" — and a
|
|
1166
1250
|
* regenerated tree came back with the rail at zero width.
|
|
1167
1251
|
*/
|
|
1168
|
-
const [asked, setAsked] =
|
|
1169
|
-
useEffect(() => {
|
|
1170
|
-
let kept = null;
|
|
1171
|
-
try {
|
|
1172
|
-
kept = localStorage.getItem("hanzo:sidebar:open");
|
|
1173
|
-
}
|
|
1174
|
-
catch {
|
|
1175
|
-
// No store is the width of the window, which is a state and not a failure.
|
|
1176
|
-
}
|
|
1177
|
-
setAsked(kept !== null ? kept === "true" : window.innerWidth >= 768);
|
|
1178
|
-
}, []);
|
|
1252
|
+
const [asked, setAsked, setAway] = useSidebar();
|
|
1179
1253
|
const [peeking, setPeeking] = useState(false);
|
|
1180
1254
|
/**
|
|
1181
1255
|
* How wide the reader keeps the sidebar.
|
|
@@ -1210,27 +1284,41 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1210
1284
|
const tiers = useTiers();
|
|
1211
1285
|
const [hidden] = useHidden();
|
|
1212
1286
|
const shown = asked || peeking;
|
|
1213
|
-
const toggle = () => {
|
|
1287
|
+
const toggle = useCallback(() => {
|
|
1214
1288
|
setPeeking(false);
|
|
1215
|
-
setAsked((open) =>
|
|
1216
|
-
|
|
1289
|
+
setAsked((open) => {
|
|
1290
|
+
const next = !open;
|
|
1291
|
+
try {
|
|
1292
|
+
localStorage.setItem("hanzo:sidebar:open", String(next));
|
|
1293
|
+
}
|
|
1294
|
+
catch {
|
|
1295
|
+
// No storage still toggles the sidebar in memory.
|
|
1296
|
+
}
|
|
1297
|
+
return next;
|
|
1298
|
+
});
|
|
1299
|
+
}, []);
|
|
1217
1300
|
const dismiss = () => {
|
|
1218
1301
|
setPeeking(false);
|
|
1219
|
-
if (typeof window !== "undefined" && window.innerWidth < 1024)
|
|
1220
|
-
|
|
1221
|
-
}
|
|
1302
|
+
if (typeof window !== "undefined" && window.innerWidth < 1024)
|
|
1303
|
+
setAway();
|
|
1222
1304
|
};
|
|
1223
1305
|
const onPick = typeof window !== "undefined" && window.innerWidth < 1024 ? dismiss : undefined;
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1306
|
+
const { empty: emptyChat } = useOpen();
|
|
1307
|
+
const dev = useDevHost();
|
|
1308
|
+
useGlobalKeys({
|
|
1309
|
+
find: () => setFinding((open) => !open),
|
|
1310
|
+
newChat: () => {
|
|
1311
|
+
emptyChat();
|
|
1312
|
+
navigate?.(chat());
|
|
1313
|
+
},
|
|
1314
|
+
sidebar: toggle,
|
|
1315
|
+
settings: () => {
|
|
1316
|
+
rememberSettingsReturn();
|
|
1317
|
+
showSettings(FIRST);
|
|
1318
|
+
},
|
|
1319
|
+
chooseTheme: dev.chooseTheme,
|
|
1320
|
+
say: (message) => toast.success(message),
|
|
1321
|
+
});
|
|
1234
1322
|
/**
|
|
1235
1323
|
* THE SURFACES THAT ARE NOT APPS, said once.
|
|
1236
1324
|
*
|
|
@@ -1245,6 +1333,8 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1245
1333
|
* two ways to reach one place, and the two would answer differently the day
|
|
1246
1334
|
* one of them learned to close the sheet behind it.
|
|
1247
1335
|
*/
|
|
1336
|
+
const [devMode] = useDevMode();
|
|
1337
|
+
const showDesktopRail = !asked;
|
|
1248
1338
|
const tools = useMemo(() => [
|
|
1249
1339
|
// CUSTOMIZE is the one home of what an agent brings to a run — skills,
|
|
1250
1340
|
// connectors, plugins, agents — in Dev (@hanzo/build). One row leads
|
|
@@ -1258,16 +1348,6 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1258
1348
|
dismiss();
|
|
1259
1349
|
},
|
|
1260
1350
|
},
|
|
1261
|
-
// TERMINALS ARE TABS, and Tabs is its own product at its own host —
|
|
1262
|
-
// hanzo.app's row pointed there too. A new tab for the reason that row
|
|
1263
|
-
// used one: a reader who follows it inside this one loses the project
|
|
1264
|
-
// they were building to reach a shell.
|
|
1265
|
-
{
|
|
1266
|
-
id: "terminals",
|
|
1267
|
-
label: t("Terminals"),
|
|
1268
|
-
icon: SquareTerminal,
|
|
1269
|
-
go: () => window.open(TABS, "_blank", "noopener"),
|
|
1270
|
-
},
|
|
1271
1351
|
{
|
|
1272
1352
|
id: "usage",
|
|
1273
1353
|
label: t("Usage"),
|
|
@@ -1286,7 +1366,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1286
1366
|
{
|
|
1287
1367
|
id: "settings",
|
|
1288
1368
|
label: t("Settings"),
|
|
1289
|
-
icon:
|
|
1369
|
+
icon: Settings,
|
|
1290
1370
|
go: () => showSettings(FIRST),
|
|
1291
1371
|
},
|
|
1292
1372
|
], [navigate, dismiss, showSettings, t]);
|
|
@@ -1356,7 +1436,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1356
1436
|
// ship "Sign in" baked into HTML a signed-in reader then sees flash.
|
|
1357
1437
|
const settled = hydrated && !isLoading;
|
|
1358
1438
|
const { user: account } = useAccount();
|
|
1359
|
-
const {
|
|
1439
|
+
const { current: currentBrowserAccount } = useAccounts();
|
|
1360
1440
|
const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
|
|
1361
1441
|
const free = useFree(signedIn);
|
|
1362
1442
|
const logout = useSignOut();
|
|
@@ -1376,103 +1456,123 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1376
1456
|
const list = (_jsxs(Sidebar, { ref: side.ref, ...side.props, $md: { width: "var(--span)" }, "$max-md": { width: "100%", maxW: 280 }, ...sheet(0),
|
|
1377
1457
|
// The kit draws the sidebar's edge on its right, a physical side, so the edge is
|
|
1378
1458
|
// traded here: the left in a right-to-left language, where the sidebar stands at the right.
|
|
1379
|
-
bg: "var(--side-fill, var(--
|
|
1459
|
+
bg: "var(--side-fill, var(--background))", rounded: "var(--pane-round)", borderWidth: 1, borderColor: "var(--pane-edge, var(--edge, var(--white-08)))", overflowX: "hidden", position: "relative", children: [_jsx(Gutter
|
|
1380
1460
|
// The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
|
|
1381
1461
|
, {
|
|
1382
1462
|
// The edge the sidebar is pinned to (Grip's, physical): its free edge is the other one.
|
|
1383
|
-
side: dir === "rtl" ? "right" : "left", span: side.span, floor: FLOOR, ceil: CEIL, reset: SIDEBAR_WIDTH, onSpan: side.move, onKeep: side.keep, onShut: () => setAsked(false), label: t("Resize sidebar") }),
|
|
1463
|
+
side: dir === "rtl" ? "right" : "left", span: side.span, floor: FLOOR, ceil: CEIL, reset: SIDEBAR_WIDTH, onSpan: side.move, onKeep: side.keep, onShut: () => setAsked(false), label: t("Resize sidebar") }), _jsxs(XStack, { "data-slot": "workspace-switcher", items: "center", gap: "$2", px: "$2", pt: "$2", pb: "$1", minW: 0, display: "none", "$max-md": { display: "flex" }, children: [_jsx(Text, { render: _jsx("a", { href: "/", onClick: (e) => {
|
|
1384
1464
|
if (!navigate || e.metaKey || e.ctrlKey || e.shiftKey || e.button !== 0)
|
|
1385
1465
|
return;
|
|
1386
1466
|
e.preventDefault();
|
|
1387
1467
|
navigate("/");
|
|
1388
|
-
}, "aria-label": t("{brandName} home", { brandName: brand() }), title: t("Home") }), "data-slot": "home", display: "flex", items: "center", justify: "center", width: 28, height: 28, $touchable: { width:
|
|
1468
|
+
}, "aria-label": t("{brandName} home", { brandName: brand() }), title: t("Home") }), "data-slot": "home", display: "flex", items: "center", justify: "center", width: 28, height: 28, $touchable: { width: 44, height: 44, minW: 44, minH: 44 }, color: "inherit", children: _jsx(HanzoMark, { size: 18 }) }), settled && isAuthenticated ? (_jsx(XStack, { shrink: 1, minW: 0, children: _jsx(TopOrgSelector, {}) })) : null] }), _jsx(YStack, { "data-slot": "places-list", px: "$2", pt: "$2", pb: "$2", gap: 1, "$max-md": { display: "none" }, children: places.filter((place) => matches(t(place.label), filter)).map((place) => (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, bg: place.id === mode ? "$raised" : "transparent", hoverStyle: { bg: place.id === mode ? "$raised" : "$hover" }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: place.id === mode ? 1 : 0.78, children: _jsx(place.icon, { size: 16, "aria-hidden": true }) }), active: place.id === mode, onPress: () => {
|
|
1389
1469
|
navigate?.(place.route);
|
|
1390
1470
|
onPick?.();
|
|
1391
|
-
}, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), children: more.map((tool) => (_jsx(SidebarItem, { icon: _jsx(tool.icon, { size:
|
|
1471
|
+
}, children: t(place.label) }, place.id))) }), more.length ? (_jsx(YStack, { "data-slot": "setup-list", px: "$2", pb: "$2", children: _jsx(SidebarSection, { label: t("Setup"), mt: "$1", children: more.map((tool) => (_jsx(SidebarItem, { gap: "$2.5", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(XStack, { width: 18, height: 18, items: "center", justify: "center", shrink: 0, opacity: 0.78, children: _jsx(tool.icon, { size: 15, "aria-hidden": true }) }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, minW: 0, height: 30, $touchable: { minH: 44 }, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", children: [_jsx(XStack, { shrink: 0, items: "center", justify: "center", pointerEvents: "none", "aria-hidden": true, children: _jsx(SearchIcon, { size: 13, "aria-hidden": true }) }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
|
|
1392
1472
|
if (e.key === "Escape")
|
|
1393
1473
|
setFilter("");
|
|
1394
1474
|
},
|
|
1395
1475
|
// FILTER, not Search. Two controls that both said Search did two
|
|
1396
1476
|
// different things: this one narrows the list beside you, and the
|
|
1397
1477
|
// bar above opens the palette that finds anything anywhere.
|
|
1398
|
-
placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(
|
|
1478
|
+
placeholder: t("Filter"), "aria-label": t("Filter sidebar") }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }) }), settingsPane ? (_jsx(SidebarScroll, { children: _jsx(SettingsList, { active: settingsPane, filter: filter, onPick: pick, onBack: () => showSettings(null) }) })) : (_jsx(_Fragment, { children: _jsx(SidebarScroll, { children: _jsxs(_Fragment, { children: [settled ? (_jsx(ShellIndex, { mode: mode, owner: owner, filter: filter, onPick: onPick, navigate: navigate })) : null, devMode && products.length ? (_jsx(SidebarFolder, { name: t("Cloud & Platform"), open: filter ? true : undefined, children: products.map((prod) => (_jsx(SidebarItem, { icon: _jsx(prod.icon, { size: 13, "aria-hidden": true }), onPress: () => window.open(prod.href, "_blank", "noopener"), children: t(prod.label) }, prod.id))) })) : null] }) }) })), settled && onApex ? _jsx(Leave, { href: signedIn ? ENTRY : WORKSPACE, children: t("Workspace") }) : null, settled ? (signedIn ? (_jsxs(_Fragment, { children: [free ? (_jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Sparkles, { size: 15, "aria-hidden": true, color: "var(--foreground)" }), onPress: () => {
|
|
1399
1479
|
window.location.assign(payUrl("/cart", { returnUrl: window.location.href }));
|
|
1400
1480
|
dismiss();
|
|
1401
|
-
}, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite
|
|
1481
|
+
}, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite teammates") }), _jsx(SidebarItem, { gap: "$2.5", minH: 34, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
1402
1482
|
navigate?.(site("/referral"));
|
|
1403
1483
|
dismiss();
|
|
1404
|
-
}, children: t("Share Hanzo") }), _jsx(XStack, { items: "center", justify: "
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1412
|
-
|
|
1413
|
-
|
|
1414
|
-
|
|
1415
|
-
|
|
1416
|
-
|
|
1417
|
-
|
|
1418
|
-
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1431
|
-
|
|
1432
|
-
|
|
1433
|
-
|
|
1434
|
-
|
|
1435
|
-
|
|
1436
|
-
|
|
1437
|
-
|
|
1438
|
-
|
|
1439
|
-
|
|
1440
|
-
|
|
1441
|
-
|
|
1442
|
-
|
|
1443
|
-
|
|
1444
|
-
|
|
1445
|
-
|
|
1446
|
-
|
|
1447
|
-
|
|
1448
|
-
|
|
1449
|
-
|
|
1450
|
-
|
|
1451
|
-
|
|
1452
|
-
|
|
1453
|
-
|
|
1454
|
-
|
|
1455
|
-
|
|
1456
|
-
|
|
1457
|
-
|
|
1458
|
-
|
|
1459
|
-
|
|
1460
|
-
|
|
1461
|
-
|
|
1462
|
-
|
|
1463
|
-
|
|
1464
|
-
|
|
1465
|
-
|
|
1466
|
-
|
|
1467
|
-
|
|
1468
|
-
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1477
|
-
|
|
1484
|
+
}, children: t("Share Hanzo") }), _jsx(XStack, { items: "center", justify: "space-between", gap: "$2", px: "$2", py: "$2", borderTopWidth: 1, borderColor: "$edge", children: _jsx(ShellProfileHover, { name: who.person.name || who.person.email || t("You"), email: who.person.email, avatar: who.person.avatar, orgId: owner || scoped() || "", signedIn: signedIn, onSettings: () => showSettings(FIRST), onSignOut: () => void logout(), children: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "shell-profile", "aria-label": t("Account: {name}", { name: who.person.name || who.person.email || t("You") }), onClick: () => {
|
|
1485
|
+
rememberSettingsReturn();
|
|
1486
|
+
showSettings(FIRST);
|
|
1487
|
+
}, items: "center", gap: "$2.5", flex: 1, minW: 0, minH: 40, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, px: "$1.5", py: "$1", rounded: "$3", borderWidth: 0, bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", children: [_jsx(Face, { src: who.person.avatar, name: who.person.name || who.person.email || "You", size: 26, person: true }), _jsx(Text, { fontSize: "$2", fontWeight: "500", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, text: "start", children: who.person.name || who.person.email || t("You") })] }) }) })] })) : null) : null] }));
|
|
1488
|
+
const activeAppId = onApex ? (mode === "dev" ? "dev" : "chat") : "team";
|
|
1489
|
+
const activeAppTitle = onApex ? (mode === "dev" ? "Hanzo Dev" : "Hanzo Chat") : "Hanzo Team";
|
|
1490
|
+
const launchBusinessApp = (item) => {
|
|
1491
|
+
if (typeof window === "undefined")
|
|
1492
|
+
return;
|
|
1493
|
+
try {
|
|
1494
|
+
const target = new URL(item.href, window.location.origin);
|
|
1495
|
+
if (target.origin === window.location.origin) {
|
|
1496
|
+
navigate?.(target.pathname + target.search);
|
|
1497
|
+
return;
|
|
1498
|
+
}
|
|
1499
|
+
const activeOrg = currentOrgId || scoped() || "";
|
|
1500
|
+
if (activeOrg)
|
|
1501
|
+
target.searchParams.set("org", activeOrg);
|
|
1502
|
+
const sub = currentBrowserAccount?.sub ||
|
|
1503
|
+
user?.sub ||
|
|
1504
|
+
user?.id ||
|
|
1505
|
+
"";
|
|
1506
|
+
const isConsoleSibling = target.hostname.startsWith("crm.") ||
|
|
1507
|
+
target.hostname.startsWith("console.") ||
|
|
1508
|
+
target.hostname.startsWith("platform.") ||
|
|
1509
|
+
target.hostname.startsWith("marketing.") ||
|
|
1510
|
+
target.hostname.startsWith("ads.") ||
|
|
1511
|
+
target.hostname.startsWith("social.");
|
|
1512
|
+
if (isConsoleSibling && sub) {
|
|
1513
|
+
const fresh = new URL("/auth/fresh", target.origin);
|
|
1514
|
+
fresh.searchParams.set("next", target.pathname + target.search);
|
|
1515
|
+
fresh.searchParams.set("who", sub);
|
|
1516
|
+
window.location.assign(fresh.toString());
|
|
1517
|
+
return;
|
|
1518
|
+
}
|
|
1519
|
+
window.location.assign(target.toString());
|
|
1520
|
+
}
|
|
1521
|
+
catch {
|
|
1522
|
+
window.location.assign(item.href);
|
|
1523
|
+
}
|
|
1524
|
+
};
|
|
1525
|
+
const appMenuItems = [
|
|
1526
|
+
{ type: "label", key: "suite", label: t("Hanzo apps") },
|
|
1527
|
+
...BUSINESS_APPS.map((item) => ({
|
|
1528
|
+
key: item.id,
|
|
1529
|
+
label: item.label,
|
|
1530
|
+
description: item.description,
|
|
1531
|
+
selected: item.id === activeAppId,
|
|
1532
|
+
onSelect: () => launchBusinessApp(item),
|
|
1533
|
+
})),
|
|
1534
|
+
];
|
|
1535
|
+
const orgList = orgState.organizations && orgState.organizations.length > 0
|
|
1536
|
+
? orgState.organizations
|
|
1537
|
+
: [{ name: currentOrgId || scoped() || "hanzo", displayName: workspace }];
|
|
1538
|
+
const orgMenuItems = [
|
|
1539
|
+
{ type: "label", key: "orgs", label: t("Switch organization") },
|
|
1540
|
+
...orgList.map((o) => ({
|
|
1541
|
+
key: o.name,
|
|
1542
|
+
label: o.displayName || o.name,
|
|
1543
|
+
selected: o.name === (currentOrgId || scoped() || "hanzo"),
|
|
1544
|
+
onSelect: () => {
|
|
1545
|
+
if (o.name === (currentOrgId || scoped()))
|
|
1546
|
+
return;
|
|
1547
|
+
choose(o.name);
|
|
1548
|
+
window.location.reload();
|
|
1549
|
+
},
|
|
1550
|
+
})),
|
|
1551
|
+
];
|
|
1552
|
+
return (_jsxs(YStack, { width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", position: "relative", children: [_jsx(SkipLink, {}), _jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: showDesktopRail ? `${RAIL}px auto minmax(0, 1fr) auto` : "0px auto minmax(0, 1fr) auto", gridTemplateRows: `${SHELL_BAR}px minmax(0, 1fr)`, gridTemplateAreas: '"bar bar bar bar" "rail list pane side"', "$max-md": {
|
|
1553
|
+
gridTemplateColumns: "minmax(0, 1fr)",
|
|
1554
|
+
gridTemplateRows: `${SHELL_BAR}px minmax(0, 1fr) ${TABS_HEIGHT}`,
|
|
1555
|
+
gridTemplateAreas: '"bar" "pane" "rail"',
|
|
1556
|
+
}, position: "relative", width: "100%", flex: 1, minH: 0, overflow: "hidden", bg: "var(--pane-floor, var(--background))", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, hiddenOnDesktop: !showDesktopRail, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onMore: () => setFinding(true), avatarSlot: settled && signedIn ? (_jsx(ShellProfileHover, { name: who.person.name || who.person.email || t("You"), email: who.person.email, avatar: who.person.avatar, orgId: owner || scoped() || "", signedIn: signedIn, onSettings: () => {
|
|
1557
|
+
setAsked(true);
|
|
1558
|
+
showSettings(FIRST);
|
|
1559
|
+
}, onSignOut: () => void logout(), children: _jsx(XStack, { render: _jsx("button", { type: "button" }), "data-slot": "rail-profile", "aria-label": t("Account: {name}", { name: who.person.name || who.person.email || t("You") }), onClick: () => {
|
|
1560
|
+
rememberSettingsReturn();
|
|
1561
|
+
setAsked(true);
|
|
1562
|
+
showSettings(FIRST);
|
|
1563
|
+
}, width: 40, height: 40, $touchable: { minW: 44, minH: 44 }, "$max-sm": { minW: 44, minH: 44 }, rounded: "$10", borderWidth: 0, bg: "transparent", items: "center", justify: "center", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", children: _jsx(Face, { src: who.person.avatar, name: who.person.name || who.person.email || "You", size: 28, person: true }) }) })) : null }), _jsxs(XStack, { render: "header", gridArea: "bar", "data-slot": "bar", "data-testid": "hanzo-business-header", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, height: SHELL_BAR, px: "$2.5", gap: "$2", items: "center", justify: "space-between", borderBottomWidth: 1, borderColor: "$borderColor", bg: "$background", shrink: 0, minW: 0, overflow: "hidden", children: [_jsxs(XStack, { items: "center", gap: "$1", minW: 0, shrink: 1, children: [_jsx(SidebarIconButton, { ...TAP, label: t(shown ? "Close sidebar" : "Open sidebar"), onPress: toggle, onMouseEnter: () => setPeeking(true), children: _jsx(PanelLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), back || forward ? (_jsxs(XStack, { display: "none", $md: { display: "flex" }, items: "center", gap: "$1", shrink: 0, children: [_jsx(SidebarIconButton, { ...TAP, label: t("Back"), onPress: () => back?.(), children: _jsx(ArrowLeft, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) }), _jsx(SidebarIconButton, { ...TAP, label: t("Forward"), onPress: () => forward?.(), children: _jsx(ArrowRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })) : null, _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 280, items: appMenuItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-testid": "business-app-switcher-trigger", "aria-label": t("{app} — switch application", { app: activeAppTitle }), items: "center", justify: "center", gap: "$1", px: "$2", minH: 32, $touchable: { minH: 44, minW: 44 }, "$max-sm": { minH: 44, minW: 44 }, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, shrink: 0, children: [_jsx(HanzoMark, { size: 18 }), _jsx(ChevronDown, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })] }) }), settled && signedIn ? (_jsx(XStack, { display: "none", $sm: { display: "flex" }, minW: 0, shrink: 1, children: _jsx(DropdownMenu, { placement: "bottom-start", minWidth: 240, items: orgMenuItems, trigger: _jsxs(XStack, { render: _jsx("button", { type: "button" }), "data-testid": "business-org-subtitle-trigger", "aria-label": t("Organization: {workspace}", { workspace }), items: "center", gap: "$1.5", px: "$2", minH: 32, $touchable: { minH: 44 }, "$max-sm": { minH: 44 }, maxW: 200, minW: 0, rounded: "$3", borderWidth: 0, cursor: "pointer", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: [_jsx(Building2, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, children: workspace }), _jsx(ChevronDown, { size: 12, color: "var(--muted-foreground)", "aria-hidden": true })] }) }) })) : null] }), _jsx(YStack, { flex: 1, minW: 0, maxW: 420, items: "center", justify: "center", px: "$1", children: _jsxs(Box, { render: _jsx("button", { type: "button" }), onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", "aria-label": t("Search {workspace}", { workspace }), items: "center", gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", bg: "transparent", hoverStyle: { bg: "$hover" }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, cursor: "pointer", "$max-md": {
|
|
1564
|
+
width: 44,
|
|
1565
|
+
minW: 44,
|
|
1566
|
+
minH: 44,
|
|
1567
|
+
height: 44,
|
|
1568
|
+
px: 0,
|
|
1569
|
+
justify: "center",
|
|
1570
|
+
borderWidth: 0,
|
|
1571
|
+
rounded: "$3",
|
|
1572
|
+
}, children: [_jsx(SearchIcon, { size: 14, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, "$max-md": { display: "none" }, children: t("Search {workspace}", { workspace }) }), _jsx(Shortcut, { keys: ["Mod", "K"], marginInlineStart: "auto", "data-i18n-ltr": "", "$max-md": { display: "none" } })] }) }), _jsxs(XStack, { shrink: 0, minW: 0, justify: "flex-end", items: "center", gap: "$1.5", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: _jsx("button", { type: "button" }), onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", borderWidth: 0, bg: "transparent", cursor: "pointer", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", hoverStyle: { bg: "$hover" }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: _jsx("button", { type: "button" }), onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", borderWidth: 0, bg: "transparent", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", focusVisibleStyle: { outlineWidth: 2, outlineStyle: "solid", outlineColor: "var(--ring)" }, children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "var(--border-strong)", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--foreground)" }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Upgrade") })] }) })) : null, _jsxs(XStack, { display: "none", $lg: { display: "flex" }, items: "center", gap: "$1", children: [_jsx(SidebarIconButton, { ...TAP, label: t(aside === "roster" ? "Hide directory & roster" : "Show directory & roster"), onPress: () => showAside(aside === "roster" ? null : "roster"), children: _jsx(Users, { size: 16, "aria-hidden": true }) }), _jsx(SidebarIconButton, { ...TAP, label: t(aside === "tasks" ? "Close side panel" : "Open side panel"), onPress: () => showAside(aside === "tasks" ? null : "tasks"), children: _jsx(PanelRight, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] }), _jsx(WindowControls, {})] })] }), shown ? (_jsx(Box, { render: _jsx("button", { type: "button" }), "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, borderWidth: 0, "data-slot": "scrim", position: "absolute", t: SHELL_BAR, r: 0, b: TABS_HEIGHT, l: 0, z: "var(--z-scrim)", $md: { display: "none" } })) : null, shown ? (_jsx(XStack, { "data-slot": "list", gridArea: "list", position: asked ? "relative" : "absolute", ...(asked ? {} : { top: SHELL_BAR, bottom: 0, insetInlineStart: RAIL }), "$max-md": { position: "fixed", t: SHELL_BAR, b: TABS_HEIGHT, insetInlineStart: 0, width: 280, maxW: "85vw" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
|
|
1573
|
+
if (!asked)
|
|
1574
|
+
setPeeking(false);
|
|
1575
|
+
}, children: list })) : null, _jsx(Split, { swap: settingsPane ? _jsx(Suspense, { fallback: null, children: _jsx(SettingsPane, { id: settingsPane }) }) : undefined, children: children }), finding ? (_jsx(Search, { actions: doors, onClose: found,
|
|
1576
|
+
// A chat opens in this workspace's Chat, the palette having picked it; the rest is the app's.
|
|
1577
|
+
go: (to) => navigate?.(to.startsWith(TALK) ? chat() : site(to)) })) : null] })] }));
|
|
1478
1578
|
}
|