@hanzo/app 0.2.58 → 0.3.1
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/README.md +8 -8
- package/dist/{Me.d.ts → Account.d.ts} +1 -1
- package/dist/{Me.js → Account.js} +3 -3
- package/dist/App.d.ts +2 -2
- package/dist/App.js +16 -16
- package/dist/{Top.d.ts → Bar.d.ts} +1 -1
- package/dist/{Top.js → Bar.js} +3 -3
- package/dist/Betas.js +1 -1
- package/dist/Board.js +4 -4
- package/dist/Chat.d.ts +4 -4
- package/dist/Chat.js +96 -96
- package/dist/Contacts.js +17 -15
- package/dist/Directory.js +7 -21
- package/dist/Drive.js +6 -6
- package/dist/{Orgs.d.ts → Gate.d.ts} +1 -1
- package/dist/{Orgs.js → Gate.js} +32 -32
- package/dist/{Chrome.d.ts → Header.d.ts} +1 -1
- package/dist/{Chrome.js → Header.js} +1 -1
- package/dist/Home.d.ts +3 -3
- package/dist/Home.js +30 -30
- package/dist/Inbox.js +29 -33
- package/dist/Meet.js +22 -22
- package/dist/Rail.js +6 -6
- package/dist/RightPane.js +2 -2
- package/dist/{Palette.d.ts → Search.d.ts} +1 -1
- package/dist/{Palette.js → Search.js} +1 -1
- package/dist/Settings.d.ts +3 -3
- package/dist/Settings.js +5 -5
- package/dist/SettingsPane.d.ts +2 -2
- package/dist/SettingsPane.js +5 -5
- package/dist/Setup.js +2 -2
- package/dist/Shell.d.ts +22 -31
- package/dist/Shell.js +167 -114
- package/dist/{Column.d.ts → Sidebar.d.ts} +1 -1
- package/dist/{Column.js → Sidebar.js} +5 -5
- package/dist/Support.js +2 -2
- package/dist/Talk.d.ts +3 -3
- package/dist/Talk.js +18 -18
- package/dist/TeamPreview.js +26 -26
- package/dist/TeamStory.js +1 -1
- package/dist/Usage.js +2 -2
- package/dist/Work.js +2 -2
- package/dist/bots/Bots.js +2 -2
- package/dist/bots/Lights.d.ts +1 -1
- package/dist/bots/Lights.js +1 -1
- package/dist/bots/api.d.ts +8 -7
- package/dist/bots/api.js +4 -4
- package/dist/bots/ink.js +3 -3
- package/dist/bots/kit.d.ts +2 -2
- package/dist/bots/kit.js +4 -4
- package/dist/bots/runtime.js +12 -12
- package/dist/cast.d.ts +14 -14
- package/dist/cast.js +12 -12
- package/dist/channels.d.ts +132 -0
- package/dist/{rooms.js → channels.js} +56 -55
- package/dist/conversations.d.ts +8 -8
- package/dist/conversations.js +18 -17
- package/dist/crew.d.ts +1 -1
- package/dist/crew.js +12 -12
- package/dist/dev.js +6 -6
- package/dist/failure.d.ts +2 -2
- package/dist/failure.js +6 -6
- package/dist/ground.d.ts +1 -1
- package/dist/ground.js +1 -1
- package/dist/help.d.ts +1 -1
- package/dist/help.js +2 -2
- package/dist/hint.d.ts +1 -1
- package/dist/hint.js +1 -1
- package/dist/host.d.ts +15 -15
- package/dist/host.js +13 -13
- package/dist/index.d.ts +5 -5
- package/dist/index.js +4 -4
- package/dist/lib/ai.js +1 -1
- package/dist/lib/api.d.ts +1 -1
- package/dist/lib/api.js +1 -1
- package/dist/lib/destination.d.ts +3 -3
- package/dist/lib/destination.js +3 -3
- package/dist/lib/home.d.ts +2 -2
- package/dist/lib/home.js +2 -2
- package/dist/lib/host.d.ts +17 -16
- package/dist/lib/host.js +19 -18
- package/dist/lib/hostname.d.ts +1 -1
- package/dist/lib/hostname.js +1 -1
- package/dist/lib/list.d.ts +1 -1
- package/dist/lib/list.js +1 -1
- package/dist/lib/models.js +1 -1
- package/dist/lib/org.d.ts +1 -1
- package/dist/lib/org.js +1 -1
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/session.d.ts +4 -4
- package/dist/lib/session.js +6 -6
- package/dist/lib/tier.d.ts +4 -4
- package/dist/lib/tier.js +5 -5
- package/dist/lib/tiers.d.ts +1 -1
- package/dist/lib/tiers.js +10 -10
- package/dist/lib/web.d.ts +1 -1
- package/dist/lib/web.js +1 -1
- package/dist/look.js +7 -9
- package/dist/network.d.ts +18 -18
- package/dist/network.js +28 -28
- package/dist/open.d.ts +24 -22
- package/dist/open.js +19 -19
- package/dist/pane.d.ts +6 -6
- package/dist/pane.js +10 -10
- package/dist/roster.d.ts +2 -2
- package/dist/roster.js +1 -1
- package/dist/seek.js +1 -1
- package/dist/slide.d.ts +1 -1
- package/dist/slide.js +1 -1
- package/dist/span.js +1 -1
- package/dist/stars.d.ts +4 -4
- package/dist/stars.js +8 -10
- package/dist/tabs.d.ts +1 -1
- package/dist/tabs.js +1 -1
- package/dist/team.js +1 -1
- package/dist/thread.d.ts +3 -3
- package/dist/thread.js +4 -4
- package/dist/ui.d.ts +1 -1
- package/dist/ui.js +1 -1
- package/dist/where.d.ts +7 -7
- package/dist/where.js +2 -2
- package/dist/workday.d.ts +26 -26
- package/dist/workday.js +187 -187
- package/package.json +8 -8
- package/dist/Room.d.ts +0 -8
- package/dist/Room.js +0 -51
- package/dist/rooms.d.ts +0 -131
- /package/dist/lib/{rooms.json → routes.json} +0 -0
package/dist/Shell.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
// The
|
|
3
|
+
// The apps' shell. ONE of them, worn by /chat and every app. (The web app is
|
|
4
4
|
// `/`, whole, with a rail of its own: app/page.tsx. Dev is its door.)
|
|
5
5
|
//
|
|
6
|
-
// The two routes are the same
|
|
6
|
+
// The two routes are the same shell with different furniture: a rail on the left,
|
|
7
7
|
// a pane on the right. What differs is the rail's title, its nav, and which list
|
|
8
8
|
// it shows — three props, not two components. Building a second shell is how the
|
|
9
9
|
// two surfaces drift, and they are meant to be one product.
|
|
@@ -12,12 +12,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
12
12
|
// where the Hanzo chat shell lives for every surface that wears one; this file
|
|
13
13
|
// holds arrangement and words and owns no pixels of its own. That is the whole
|
|
14
14
|
// architecture: a stranger with `@hanzo/ui`, `@hanzo/ai` and `@hanzo/iam` can
|
|
15
|
-
// assemble this
|
|
15
|
+
// assemble this shell, because nothing in it is private to hanzo.ai.
|
|
16
16
|
import { createContext, lazy, Suspense, useCallback, useContext, useEffect, useMemo, useRef, useState, } from "react";
|
|
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, Settings2, UserPlus, PanelLeftClose,
|
|
20
|
+
import { MessageSquare, Code2, Inbox, Bot, ListChecks, HardDrive, Settings2, UserPlus, PanelLeftClose, SearchIcon, Hash, AtSign, Lock, Workflow, Plus, ArrowLeft, ArrowRight, Send, Minus, Blocks, Star, FolderOpen, Activity, BookOpen, SquareTerminal, Share2, PanelLeft, PanelRight, Users, Globe, Cpu, Boxes, Wallet, Video, Calendar, LayoutGrid, ArrowUpLeft, 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";
|
|
@@ -32,14 +32,17 @@ import { OrgProjectSwitcher, useIam, useOrganizations, } from "@hanzo/iam/react"
|
|
|
32
32
|
import { Gutter, SideProvider, useSplit } from "@hanzo/build";
|
|
33
33
|
import { HanzoMark, } from "@hanzogui/shell";
|
|
34
34
|
import { useHydrated } from "./lib/hydrated.js";
|
|
35
|
-
import {
|
|
35
|
+
import { useHostname } from "./lib/hostname.js";
|
|
36
|
+
import { useHost } from "./host.js";
|
|
37
|
+
import { Gate } from "./Gate.js";
|
|
38
|
+
import { link } from "./lib/tags.js";
|
|
36
39
|
import { useAi } from "./lib/ai.js";
|
|
37
40
|
import { useTiers, useHidden } from "./lib/tiers.js";
|
|
38
41
|
import { useAccount } from "./lib/account.js";
|
|
39
42
|
import { bearer, hasSession, org as scoped, pick as choose } from "./lib/session.js";
|
|
40
43
|
import { api } from "./lib/api.js";
|
|
41
44
|
import { useSignOut } from "./lib/signout.js";
|
|
42
|
-
import { enter, LOGIN } from "./lib/destination.js";
|
|
45
|
+
import { enter, LOGIN, rememberDestination } from "./lib/destination.js";
|
|
43
46
|
import { address, sharedWithMe } from "./lib/share.js";
|
|
44
47
|
import { list } from "./lib/list.js";
|
|
45
48
|
import { ModelPicker } from "@hanzo/ui/models";
|
|
@@ -50,7 +53,7 @@ import { useSpan } from "./span.js";
|
|
|
50
53
|
import { pane } from "./ground.js";
|
|
51
54
|
import { useFree } from "./Upgrade.js";
|
|
52
55
|
import { payUrl } from "./lib/pay.js";
|
|
53
|
-
/** The new-agent row's fields: an outlined box in the
|
|
56
|
+
/** The new-agent row's fields: an outlined box in the shell's own ink. */
|
|
54
57
|
const FIELD = {
|
|
55
58
|
bg: "transparent",
|
|
56
59
|
borderWidth: 1,
|
|
@@ -69,13 +72,13 @@ import { reach } from "./lib/reach.js";
|
|
|
69
72
|
import { say } from "./failure.js";
|
|
70
73
|
import { Face } from "./cast.js";
|
|
71
74
|
import { useStarred, titleOf } from "./stars.js";
|
|
72
|
-
import {
|
|
73
|
-
import {
|
|
74
|
-
import { apex, app, dev, ENTRY,
|
|
75
|
+
import { channelName } from "./network.js";
|
|
76
|
+
import { useChannels, teamKey, channelHref } from "./channels.js";
|
|
77
|
+
import { apex, app, away, dev, ENTRY, leaves, WORKSPACE } from "./lib/host.js";
|
|
75
78
|
import { netKey } from "./conversations.js";
|
|
76
79
|
import { FIRST, SettingsList, } from "./Settings.js";
|
|
77
|
-
import {
|
|
78
|
-
import {
|
|
80
|
+
import { Account } from "./Account.js";
|
|
81
|
+
import { Search } from "./Search.js";
|
|
79
82
|
import { tidy } from "./lib/title.js";
|
|
80
83
|
import { summons } from "./seek.js";
|
|
81
84
|
import { called } from "./team.js";
|
|
@@ -120,7 +123,7 @@ import { getStoredPeople, getStoredAgents, getCustomThreads, createDirectChat, }
|
|
|
120
123
|
import { bare } from './lib/bare.js';
|
|
121
124
|
import { BAD } from './lib/mix.js';
|
|
122
125
|
import { brand, site, where, wordmark } from './where.js';
|
|
123
|
-
/** The
|
|
126
|
+
/** The pane while a settings row is open, loaded when one is: none of it is an app's first screen. */
|
|
124
127
|
const SettingsPane = lazy(() => import('./SettingsPane.js').then((m) => ({ default: m.SettingsPane })));
|
|
125
128
|
/**
|
|
126
129
|
* The destinations, in rail order.
|
|
@@ -131,7 +134,7 @@ const SettingsPane = lazy(() => import('./SettingsPane.js').then((m) => ({ defau
|
|
|
131
134
|
*/
|
|
132
135
|
const HOME = {
|
|
133
136
|
id: "home",
|
|
134
|
-
// The
|
|
137
|
+
// The shell's Home is the host's: /home beside the app, / on hanzo.team.
|
|
135
138
|
get route() {
|
|
136
139
|
return where().home;
|
|
137
140
|
},
|
|
@@ -139,22 +142,22 @@ const HOME = {
|
|
|
139
142
|
return brand();
|
|
140
143
|
},
|
|
141
144
|
label: phrase("Home"),
|
|
142
|
-
// The chat bubble. Home IS the conversation with the org — the
|
|
145
|
+
// The chat bubble. Home IS the conversation with the org — the channels it talks
|
|
143
146
|
// in and the people in them — so it is drawn as one. It shared this glyph with
|
|
144
147
|
// Chat once and was given a house to separate them; the two never sit in the
|
|
145
148
|
// rail together (CHAT is a tile, HOME is not), so there is nothing to tell
|
|
146
|
-
// apart, and a house says "a place" where the
|
|
149
|
+
// apart, and a house says "a place" where the app is a conversation.
|
|
147
150
|
icon: MessageSquare,
|
|
148
151
|
};
|
|
149
152
|
/**
|
|
150
153
|
* CHAT LEADS THE RAIL, and Dev follows it.
|
|
151
154
|
*
|
|
152
|
-
* These are the two
|
|
155
|
+
* These are the two apps a person lives in — one to ask and one to build — so
|
|
153
156
|
* they are the first two tiles and the switch between them is one press. The
|
|
154
157
|
* rest of the rail is where you go from there.
|
|
155
158
|
*
|
|
156
159
|
* It was off the rail while /chat answered `invalid redirect_uri`: a tile that
|
|
157
|
-
* leads to an error page offers a door that does not open. The
|
|
160
|
+
* leads to an error page offers a door that does not open. The app is this
|
|
158
161
|
* export's own now, so the door opens.
|
|
159
162
|
*/
|
|
160
163
|
const CHAT = {
|
|
@@ -249,38 +252,87 @@ export const CONSOLE_PRODUCTS = [
|
|
|
249
252
|
* Whether a place belongs in THIS reader's rail.
|
|
250
253
|
*
|
|
251
254
|
* A place with no tier is the landing's offer — Chat and Dev — and everyone gets
|
|
252
|
-
* it. A tiered
|
|
255
|
+
* it. A tiered app shows only where two things are true: the reader's identity
|
|
253
256
|
* OPENS the tier (`useTiers`: a SuperAdmin gets every tier, an alpha/beta org its
|
|
254
|
-
* own, a stranger none), and the reader has not HIDDEN it in Settings. The
|
|
257
|
+
* own, a stranger none), and the reader has not HIDDEN it in Settings. The apps
|
|
255
258
|
* stay in PLACES either way — the structure is whole — so opening a tier is a
|
|
256
259
|
* flag flip, not a code change. Hide, never delete.
|
|
257
260
|
*
|
|
258
261
|
* A rail of two is what a stranger meets, which is the landing's offer exactly.
|
|
259
262
|
* The other four are dark until each ships and its tier is turned on.
|
|
260
263
|
*
|
|
261
|
-
* ON THE APEX THE
|
|
264
|
+
* ON THE APEX THE APPS ARE hanzo.team'S. There a place shows only when its
|
|
262
265
|
* route stays on the apex, which is Chat and Dev, and the rail ends in one tile
|
|
263
266
|
* that opens the workspace instead.
|
|
264
267
|
*/
|
|
265
|
-
const shows = (place, tiers, hidden, onApex) => !(onApex &&
|
|
268
|
+
const shows = (place, tiers, hidden, onApex) => !(onApex && leaves(place.route)) &&
|
|
266
269
|
(!place.tier || (tiers.has(place.tier) && !hidden.has(place.tier)));
|
|
267
270
|
/**
|
|
268
|
-
*
|
|
271
|
+
* The shell at one app, under the host's router, behind the gate.
|
|
269
272
|
*
|
|
270
|
-
*
|
|
271
|
-
*
|
|
272
|
-
*
|
|
273
|
-
*
|
|
274
|
-
*
|
|
275
|
-
*
|
|
276
|
-
*
|
|
273
|
+
* THE ROUTER LIVES HERE, and only here. The frame takes navigation as props
|
|
274
|
+
* rather than importing a router, so everything under it names no framework —
|
|
275
|
+
* the same shell mounts under Next, under Vite in a desktop webview, or under a
|
|
276
|
+
* test that records where it was asked to go. That binding used to be written
|
|
277
|
+
* in each route file, and four of six never wrote it: /board, /drive, /inbox and
|
|
278
|
+
* /work mounted the frame with no `navigate`, so the rail rendered and did
|
|
279
|
+
* nothing. One copy cannot be forgotten in four places.
|
|
280
|
+
*/
|
|
281
|
+
export function Shell({ mode, front = false, children, }) {
|
|
282
|
+
const { router } = useHost();
|
|
283
|
+
// A sign-in leaves for the issuer and returns to a FIXED callback that knows
|
|
284
|
+
// nothing of the app the reader was in. So the address is written down here,
|
|
285
|
+
// the one place the app meets the router, and the trip `Gate` starts for a
|
|
286
|
+
// signed-out reader returns HERE — address, `?q=` and all — rather than to
|
|
287
|
+
// the host's landing.
|
|
288
|
+
useEffect(() => {
|
|
289
|
+
rememberDestination();
|
|
290
|
+
}, []);
|
|
291
|
+
// THE APEX KEEPS THE APP AND THE WORKSPACE KEEPS ITS APPS. An app asked for
|
|
292
|
+
// on hanzo.ai is the same path and query on hanzo.team, and the location is
|
|
293
|
+
// replaced with it once React owns the page: the export is static, so nothing
|
|
294
|
+
// earlier knows the host. The shell draws nothing while it leaves, so `Gate`
|
|
295
|
+
// never starts a sign-in on the host being left.
|
|
296
|
+
const host = useHostname();
|
|
297
|
+
const here = host ? window.location : null;
|
|
298
|
+
const to = here ? away(host, `${here.pathname}${here.search}${here.hash}`) : null;
|
|
299
|
+
useEffect(() => {
|
|
300
|
+
if (to)
|
|
301
|
+
window.location.replace(link(to));
|
|
302
|
+
}, [to]);
|
|
303
|
+
if (to)
|
|
304
|
+
return null;
|
|
305
|
+
// A session comes first, then the organization: nothing of the workspace is
|
|
306
|
+
// drawn until the reader has signed in and picked the organization they are
|
|
307
|
+
// working in, and on the workspace's own host until that organization's plan
|
|
308
|
+
// is live (`Gate`).
|
|
309
|
+
return (_jsx(Gate, { front: front, children: _jsx(Client, { mode: mode, navigate: (route) => {
|
|
310
|
+
// A page of another origin — hanzo.ai's from hanzo.team — is a
|
|
311
|
+
// document load, not a client route the host's router can take.
|
|
312
|
+
if (/^https?:\/\//.test(route))
|
|
313
|
+
return window.location.assign(link(route));
|
|
314
|
+
const to = away(window.location.hostname, route);
|
|
315
|
+
if (to)
|
|
316
|
+
window.location.assign(link(to));
|
|
317
|
+
else
|
|
318
|
+
router.push(route);
|
|
319
|
+
}, back: () => router.back(), forward: () => router.forward(), children: children }) }));
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* ONE @hanzo/ai client for every app under the shell. `AiProvider` prefers the
|
|
323
|
+
* `client` prop over the one it built, so a session that settles after mount
|
|
324
|
+
* reaches every hook below — which is exactly what its internal `useRef` would
|
|
325
|
+
* otherwise prevent. Signed out the prop is absent and the provider's own
|
|
326
|
+
* anonymous client stands in, so `useAi()` never throws and the org-scoped hooks
|
|
327
|
+
* simply answer nothing.
|
|
277
328
|
*
|
|
278
|
-
*
|
|
279
|
-
*
|
|
280
|
-
*
|
|
281
|
-
*
|
|
329
|
+
* `Frame` is a separate component because the rail READS through those hooks,
|
|
330
|
+
* and a hook cannot run in the component that mounts its provider. The
|
|
331
|
+
* SELECTION is deliberately not provided here. It lives in `open.ts`, outside
|
|
332
|
+
* React, because this component is what the router mounts — holding it in state
|
|
333
|
+
* here is what emptied the conversation on every route change.
|
|
282
334
|
*/
|
|
283
|
-
|
|
335
|
+
function Client({ mode, children, navigate, back, forward, }) {
|
|
284
336
|
const { client } = useAi();
|
|
285
337
|
return (_jsx(AiProvider, { client: client ?? undefined, children: _jsx(Frame, { mode: mode, navigate: navigate, back: back, forward: forward, children: children }) }));
|
|
286
338
|
}
|
|
@@ -511,38 +563,39 @@ function Projects({ filter, onPick, }) {
|
|
|
511
563
|
return (_jsxs(_Fragment, { children: [wrong ? (_jsx(Note, { children: say(wrong, t("your projects"), "read", t) })) : rows === null ? (_jsx(Note, { children: t("Reading your projects.") })) : list.length === 0 ? (_jsx(Note, { children: t("Nothing deployed yet.") })) : shown.length === 0 ? (_jsx(Note, { children: t("No project matches “{filter}”.", { filter }) })) : null, shown.map((one) => (_jsx(YStack, { gap: "$0.5", children: _jsx(SidebarItem, { icon: starred.has(one.id) ? (_jsx(Star, { size: 13, fill: "currentColor", "aria-hidden": true })) : (_jsx(FolderOpen, { size: 13, "aria-hidden": true })), onPress: () => onPick?.(one.slug || one.name), children: one.name }) }, one.id)))] }));
|
|
512
564
|
}
|
|
513
565
|
/**
|
|
514
|
-
* The
|
|
566
|
+
* The channels the inbox holds, under the transport that carried each one.
|
|
515
567
|
*
|
|
516
568
|
* The transport is the section because that is how a person holds it: Slack
|
|
517
569
|
* here, iMessage there. The same display name can appear under both without
|
|
518
570
|
* being one person — `senderUser` is declared by the schema and omitted by every
|
|
519
571
|
* measured message, so a handle is a handle and a name would be a guess.
|
|
520
572
|
*
|
|
521
|
-
* `useInbox` groups the page it fetched; the server has no
|
|
522
|
-
* is the
|
|
573
|
+
* `useInbox` groups the page it fetched; the server has no route that lists
|
|
574
|
+
* them. So this is the channels in what has ARRIVED, and it grows as the page
|
|
575
|
+
* does.
|
|
523
576
|
*/
|
|
524
|
-
function
|
|
525
|
-
const {
|
|
526
|
-
const {
|
|
527
|
-
if (
|
|
577
|
+
function Channels({ onPick, navigate, }) {
|
|
578
|
+
const { channel, openChannel } = useOpen();
|
|
579
|
+
const { channels } = useInbox({ limit: 100 });
|
|
580
|
+
if (channels.length === 0)
|
|
528
581
|
return null;
|
|
529
582
|
const carried = new Map();
|
|
530
|
-
for (const one of
|
|
531
|
-
const held = carried.get(one.
|
|
583
|
+
for (const one of channels) {
|
|
584
|
+
const held = carried.get(one.transport);
|
|
532
585
|
if (held)
|
|
533
586
|
held.push(one);
|
|
534
587
|
else
|
|
535
|
-
carried.set(one.
|
|
588
|
+
carried.set(one.transport, [one]);
|
|
536
589
|
}
|
|
537
|
-
return (_jsx(_Fragment, { children: [...carried].map(([
|
|
590
|
+
return (_jsx(_Fragment, { children: [...carried].map(([transport, held]) => (_jsx(SidebarFolder, { name: transport, defaultOpen: true, children: held.map((one) => (_jsx(SidebarItem, { active: netKey(one) === channel, onPress: () => {
|
|
538
591
|
// ONE NAMESPACE. This wrote the bare inbox key while the team
|
|
539
|
-
// rows wrote a bare
|
|
592
|
+
// rows wrote a bare channel id, into the SAME slot — so whichever
|
|
540
593
|
// pane was open looked the value up in its own list, missed,
|
|
541
594
|
// and drew nothing. `conversations.ts` holds the one key.
|
|
542
|
-
|
|
595
|
+
openChannel(netKey(one));
|
|
543
596
|
navigate?.("/inbox");
|
|
544
597
|
onPick?.();
|
|
545
|
-
}, children:
|
|
598
|
+
}, children: channelName(one) }, one.key))) }, transport))) }));
|
|
546
599
|
}
|
|
547
600
|
/** Whether a name answers what was typed. Case-folded substring: three letters
|
|
548
601
|
* of a half-remembered name is not a pattern, and should not have to be. */
|
|
@@ -561,51 +614,51 @@ function Note({ children }) {
|
|
|
561
614
|
}
|
|
562
615
|
function Team({ filter = "", onPick, navigate, }) {
|
|
563
616
|
const { t } = useI18n();
|
|
564
|
-
const {
|
|
565
|
-
const {
|
|
617
|
+
const { channel, openChannel } = useOpen();
|
|
618
|
+
const { channels, wrong } = useChannels();
|
|
566
619
|
const { isAuthenticated, user } = useIam();
|
|
567
620
|
const { user: account } = useAccount();
|
|
568
621
|
const signedIn = isAuthenticated || Boolean(user) || Boolean(account) || hasSession();
|
|
569
622
|
const free = useFree(signedIn);
|
|
570
623
|
const [starred] = useStarred();
|
|
571
|
-
const shown = list(
|
|
624
|
+
const shown = list(channels).filter((r) => matches(r.name, filter));
|
|
572
625
|
const favourites = shown.filter((r) => starred.has(titleOf(r.name, r.direct)));
|
|
573
626
|
const publicChannels = shown.filter((r) => !r.direct && r.visibility === "public");
|
|
574
627
|
const orgChannels = shown.filter((r) => !r.direct && (r.visibility === "org" || (!r.visibility && !r.private)));
|
|
575
628
|
const privateChannels = shown.filter((r) => !r.direct && (r.visibility === "private" || r.private));
|
|
576
629
|
const directs = shown.filter((r) => r.direct);
|
|
577
|
-
// THE ORDER IS SESSION, THEN REFUSAL, THEN SILENCE — the ladder every
|
|
578
|
-
// this
|
|
630
|
+
// THE ORDER IS SESSION, THEN REFUSAL, THEN SILENCE — the ladder every app in
|
|
631
|
+
// this shell climbs (see Home's `Waiting`). "Reading." never resolves for a
|
|
579
632
|
// reader nobody is going to answer, so the session is asked first.
|
|
580
633
|
if (!signedIn)
|
|
581
634
|
return _jsx(Note, { children: t("Sign in to see your org's channels.") });
|
|
582
635
|
if (wrong)
|
|
583
636
|
return _jsx(Note, { children: say(wrong, t("your channels"), "read", t) });
|
|
584
|
-
if (
|
|
637
|
+
if (channels === null)
|
|
585
638
|
return _jsx(Note, { children: t("Reading your channels.") });
|
|
586
|
-
if (
|
|
639
|
+
if (channels.length === 0)
|
|
587
640
|
return _jsx(Note, { children: t("No channels yet.") });
|
|
588
641
|
if (shown.length === 0)
|
|
589
642
|
return _jsx(Note, { children: t("No channel matches “{filter}”.", { filter }) });
|
|
590
|
-
return (_jsxs(_Fragment, { children: [favourites.length > 0 ? (_jsx(SidebarFolder, { name: t("Favorites"), defaultOpen: true, children: favourites.map((one) => (_jsx(SidebarItem, { active: teamKey(one) ===
|
|
591
|
-
|
|
592
|
-
navigate?.(
|
|
643
|
+
return (_jsxs(_Fragment, { children: [favourites.length > 0 ? (_jsx(SidebarFolder, { name: t("Favorites"), defaultOpen: true, children: favourites.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(Star, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
644
|
+
openChannel(teamKey(one));
|
|
645
|
+
navigate?.(channelHref(teamKey(one)));
|
|
593
646
|
onPick?.();
|
|
594
|
-
}, 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) ===
|
|
595
|
-
|
|
596
|
-
navigate?.(
|
|
647
|
+
}, 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: () => {
|
|
648
|
+
openChannel(teamKey(one));
|
|
649
|
+
navigate?.(channelHref(teamKey(one)));
|
|
597
650
|
onPick?.();
|
|
598
|
-
}, 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) ===
|
|
599
|
-
|
|
600
|
-
navigate?.(
|
|
651
|
+
}, 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: () => {
|
|
652
|
+
openChannel(teamKey(one));
|
|
653
|
+
navigate?.(channelHref(teamKey(one)));
|
|
601
654
|
onPick?.();
|
|
602
|
-
}, 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) ===
|
|
603
|
-
|
|
604
|
-
navigate?.(
|
|
655
|
+
}, 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: () => {
|
|
656
|
+
openChannel(teamKey(one));
|
|
657
|
+
navigate?.(channelHref(teamKey(one)));
|
|
605
658
|
onPick?.();
|
|
606
|
-
}, children: one.name }, one.id))) })) : null, directs.length > 0 ? (_jsx(SidebarFolder, { name: t("Direct messages"), defaultOpen: true, children: directs.map((one) => (_jsx(SidebarItem, { active: teamKey(one) ===
|
|
607
|
-
|
|
608
|
-
navigate?.(
|
|
659
|
+
}, children: one.name }, one.id))) })) : null, directs.length > 0 ? (_jsx(SidebarFolder, { name: t("Direct messages"), defaultOpen: true, children: directs.map((one) => (_jsx(SidebarItem, { active: teamKey(one) === channel, icon: _jsx(AtSign, { size: 13, "aria-hidden": true }), onPress: () => {
|
|
660
|
+
openChannel(teamKey(one));
|
|
661
|
+
navigate?.(channelHref(teamKey(one)));
|
|
609
662
|
onPick?.();
|
|
610
663
|
}, children: one.name }, one.id))) })) : null] }));
|
|
611
664
|
}
|
|
@@ -654,7 +707,7 @@ function Team({ filter = "", onPick, navigate, }) {
|
|
|
654
707
|
*/
|
|
655
708
|
function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
656
709
|
const { t } = useI18n();
|
|
657
|
-
const { agents:
|
|
710
|
+
const { agents: cast, openAgent, withAgents, openSession, open: openThread } = useOpen();
|
|
658
711
|
const { agents, create, remove, loading: agentsLoading, error: agentsWrong } = useAgents();
|
|
659
712
|
const { people, loading: peopleLoading, error: peopleWrong, } = usePeople({ owner: owner ?? "", service: false });
|
|
660
713
|
const [open, setOpen] = useState(true);
|
|
@@ -764,7 +817,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
764
817
|
setBusy(true);
|
|
765
818
|
try {
|
|
766
819
|
await remove(id);
|
|
767
|
-
if (
|
|
820
|
+
if (cast.includes(name))
|
|
768
821
|
openAgent(name);
|
|
769
822
|
}
|
|
770
823
|
catch {
|
|
@@ -810,7 +863,7 @@ function Bots({ show, owner, filter = "", onPick, navigate, }) {
|
|
|
810
863
|
navigate?.("/chat");
|
|
811
864
|
onPick?.();
|
|
812
865
|
}, children: _jsxs(YStack, { minW: 0, children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, children: called }), person.email ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: person.email })) : null] }) }, person.id));
|
|
813
|
-
}), shown.map((agent) => (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(SidebarItem, { active:
|
|
866
|
+
}), shown.map((agent) => (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(SidebarItem, { active: cast.includes(called(agent.name)), icon: _jsx(Face, { src: agent.avatar, emoji: agent.emoji, name: agent.name, size: 18 }), onPress: () => {
|
|
814
867
|
setArming(null);
|
|
815
868
|
const threadId = createDirectChat({
|
|
816
869
|
id: agent.id,
|
|
@@ -844,41 +897,41 @@ const FLOOR = 200;
|
|
|
844
897
|
const CEIL = 480;
|
|
845
898
|
/** Per-reader, per-browser. A width that resets is a width you set every load. */
|
|
846
899
|
const SPAN = "hanzo.sidebar.span";
|
|
847
|
-
/** The
|
|
900
|
+
/** The shell's sidebar: its default width, px. */
|
|
848
901
|
const SIDEBAR_WIDTH = 244;
|
|
849
902
|
/**
|
|
850
|
-
* Where
|
|
903
|
+
* Where an app's own column goes, when it has one.
|
|
851
904
|
*
|
|
852
905
|
* The frame owns the COLUMN — its width, its edge, whether it is open — and the
|
|
853
|
-
*
|
|
854
|
-
* ignorant of sources and previews and whatever
|
|
855
|
-
* than a prop because the content belongs to the
|
|
906
|
+
* app owns what is IN it, which is the only split that lets the shell stay
|
|
907
|
+
* ignorant of sources and previews and whatever an app grows next. A slot rather
|
|
908
|
+
* than a prop because the content belongs to the app's own state: passed up
|
|
856
909
|
* through the router as a prop, the sources of an answer would have to live
|
|
857
910
|
* somewhere both the route and the pane can see, and that is the conversation
|
|
858
911
|
* itself moved out of the component holding it.
|
|
859
912
|
*/
|
|
860
913
|
const Slot = createContext(null);
|
|
861
|
-
/** Whether the
|
|
914
|
+
/** Whether the pane is drawn in the app's frame (`Split framed`), where what
|
|
862
915
|
* floats on the frame's ground is cut as a pane. */
|
|
863
916
|
export const Framed = createContext(false);
|
|
864
|
-
/** Puts its children in the column beside the
|
|
917
|
+
/** Puts its children in the column beside the pane. Draws nothing where the
|
|
865
918
|
* frame has no column open. */
|
|
866
|
-
export function
|
|
919
|
+
export function Side({ children }) {
|
|
867
920
|
const slot = useContext(Slot);
|
|
868
921
|
if (!slot)
|
|
869
922
|
return null;
|
|
870
|
-
// WHAT IS BESIDE THE
|
|
871
|
-
// keeps the REACT tree it was written in, so a
|
|
923
|
+
// WHAT IS BESIDE THE PANE CANNOT PUT SOMETHING BESIDE THE PANE. A portal
|
|
924
|
+
// keeps the REACT tree it was written in, so a view rendered in this column
|
|
872
925
|
// still sees this slot and would draw its own column into the column it is
|
|
873
926
|
// already in. Handing its contents an empty slot ends that by construction
|
|
874
927
|
// rather than by a rule somebody has to remember.
|
|
875
928
|
return createPortal(_jsx(Slot.Provider, { value: null, children: children }), slot);
|
|
876
929
|
}
|
|
877
930
|
/**
|
|
878
|
-
* A PANE AND THE COLUMN BESIDE IT. The
|
|
879
|
-
* while `useOpen().aside` names one, and `
|
|
880
|
-
* the app at `/` lay
|
|
881
|
-
* `swap` stands in the pane in the
|
|
931
|
+
* A PANE AND THE COLUMN BESIDE IT. The app draws the pane; the column is open
|
|
932
|
+
* while `useOpen().aside` names one, and `Side` fills it. The shell and
|
|
933
|
+
* the app at `/` lay an app out with this, so an app's column is one mechanism.
|
|
934
|
+
* `swap` stands in the pane in the app's place (a chosen Settings row).
|
|
882
935
|
*
|
|
883
936
|
* The column is @hanzo/build's (`useSplit`), the one Dev's runs stand their
|
|
884
937
|
* panel in: its edge, the width the person drags (kept in their preferences
|
|
@@ -889,12 +942,12 @@ export function Beside({ children }) {
|
|
|
889
942
|
*
|
|
890
943
|
* `framed` is the app at `/`: both are panes floating on the frame's ground
|
|
891
944
|
* (app/_web.tsx), filled with `--pane-fill` and cut by `pane()`, and the edge
|
|
892
|
-
* that sizes the column sits in the gutter between them.
|
|
893
|
-
* the paper ladder instead. In the
|
|
894
|
-
* `side` grid areas. `bare` leaves the framed pane uncut, for a
|
|
945
|
+
* that sizes the column sits in the gutter between them. Unframed they lie on
|
|
946
|
+
* the paper ladder instead. In the shell the two are its `pane` and
|
|
947
|
+
* `side` grid areas. `bare` leaves the framed pane uncut, for a view that floats
|
|
895
948
|
* panes of its own: a Dev run, which @hanzo/build draws as two.
|
|
896
949
|
*/
|
|
897
|
-
export function
|
|
950
|
+
export function Split({ children, swap, framed = false, bare = false, }) {
|
|
898
951
|
const { t } = useI18n();
|
|
899
952
|
const { aside, showAside } = useOpen();
|
|
900
953
|
const split = useSplit(Boolean(aside), "chat", () => showAside(null));
|
|
@@ -911,12 +964,12 @@ export function Paned({ children, swap, framed = false, bare = false, }) {
|
|
|
911
964
|
: { ...pane(), overflow: "hidden" }
|
|
912
965
|
: {
|
|
913
966
|
...sheet(0),
|
|
914
|
-
// The edge the
|
|
967
|
+
// The edge the pane shares with the column before it: the left, or the right in a right-to-left language.
|
|
915
968
|
borderInlineStartWidth: 1,
|
|
916
969
|
borderInlineStartStyle: "solid",
|
|
917
970
|
borderColor: "var(--edge, var(--white-06))",
|
|
918
971
|
}), ref: split.main,
|
|
919
|
-
// inline-style: the pane hidden while the column
|
|
972
|
+
// inline-style: the pane hidden while the column takes its space, written by a drag too (useSplit).
|
|
920
973
|
style: split.mainStyle, 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 ? (_jsxs(YStack, { render: "aside", "data-slot": "side", gridArea: "side", ...pane(framed ? undefined : sheet(1).backgroundColor),
|
|
921
974
|
// In the frame the gutter stands between the pane and this column.
|
|
922
975
|
marginInlineStart: framed ? "var(--pane-gap)" : undefined, ref: split.aside,
|
|
@@ -967,7 +1020,7 @@ function Rail({ mode, places, team, open, navigate, onSettings, onMore, }) {
|
|
|
967
1020
|
}, children: [places.map((place, i) => {
|
|
968
1021
|
const here = place.id === mode;
|
|
969
1022
|
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: 56, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, bg: here ? "$edge" : undefined, hoverStyle: { bg: here ? "$edge" : "$hover" }, children: [_jsx(place.icon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: here ? "$ink" : "$quiet", numberOfLines: 1, children: t(place.label) })] }, place.id));
|
|
970
|
-
}), 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: 56, 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: 12, lineHeight: 14, color: "$quiet", numberOfLines: 1, children: t("Workspace") })] }) }) })) : null, _jsxs(Box, { "data-slot": "more", render: "button", onClick: onMore, "aria-label": t("More places"), title: t("More"), display: "none", "$max-md": { display: "flex", width: "auto", minW: 0 }, flexDirection: "column", width: 56, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(
|
|
1023
|
+
}), 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: 56, 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: 12, lineHeight: 14, color: "$quiet", numberOfLines: 1, children: t("Workspace") })] }) }) })) : null, _jsxs(Box, { "data-slot": "more", render: "button", onClick: onMore, "aria-label": t("More places"), title: t("More"), display: "none", "$max-md": { display: "flex", width: "auto", minW: 0 }, flexDirection: "column", width: 56, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(SearchIcon, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: "$quiet", children: t("More") })] })] }), _jsx(YStack, { items: "center", pb: "$2", children: _jsxs(Box, { render: "button", onClick: onSettings, "aria-label": t("Settings"), title: t("Settings"), display: "flex", flexDirection: "column", width: 56, minH: 44, py: "$1", rounded: "$2", items: "center", justify: "center", gap: 2, hoverStyle: { bg: "$hover" }, children: [_jsx(Settings2, { size: 18, "aria-hidden": true }), _jsx(Text, { fontSize: 12, lineHeight: 14, color: "$quiet", children: t("Settings") })] }) })] }));
|
|
971
1024
|
}
|
|
972
1025
|
/**
|
|
973
1026
|
* Chat's column: start a chat, the projects, then every conversation. The app
|
|
@@ -988,17 +1041,17 @@ function App({ filter, onPick, navigate, }) {
|
|
|
988
1041
|
}
|
|
989
1042
|
/** What a place holds, for the list column. */
|
|
990
1043
|
function Index({ mode, owner, filter, onPick, navigate, }) {
|
|
991
|
-
const
|
|
1044
|
+
const channels = (_jsxs(_Fragment, { children: [_jsx(Channels, { onPick: onPick, navigate: navigate }), _jsx(Team, { filter: filter, onPick: onPick, navigate: navigate })] }));
|
|
992
1045
|
if (mode === "chat")
|
|
993
1046
|
return _jsx(App, { filter: filter, onPick: onPick, navigate: navigate });
|
|
994
1047
|
if (mode === "home")
|
|
995
|
-
return (_jsxs(_Fragment, { children: [_jsx(Chats, { filter: filter, onPick: onPick }),
|
|
1048
|
+
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 })] }));
|
|
996
1049
|
if (mode === "bots")
|
|
997
1050
|
return _jsx(Bots, { show: "agents", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
998
1051
|
if (mode === "contacts")
|
|
999
1052
|
return _jsx(Bots, { show: "people", owner: owner, filter: filter, onPick: onPick, navigate: navigate });
|
|
1000
1053
|
if (mode === "inbox")
|
|
1001
|
-
return
|
|
1054
|
+
return channels;
|
|
1002
1055
|
if (mode === "tasks")
|
|
1003
1056
|
return _jsx(Projects, { filter: filter, onPick: onPick });
|
|
1004
1057
|
return _jsx(Chats, { filter: filter, onPick: onPick });
|
|
@@ -1015,8 +1068,8 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1015
1068
|
/**
|
|
1016
1069
|
* WHICH SETTINGS ROW IS OPEN, and null for none. ONE value, not two.
|
|
1017
1070
|
*
|
|
1018
|
-
* The rail swaps its
|
|
1019
|
-
* the
|
|
1071
|
+
* The rail swaps its lists for the settings list while this holds a row, and
|
|
1072
|
+
* the shell draws that row's pane. Both read the same answer, so a pane deep in
|
|
1020
1073
|
* the tree asking for Channels and the column's own Settings row are the same
|
|
1021
1074
|
* act — which is why there is no second `panel` state beside this one.
|
|
1022
1075
|
*/
|
|
@@ -1065,12 +1118,12 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1065
1118
|
showAside(a);
|
|
1066
1119
|
}
|
|
1067
1120
|
}, [aside, showAside]);
|
|
1068
|
-
// WHAT THE SEARCH OPENS ONTO. The threads this reader has and the
|
|
1121
|
+
// WHAT THE SEARCH OPENS ONTO. The threads this reader has and the channels the
|
|
1069
1122
|
// org keeps, in one list, because "recent" is a question about where you have
|
|
1070
1123
|
// been rather than about which store the answer came from. Both hooks already
|
|
1071
1124
|
// run for the sidebar, so this costs no request of its own.
|
|
1072
|
-
// Which
|
|
1073
|
-
//
|
|
1125
|
+
// Which apps this reader's rail carries: Chat and Dev for everyone, the tiered
|
|
1126
|
+
// apps only where the identity opens the tier and the reader has not hidden it.
|
|
1074
1127
|
const tiers = useTiers();
|
|
1075
1128
|
const [hidden] = useHidden();
|
|
1076
1129
|
const shown = asked || peeking;
|
|
@@ -1096,11 +1149,11 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1096
1149
|
return () => window.removeEventListener("keydown", shortcut);
|
|
1097
1150
|
}, []);
|
|
1098
1151
|
/**
|
|
1099
|
-
* THE SURFACES THAT ARE NOT
|
|
1152
|
+
* THE SURFACES THAT ARE NOT APPS, said once.
|
|
1100
1153
|
*
|
|
1101
1154
|
* Customize is Dev's page, Usage a pane of Settings, Terminals another
|
|
1102
1155
|
* product at its own host, Docs a page. The column draws each as a
|
|
1103
|
-
* row of its own under the quiet label Setup, right under the
|
|
1156
|
+
* row of its own under the quiet label Setup, right under the apps — nothing
|
|
1104
1157
|
* waits behind a More — and the palette offers the same set, so this says
|
|
1105
1158
|
* WHAT they are and each surface says only how it draws them. Written twice
|
|
1106
1159
|
* they had already parted: Settings was in one list and not the other.
|
|
@@ -1159,7 +1212,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1159
1212
|
*
|
|
1160
1213
|
* A row that names a destination goes there and closes the list behind it; a
|
|
1161
1214
|
* row that names a pane opens it and, on a phone, puts the drawer away —
|
|
1162
|
-
* the sheet covers the
|
|
1215
|
+
* the sheet covers the space the pane is about to fill.
|
|
1163
1216
|
*/
|
|
1164
1217
|
const pick = (row) => {
|
|
1165
1218
|
if (!row.href) {
|
|
@@ -1178,12 +1231,12 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1178
1231
|
/**
|
|
1179
1232
|
* WHERE THE PALETTE CAN GO WITHOUT ASKING ANYONE.
|
|
1180
1233
|
*
|
|
1181
|
-
* The
|
|
1234
|
+
* The apps this identity may open, and the surfaces above, as the palette's
|
|
1182
1235
|
* Actions; this Settings and Customize stand in for the palette's own. The
|
|
1183
1236
|
* lists that have to be read — conversations, projects, agents, skills — are
|
|
1184
1237
|
* the palette's, which is why they are not here.
|
|
1185
1238
|
*/
|
|
1186
|
-
const onApex = apex(
|
|
1239
|
+
const onApex = apex(useHostname());
|
|
1187
1240
|
const places = useMemo(() => [CHAT, ...PLACES].filter((place) => shows(place, tiers, hidden, onApex)), [tiers, hidden, onApex]);
|
|
1188
1241
|
const doors = useMemo(() => [
|
|
1189
1242
|
// HOME LEADS, and the palette is the only way to it: it is off the rail
|
|
@@ -1194,7 +1247,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1194
1247
|
.map((place) => ({
|
|
1195
1248
|
// The LABEL, not the title: `title` is what a browser tab says, and
|
|
1196
1249
|
// Home's is the brand — one row reading "Hanzo" among Chat, Dev and
|
|
1197
|
-
// Drive names the company rather than the
|
|
1250
|
+
// Drive names the company rather than the app.
|
|
1198
1251
|
id: place.id,
|
|
1199
1252
|
label: t(place.label),
|
|
1200
1253
|
icon: _jsx(place.icon, { size: 16, "aria-hidden": true }),
|
|
@@ -1214,7 +1267,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1214
1267
|
// The folder's rows and Setup's, narrowed by the column's filter like every other list.
|
|
1215
1268
|
const products = CONSOLE_PRODUCTS.filter((prod) => matches(t(prod.label), filter));
|
|
1216
1269
|
const more = tools.filter((tool) => matches(tool.label, filter));
|
|
1217
|
-
// The static export prerenders the signed-out
|
|
1270
|
+
// The static export prerenders the signed-out shell, so the rail's identity
|
|
1218
1271
|
// half stays quiet until React owns the page. `isLoading` alone is not enough:
|
|
1219
1272
|
// during prerender it is already false and `user` is already null, which would
|
|
1220
1273
|
// ship "Sign in" baked into HTML a signed-in reader then sees flash.
|
|
@@ -1251,7 +1304,7 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1251
1304
|
}, "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: 40, height: 40 }, color: "inherit", children: _jsx(HanzoMark, { size: 18 }) }), settled && isAuthenticated ? (_jsx(XStack, { shrink: 1, minW: 0, children: _jsx(OrgProjectSwitcher, { ...orgState, alwaysShow: true }) })) : null] }), _jsx(YStack, { "data-slot": "places-list", px: "$2", pb: "$2", "$max-md": { display: "none" }, children: places.filter((place) => matches(t(place.label), filter)).map((place) => (_jsx(SidebarItem, { icon: _jsx(place.icon, { size: 16, "aria-hidden": true }), active: place.id === mode, onPress: () => {
|
|
1252
1305
|
navigate?.(place.route);
|
|
1253
1306
|
onPick?.();
|
|
1254
|
-
}, 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: 16, "aria-hidden": true }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, height: 30, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(
|
|
1307
|
+
}, 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: 16, "aria-hidden": true }), onPress: tool.go, children: tool.label }, tool.id))) }) })) : null, _jsx(XStack, { px: "$3", pb: "$2", children: _jsxs(XStack, { flex: 1, height: 30, items: "center", gap: "$2", px: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true }), _jsx(Text, { render: _jsx("input", { value: filter, onChange: (e) => setFilter(e.target.value), onKeyDown: (e) => {
|
|
1255
1308
|
if (e.key === "Escape")
|
|
1256
1309
|
setFilter("");
|
|
1257
1310
|
},
|
|
@@ -1264,15 +1317,15 @@ function Frame({ mode, children, navigate, back, forward, }) {
|
|
|
1264
1317
|
}, children: t("Upgrade plan") })) : null, _jsx(SidebarItem, { icon: _jsx(UserPlus, { size: 15, "aria-hidden": true }), onPress: () => window.open(invite(), "_blank", "noopener"), children: t("Invite Teammates") }), _jsx(SidebarItem, { icon: _jsx(Share2, { size: 15, "aria-hidden": true }), onPress: () => {
|
|
1265
1318
|
navigate?.(site("/referral"));
|
|
1266
1319
|
dismiss();
|
|
1267
|
-
}, children: t("Share Hanzo") }), _jsxs(XStack, { items: "center", gap: "$1", px: "$1.5", py: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(
|
|
1320
|
+
}, children: t("Share Hanzo") }), _jsxs(XStack, { items: "center", gap: "$1", px: "$1.5", py: "$1", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(YStack, { flex: 1, minW: 0, children: _jsx(Account, { host: who, onOrg: (o) => (choose(o), window.location.reload()) }) }), _jsx(Box, { render: "button", onClick: toggle, "aria-label": t("Collapse sidebar"), p: "$2", rounded: "$2", hoverStyle: { bg: "$hover" }, cursor: "pointer", children: _jsx(PanelLeftClose, { size: 16, "aria-hidden": true, "data-i18n-mirror": "" }) })] })] })) : null) : null] }));
|
|
1268
1321
|
return (_jsxs(YStack, { "data-slot": "workspace", "data-hydrated": settled ? "true" : undefined, "data-sidebar": asked ? "open" : "shut", display: "grid", gridTemplateColumns: `${asked ? 0 : 64}px auto minmax(0, 1fr) auto`, gridTemplateRows: "44px minmax(0, 1fr)", gridTemplateAreas: '"rail bar bar bar" "rail list pane side"', "$max-md": {
|
|
1269
1322
|
gridTemplateColumns: "minmax(0, 1fr)",
|
|
1270
1323
|
gridTemplateRows: `44px minmax(0, 1fr) ${TABS_HEIGHT}`,
|
|
1271
1324
|
gridTemplateAreas: '"bar" "pane" "rail"',
|
|
1272
|
-
}, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsxs(XStack, { render: "header", "data-slot": "bar", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, gridArea: "bar", ...sheet(0), height: 44, shrink: 0, items: "center", px: "$3", gap: "$3", borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", children: [_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, 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(XStack, { flex: 1, justify: "center", "data-tauri-drag-region": "deep", children: _jsx(YStack, { width: 440, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(
|
|
1325
|
+
}, position: "relative", width: "100%", height: "100dvh", overflow: "hidden", bg: "$background", backgroundImage: "var(--pane-ground)", children: [_jsx(Rail, { mode: mode, places: places, open: asked, team: onApex ? (signedIn ? ENTRY : WORKSPACE) : undefined, navigate: navigate, onSettings: () => showSettings(FIRST), onMore: () => setFinding(true) }), _jsxs(XStack, { render: "header", "data-slot": "bar", "data-tauri-drag-region": "deep", onMouseDown: dragWindow, onDoubleClick: toggleWindowMaximize, gridArea: "bar", ...sheet(0), height: 44, shrink: 0, items: "center", px: "$3", gap: "$3", borderBottomWidth: 1, borderColor: "var(--edge, var(--white-06))", children: [_jsxs(XStack, { items: "center", gap: "$1", shrink: 0, 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(XStack, { flex: 1, justify: "center", "data-tauri-drag-region": "deep", children: _jsx(YStack, { width: 440, maxW: "100%", position: "relative", children: _jsxs(Box, { render: "button", onClick: () => setFinding(true), display: "flex", flexDirection: "row", "data-slot": "find", items: "center", "$max-md": { justify: "center" }, gap: "$2", width: "100%", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: [_jsx(SearchIcon, { size: 13, "aria-hidden": true, color: "var(--soft, var(--muted-foreground))" }), _jsx(Text, { fontSize: "$1", color: "$soft", "$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: "$2", children: [settled && !signedIn ? (_jsx(Box, { ...TAP, render: "button", onClick: () => enter(LOGIN), display: "flex", items: "center", justify: "center", cursor: "pointer", children: _jsx(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t("Sign in") }) }) })) : null, settled && signedIn && free ? (_jsx(Box, { ...TAP, render: "button", onClick: () => window.location.assign(payUrl("/cart", { returnUrl: window.location.href })), display: "flex", items: "center", justify: "center", cursor: "pointer", "aria-label": t("Upgrade"), "data-slot": "bar-upgrade", children: _jsxs(XStack, { items: "center", justify: "center", height: CONTROL, px: "$2.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", gap: "$1.5", hoverStyle: { bg: "$hover" }, children: [_jsx(Sparkles, { size: 13, "aria-hidden": true, color: "var(--primary)" }), _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: "button", "aria-label": t("Close sidebar"), onClick: dismiss, ...scrim, "data-slot": "scrim", position: "absolute", t: 44, 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: 44, bottom: 0, insetInlineStart: 64 }), "$max-md": { position: "fixed", t: 44, r: 0, b: TABS_HEIGHT, l: 0, width: "100%" }, z: "var(--z-drawer)", bg: "$background", onMouseEnter: () => setPeeking(true), onMouseLeave: () => {
|
|
1273
1326
|
if (!asked)
|
|
1274
1327
|
setPeeking(false);
|
|
1275
|
-
}, children: list })) : null, _jsx(
|
|
1328
|
+
}, 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,
|
|
1276
1329
|
// A chat opens in this workspace's Chat, the palette having picked it; the rest is the app's.
|
|
1277
1330
|
go: (to) => navigate?.(to.startsWith(CHAT.route) ? CHAT.route : site(to)) })) : null] }));
|
|
1278
1331
|
}
|