@hanzo/app 0.2.50 → 0.2.52

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.
@@ -0,0 +1,22 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" width="256" height="256" role="img" aria-label="vi">
2
+ <defs>
3
+ <linearGradient id="g-vi" x1="0" y1="0" x2="1" y2="1"><stop offset="0" stop-color="#a5b4fc"/><stop offset="1" stop-color="#4338ca"/></linearGradient>
4
+ <radialGradient id="f-vi" cx=".36" cy=".3" r=".8"><stop offset="0" stop-color="#e0a27d"/><stop offset="1" stop-color="#b2744f"/></radialGradient>
5
+ <clipPath id="c-vi"><circle cx="128" cy="128" r="128"/></clipPath>
6
+ </defs>
7
+ <g clip-path="url(#c-vi)">
8
+ <rect width="256" height="256" fill="url(#g-vi)"/>
9
+ <circle cx="84" cy="64" r="70" fill="#fff" opacity=".13"/>
10
+ <path d="M26 256 C30 214 66 196 128 196 C190 196 226 214 230 256 Z" fill="#4338ca"/><path d="M26 256 C30 214 66 196 128 196 C100 214 96 240 98 256 Z" fill="#554adc" opacity=".5"/><path d="M104 196 L128 226 L152 196 Z" fill="#e0e7ff"/><path d="M120 214 L136 214 L142 252 L128 262 L114 252 Z" fill="#ef4444"/><path d="M120 206 L136 206 L132 216 L124 216 Z" fill="#dc2626"/><circle cx="182" cy="226" r="16" fill="#f8fafc"/><g transform="translate(172 216) scale(.83)" fill="none" stroke="#3730a3" stroke-width="2.4" stroke-linecap="round" stroke-linejoin="round"><path d="M12 3l2 7 7 2-7 2-2 7-2-7-7-2 7-2z"/></g>
11
+ <rect x="110" y="168" width="36" height="36" rx="14" fill="#ad6f4a"/>
12
+ <ellipse cx="68" cy="128" rx="9" ry="13" fill="#bc7e59"/><ellipse cx="188" cy="128" rx="9" ry="13" fill="#bc7e59"/>
13
+ <ellipse cx="128" cy="120" rx="58" ry="62" fill="url(#f-vi)"/>
14
+ <path d="M70 116 C64 68 96 44 132 46 C168 48 192 70 186 116 C180 98 168 84 150 80 C130 92 96 90 70 116 Z" fill="#111827"/><path d="M96 66 C118 56 146 56 168 70" stroke="#252c3b" stroke-width="5" stroke-linecap="round" fill="none"/>
15
+ <g stroke="#19202f" stroke-width="5" stroke-linecap="round" fill="none"><path d="M90 106 Q104 98 118 104"/><path d="M138 104 Q152 98 166 106"/></g>
16
+ <g fill="#1f2937"><ellipse cx="104" cy="126" rx="7.5" ry="9"/><ellipse cx="152" cy="126" rx="7.5" ry="9"/></g><g fill="#fff"><circle cx="107" cy="122" r="2.8"/><circle cx="155" cy="122" r="2.8"/></g>
17
+ <ellipse cx="88" cy="146" rx="11" ry="7" fill="#f87171" opacity=".28"/><ellipse cx="168" cy="146" rx="11" ry="7" fill="#f87171" opacity=".28"/>
18
+ <path d="M126 134 Q132 140 126 144" stroke="#935530" stroke-width="3.5" fill="none" stroke-linecap="round" opacity=".7"/>
19
+ <path d="M110 154 Q128 172 146 154" stroke="#7c2d12" stroke-width="5" fill="#fff" stroke-linecap="round" stroke-linejoin="round"/>
20
+
21
+ </g>
22
+ </svg>
package/dist/Chat.js CHANGED
@@ -777,7 +777,7 @@ function Thread({ placeholder = message(), initial, anonymous = false, heading,
777
777
  // `kept` changing: when the reader opens another Recent, `open` moves first and
778
778
  // `kept` follows it a render later (the hook takes `thread` in an effect), and
779
779
  // reopening the stale `kept` then sent the two chasing each other until React
780
- // stopped the page (#185).
780
+ // stopped the page (React error 185).
781
781
  const minted = useRef(kept);
782
782
  useEffect(() => {
783
783
  if (kept === minted.current)
@@ -1,8 +1,8 @@
1
1
  import { type PreviewProps } from './preview.js';
2
2
  /**
3
- * Hanzo Team's workspace, playing. From 768px the switcher and the workspace's
4
- * column stand beside the channel; on a phone the channel fills the window, the
5
- * org's mark flips to the next org and the channel's name opens the column as a
3
+ * Hanzo Team's workspace, playing. From 600px of its own width it is the
4
+ * desktop app (the rail, the workspace's column, the channel); narrower, or
5
+ * told `phone`, the phone app: the channel, with the rail and the column as a
6
6
  * drawer. A host (the landing's hero) can pause it, hear when it ends, and fit
7
7
  * it to a device's screen (`PreviewProps`).
8
8
  */
@@ -1,127 +1,41 @@
1
1
  'use client';
2
2
  import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { useEffect, useRef, useState } from 'react';
4
- import { AtSign, ChevronDown, Flame, Hash, Headphones, Heart, Image as Picture, MessageSquareText, Mic, Plus, SendHorizontal, Smile, SquarePen, ThumbsUp } from 'lucide-react';
5
- import { phrase } from '@hanzo/i18n';
3
+ import { useEffect, useMemo, useRef, useState } from 'react';
4
+ import { AtSign, CalendarCheck, Check, ChevronDown, Eye, FileSpreadsheet, FileText, Flame, GitMerge, GitPullRequest, Hash, Headphones, Heart, Image as Picture, Laugh, Mail, Menu, Mic, PartyPopper, Plus, Presentation, Rocket, Search, SendHorizontal, Smile, SquarePen, ThumbsUp, X, } from 'lucide-react';
6
5
  import { useI18n } from '@hanzo/i18n/react';
7
- import { Text, View, XStack, YStack } from '@hanzo/ui';
6
+ import { Avatar as Monogram, Text, View, XStack, YStack } from '@hanzo/ui';
8
7
  import { Face } from './cast.js';
9
- import { md, useDesk, useHost, usePlay, useStage, useStill } from './preview.js';
10
- const WHO = {
11
- ada: { name: 'Ada Park' },
12
- sam: { name: 'Sam Ortiz' },
13
- mina: { name: 'Mina Chen' },
14
- theo: { name: 'Theo Brandt' },
15
- zoe: { name: 'Zoe Iyer' },
16
- des: { name: 'des', agent: true },
17
- dev: { name: 'dev', agent: true },
18
- maya: { name: 'maya', agent: true },
19
- vi: { name: 'vi', agent: true },
20
- };
8
+ import { md, useHost, usePlay, useStage, useStill } from './preview.js';
9
+ import { DAY, HOME, ORGS, SCENE, STILL, agent, channelOf, frame, orgOf, pace, who } from './workday.js';
10
+ /**
11
+ * Hanzo Team, playing: a working day in the workspace, laid out the way a team
12
+ * chat is read. hanzo.team's landing and hanzo.ai's /team open on it, and
13
+ * hanzo.ai's hero plays it in its cycle; one component for every host.
14
+ *
15
+ * Far left, the organizations a person belongs to (one active, "+" under them,
16
+ * the reader at the foot); then the workspace's column: its name, Channels
17
+ * (bold and counted when unread), Direct messages with who is here, and the
18
+ * org's Agents; then the channel: its name and topic, who is in it, the huddle,
19
+ * the messages with their cards, reactions and threads, who is typing, and the
20
+ * composer. A thread opens beside the channel when there is room, over it when
21
+ * not.
22
+ *
23
+ * The day is `./workday`: more than five minutes of people and agents working
24
+ * together before it plays again. It plays while on screen and the pointer is
25
+ * elsewhere. Pressing an org or a channel plays that room's own scene, an
26
+ * agent's question or a draft answers a press, and from then on the reader
27
+ * drives: nothing loops over them. A reader who asked for less motion, the
28
+ * server and the first paint get one whole frame: #eng with the pull request
29
+ * merged.
30
+ *
31
+ * People wear their initials (`Face`, as the app draws a person with no
32
+ * picture); agents wear the crew's memoji, `/memoji/<id>.svg`, from this
33
+ * package's assets. The chrome is monochrome; the faces carry the colour.
34
+ */
21
35
  /** A reaction's mark: monochrome, as the rest of the chrome. */
22
- const MARKS = { flame: Flame, heart: Heart, thumbs: ThumbsUp };
23
- const ORGS = [
24
- {
25
- id: 'acme',
26
- name: 'Acme',
27
- mark: 'A',
28
- channels: [
29
- { id: 'general', topic: phrase('Everything Acme') },
30
- { id: 'launch', topic: phrase('Shipping the pricing page this week') },
31
- { id: 'design', topic: phrase('Screens, mocks and taste'), unread: 2 },
32
- ],
33
- people: ['zoe', 'sam', 'ada'],
34
- agents: ['des', 'dev'],
35
- },
36
- {
37
- id: 'friday',
38
- name: 'Friday Club',
39
- mark: 'F',
40
- channels: [
41
- { id: 'side-project', topic: phrase('Building a recipe app, for fun') },
42
- { id: 'game-night', topic: phrase('Who is in this week'), unread: 5 },
43
- ],
44
- people: ['mina', 'theo', 'ada'],
45
- agents: ['maya', 'vi'],
46
- },
47
- {
48
- id: 'lab',
49
- name: 'Night Lab',
50
- mark: 'N',
51
- channels: [
52
- { id: 'general', topic: phrase('Late ideas, early prototypes') },
53
- { id: 'ideas', topic: phrase('Half-baked, on purpose'), unread: 1 },
54
- ],
55
- people: ['theo', 'zoe'],
56
- agents: ['vi', 'dev'],
57
- },
58
- ];
59
- const org = (id) => ORGS.find((o) => o.id === id) ?? ORGS[0];
60
- /** The channel each org opens on. */
61
- const HOME = { acme: 'launch', friday: 'side-project', lab: 'general' };
62
- const ACME = [
63
- { kind: 'say', who: 'zoe', text: phrase('Pricing page is on the preview link. Tear it apart.'), replies: 3, wait: 600 },
64
- { kind: 'say', who: 'sam', text: phrase('Love it. @des can the plan cards line up?'), wait: 1500 },
65
- { kind: 'typing', who: 'des', wait: 1200 },
66
- { kind: 'say', who: 'des', text: phrase('Done. Every price sits on one baseline now.'), file: 'plan-cards.png', wait: 1100 },
67
- { kind: 'react', mark: 'flame', count: 3, wait: 1300 },
68
- { kind: 'say', who: 'ada', text: phrase('@dev ship it when the checks pass.'), wait: 1300 },
69
- { kind: 'typing', who: 'dev', wait: 1200 },
70
- { kind: 'say', who: 'dev', text: phrase('Checks passed. It is live.'), wait: 1000 },
71
- { kind: 'react', mark: 'thumbs', count: 4, wait: 1000 },
72
- ];
73
- const FRIDAY = [
74
- { kind: 'say', who: 'mina', text: phrase('Who is in for the recipe app tonight?'), wait: 700 },
75
- { kind: 'say', who: 'theo', text: phrase('In. @maya can you set up the board?'), wait: 1400 },
76
- { kind: 'typing', who: 'maya', wait: 1200 },
77
- { kind: 'say', who: 'maya', text: phrase('Board is ready: sign-in, recipes and search, a card each.'), wait: 1000 },
78
- { kind: 'react', mark: 'heart', count: 5, wait: 1100 },
79
- { kind: 'say', who: 'ada', text: phrase('Bringing snacks.'), replies: 2, wait: 1300 },
80
- ];
81
- /** What each room says when it is opened by hand. */
82
- const ROOMS = {
83
- 'acme/launch': ACME,
84
- 'acme/general': [
85
- { kind: 'say', who: 'ada', text: phrase('Standup moved to 10 today.'), wait: 300 },
86
- { kind: 'say', who: 'zoe', text: phrase('Works for me.'), wait: 900 },
87
- { kind: 'react', mark: 'thumbs', count: 2, wait: 800 },
88
- ],
89
- 'acme/design': [
90
- { kind: 'say', who: 'sam', text: phrase('@des a darker hover on the cards?'), wait: 300 },
91
- { kind: 'typing', who: 'des', wait: 800 },
92
- { kind: 'say', who: 'des', text: phrase('Tried it. The mock is in Drive, side by side with the old one.'), file: 'hover.png', wait: 1000 },
93
- ],
94
- 'friday/side-project': FRIDAY,
95
- 'friday/game-night': [
96
- { kind: 'say', who: 'theo', text: phrase('Game night Thursday?'), wait: 300 },
97
- { kind: 'say', who: 'mina', text: phrase('Yes. @vi can you find a time that works for all of us?'), wait: 1000 },
98
- { kind: 'typing', who: 'vi', wait: 800 },
99
- { kind: 'say', who: 'vi', text: phrase('Thursday at 8 works for everyone. It is on your calendars.'), wait: 1000 },
100
- ],
101
- 'lab/general': [
102
- { kind: 'say', who: 'zoe', text: phrase('What if the app planned the week for you?'), wait: 300 },
103
- { kind: 'typing', who: 'dev', wait: 800 },
104
- { kind: 'say', who: 'dev', text: phrase('I can have a first version running by morning.'), wait: 1000 },
105
- { kind: 'react', mark: 'flame', count: 2, wait: 900 },
106
- ],
107
- 'lab/ideas': [
108
- { kind: 'say', who: 'theo', text: phrase('A bot that waters the plants.'), wait: 300 },
109
- { kind: 'say', who: 'zoe', text: phrase('Filed under someday.'), wait: 1000 },
110
- ],
111
- };
112
- /** The whole script: Acme's launch, then the switch to Friday Club. */
113
- const SCRIPT = [...ACME, { kind: 'org', org: 'friday', wait: 2600 }, ...FRIDAY, { kind: 'rest', wait: 2600 }];
114
- /** A reaction under a message: its mark and how many. */
115
- function Reaction({ mark, count }) {
116
- const Mark = MARKS[mark] ?? Heart;
117
- return (_jsxs(XStack, { "data-motion": "rise", items: "center", gap: 4, px: 8, py: 2, rounded: 9999, borderWidth: 1, borderColor: "$ink", bg: "$hover", "$platform-web": { borderRadius: '9999px' }, children: [_jsx(Mark, { size: 12, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$ink", "data-i18n-ltr": true, children: count })] }));
118
- }
119
- /** One message: the face, the name (an agent tagged), the words, a file, its reactions and its thread. */
120
- function Message({ who, file, replies, reactions, children }) {
121
- const { t } = useI18n();
122
- const w = WHO[who];
123
- return (_jsxs(XStack, { "data-motion": "rise", gap: 10, items: "flex-start", children: [_jsx(Face, { name: w.name, size: 32, person: !w.agent }), _jsxs(YStack, { flex: 1, minW: 0, gap: 4, children: [_jsxs(XStack, { items: "center", gap: 6, children: [_jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$ink", numberOfLines: 1, children: w.name }), w.agent ? (_jsx(Text, { fontSize: 10, lineHeight: 14, px: 6, rounded: 6, bg: "$hover", color: "$soft", "$platform-web": { borderRadius: '6px' }, children: t('Agent') })) : null] }), _jsx(Text, { fontSize: "$2", lineHeight: "$3", color: "$ink", children: children }), file ? (_jsxs(XStack, { self: "flex-start", items: "center", gap: 8, mt: 2, px: 10, py: 8, rounded: 10, borderWidth: 1, borderColor: "$edge", bg: "$panel", "$platform-web": { borderRadius: '10px' }, children: [_jsx(XStack, { width: 34, height: 26, rounded: 6, items: "center", justify: "center", bg: "$raised", "$platform-web": { borderRadius: '6px' }, children: _jsx(Picture, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }) }), _jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: file })] })) : null, reactions.length ? (_jsx(XStack, { gap: 6, mt: 2, children: reactions.map((r, i) => (_jsx(Reaction, { mark: r.mark, count: r.count }, i))) })) : null, replies ? (_jsxs(XStack, { items: "center", gap: 6, mt: 2, children: [_jsx(MessageSquareText, { size: 13, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", children: t('{count} replies', { count: replies }) })] })) : null] })] }));
124
- }
36
+ const MARKS = { thumbs: ThumbsUp, heart: Heart, flame: Flame, rocket: Rocket, eyes: Eye, laugh: Laugh, party: PartyPopper, check: Check };
37
+ /** A file's mark, by what it is. */
38
+ const FILES = { doc: FileText, deck: Presentation, sheet: FileSpreadsheet, image: Picture };
125
39
  /** A button drawn as one of the workspace's rows: the press, the hover, the focus ring. */
126
40
  const ROW = {
127
41
  borderWidth: 0,
@@ -129,79 +43,215 @@ const ROW = {
129
43
  hoverStyle: { bg: '$hover' },
130
44
  focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: 'var(--ring)', outlineOffset: -2 },
131
45
  };
132
- /** A dot that says someone is here now. */
133
- function Here() {
134
- return _jsx(View, { width: 7, height: 7, rounded: 9999, bg: "var(--state-online)", shrink: 0, "$platform-web": { borderRadius: '9999px' } });
46
+ /** The fade a list takes where it runs out of room. */
47
+ const TOP = { maskImage: 'linear-gradient(to bottom, transparent, black 48px)', WebkitMaskImage: 'linear-gradient(to bottom, transparent, black 48px)' };
48
+ const FOOT = { maskImage: 'linear-gradient(to bottom, black 82%, transparent)', WebkitMaskImage: 'linear-gradient(to bottom, black 82%, transparent)' };
49
+ /** The reader, at the rail's foot. */
50
+ const ME = 'ada';
51
+ /** How wide the preview must be to draw the workspace's column (below: the phone app). */
52
+ const DESK = 560;
53
+ /** The workspace's column: narrower while the preview is. */
54
+ const breadth = (width) => (width && width < 700 ? 176 : width && width < 820 ? 200 : 232);
55
+ /** How wide the preview must be for the channel's header to show who is in it. */
56
+ const FACES = 900;
57
+ /** "1 reply", "3 replies". */
58
+ const replies = (t, n) => (n === 1 ? t('1 reply') : t('{count} replies', { count: n }));
59
+ /** How wide it must be for a thread to stand beside the channel rather than over it. */
60
+ const ROOM = 1000;
61
+ /** A person's initials or an agent's memoji. */
62
+ function Avatar({ id, size }) {
63
+ if (!agent(id))
64
+ return _jsx(Face, { name: who(id).name, size: size, person: true });
65
+ return (_jsx(View, { render: _jsx("img", { src: `/memoji/${id}.svg`, alt: "", width: size, height: size, loading: "lazy", decoding: "async" }), width: size, height: size, shrink: 0, rounded: 9999, display: "block", "$platform-web": { borderRadius: '9999px' } }));
66
+ }
67
+ /** A dot that says someone is here now; hollow when away, pulsing while they work. */
68
+ function Here({ away, busy }) {
69
+ return (_jsx(View, { "data-motion": busy ? 'pulse' : undefined, width: 8, height: 8, shrink: 0, rounded: 9999, borderWidth: away ? 1.5 : 0, borderColor: "$soft", bg: away ? 'transparent' : 'var(--state-online)', "$platform-web": { borderRadius: '9999px' } }));
70
+ }
71
+ /** A line of a message with its mentions set apart: `@dev` reads as the agent's name. */
72
+ function Said({ text }) {
73
+ return (_jsx(_Fragment, { children: text.split(/(@[a-z]+)/).map((part, i) => /^@[a-z]+$/.test(part) ? (_jsx(Text, { render: "span", fontWeight: "600", color: "$ink", bg: "$raised", px: 3, rounded: 4, "$platform-web": { borderRadius: '4px' }, children: `@${who(part.slice(1)).name}` }, i)) : (part)) }));
74
+ }
75
+ /** The frame every card in a message stands in. */
76
+ function Frame({ children }) {
77
+ return (_jsx(YStack, { "data-motion": "rise", self: "flex-start", width: "100%", maxW: 420, mt: 4, gap: 8, p: 12, rounded: 12, borderWidth: 1, borderColor: "$edge", bg: "$panel", "$platform-web": { borderRadius: '12px' }, children: children }));
78
+ }
79
+ /** A small round state: a check once done, an empty ring before. */
80
+ function Tick({ done }) {
81
+ return (_jsx(XStack, { width: 16, height: 16, shrink: 0, rounded: 9999, items: "center", justify: "center", borderWidth: 1, borderColor: done ? '$ink' : '$edge', bg: done ? '$ink' : 'transparent', "$platform-web": { borderRadius: '9999px', transition: 'background-color 260ms ease, border-color 260ms ease' }, children: done ? _jsx(Check, { size: 10, strokeWidth: 3, color: "var(--background)", "aria-hidden": true }) : null }));
82
+ }
83
+ /** A pill-shaped control a card offers; inked once it is the answer. */
84
+ function Choice({ on, faded, label, onPress }) {
85
+ return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, onClick: onPress }), items: "center", gap: 6, px: 12, py: 5, rounded: 9999, borderWidth: 1, borderColor: on ? '$ink' : '$edge', bg: on ? '$ink' : 'transparent', opacity: faded ? 0.5 : 1, cursor: "pointer", hoverStyle: { borderColor: '$ink' }, focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '9999px', transition: 'background-color 240ms ease, border-color 240ms ease, opacity 240ms ease' }, children: [on ? _jsx(Check, { size: 12, color: "var(--background)", strokeWidth: 2.6, "aria-hidden": true }) : null, _jsx(Text, { fontSize: "$1", fontWeight: "500", color: on ? '$background' : '$ink', children: label })] }));
86
+ }
87
+ /** What a message carries: a pull request, a draft, a file, a meeting, a list, a question, design options. */
88
+ function Attachment({ card, onPick }) {
89
+ const { t } = useI18n();
90
+ switch (card.kind) {
91
+ case 'pr': {
92
+ const merged = card.state === 'merged';
93
+ const Mark = merged ? GitMerge : GitPullRequest;
94
+ const state = merged ? t('Merged') : card.state === 'passed' ? t('Checks passed') : t('Review requested');
95
+ return (_jsxs(Frame, { children: [_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(Mark, { size: 15, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: `${card.repo} #${card.number}` })] }), _jsx(Text, { fontSize: "$2", lineHeight: "$3", fontWeight: "600", color: "$ink", children: t(card.title) }), _jsxs(XStack, { items: "center", gap: 10, flexWrap: "wrap", children: [_jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: `+${card.add} −${card.del}` }), _jsxs(XStack, { "data-motion": "rise", items: "center", gap: 5, px: 8, py: 2, rounded: 9999, borderWidth: 1, borderColor: card.state === 'review' ? '$edge' : '$ink', bg: merged ? '$ink' : 'transparent', "$platform-web": { borderRadius: '9999px' }, children: [card.state === 'review' ? null : _jsx(Check, { size: 11, strokeWidth: 3, color: merged ? 'var(--background)' : 'var(--foreground)', "aria-hidden": true }), _jsx(Text, { fontSize: 11, lineHeight: 16, fontWeight: "600", color: merged ? '$background' : '$ink', children: state })] }, card.state)] })] }));
96
+ }
97
+ case 'draft':
98
+ return (_jsxs(Frame, { children: [_jsxs(XStack, { items: "center", gap: 8, children: [_jsx(Mail, { size: 14, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$1", color: "$soft", numberOfLines: 1, children: t('To: {to}', { to: t(card.to) }) }), _jsx(Text, { fontSize: 11, fontWeight: "600", color: card.sent ? '$ink' : '$soft', children: card.sent ? t('Sent') : t('Draft') })] }), _jsx(Text, { "data-motion": "rise", fontSize: "$2", lineHeight: "$3", color: "$ink", children: t(card.body) }, card.body), card.sent ? null : (_jsx(XStack, { gap: 8, children: _jsx(Choice, { on: false, faded: false, label: t('Send'), onPress: () => onPick({ sent: true }) }) }))] }));
99
+ case 'file': {
100
+ const Mark = FILES[card.type];
101
+ return (_jsx(Frame, { children: _jsxs(XStack, { items: "center", gap: 10, children: [_jsx(XStack, { width: 36, height: 36, shrink: 0, rounded: 8, items: "center", justify: "center", bg: "$raised", "$platform-web": { borderRadius: '8px' }, children: _jsx(Mark, { size: 17, color: "var(--foreground)", "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, "data-i18n-ltr": true, children: card.name }), card.detail ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t(card.detail) })) : null] })] }) }));
102
+ }
103
+ case 'meeting':
104
+ return (_jsx(Frame, { children: _jsxs(XStack, { items: "center", gap: 10, children: [_jsx(XStack, { width: 36, height: 36, shrink: 0, rounded: 8, items: "center", justify: "center", bg: "$ink", "$platform-web": { borderRadius: '8px' }, children: _jsx(CalendarCheck, { size: 17, color: "var(--background)", "aria-hidden": true }) }), _jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", numberOfLines: 1, children: t(card.title) }), _jsx(Text, { fontSize: "$1", lineHeight: 16, color: "$soft", children: t('{when} · on everyone’s calendar', { when: t(card.when) }) })] })] }) }));
105
+ case 'list':
106
+ return (_jsxs(Frame, { children: [_jsx(Text, { fontSize: "$1", fontWeight: "700", color: "$ink", children: t(card.title) }), _jsx(YStack, { gap: 6, children: card.items.map((item, i) => (_jsxs(XStack, { items: "center", gap: 8, children: [card.done ? _jsx(Tick, { done: card.done.includes(i) }) : _jsx(View, { width: 5, height: 5, shrink: 0, rounded: 9999, bg: "$soft", mx: 5, "$platform-web": { borderRadius: '9999px' } }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", lineHeight: "$2", color: "$ink", children: t(item) })] }, item))) })] }));
107
+ case 'ask':
108
+ return (_jsx(Frame, { children: _jsx(XStack, { gap: 8, flexWrap: "wrap", children: card.options.map((o, i) => (_jsx(Choice, { on: card.picked === i, faded: card.picked !== undefined && card.picked !== i, label: t(o), onPress: () => onPick({ picked: i }) }, o))) }) }));
109
+ case 'options':
110
+ return (_jsxs(Frame, { children: [_jsx(Text, { fontFamily: "$mono", fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: card.file }), _jsx(XStack, { gap: 8, children: card.options.map((o, i) => {
111
+ const on = card.picked === i;
112
+ return (_jsxs(YStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Option {name}', { name: o }), onClick: () => onPick({ picked: i }) }), flex: 1, gap: 5, p: 8, rounded: 8, borderWidth: on ? 2 : 1, borderColor: on ? '$ink' : '$edge', bg: "$background", opacity: card.picked !== undefined && !on ? 0.55 : 1, cursor: "pointer", focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '8px', transition: 'opacity 240ms ease, border-color 240ms ease' }, children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: "$1", fontWeight: "700", color: "$ink", "data-i18n-ltr": true, children: o }), on ? _jsx(Check, { size: 12, strokeWidth: 3, color: "var(--foreground)", "aria-hidden": true }) : null] }), _jsx(XStack, { gap: 4, children: [0, 1, 2].map((c) => (_jsxs(YStack, { flex: 1, gap: 3, p: 4, rounded: 4, borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '4px' }, children: [_jsx(View, { height: 4, width: "70%", rounded: 2, bg: "$raised" }), Array.from({ length: i ? 2 : 4 }, (_, k) => (_jsx(View, { height: 3, width: "90%", rounded: 2, bg: "$hover" }, k)))] }, c))) })] }, o));
113
+ }) })] }));
114
+ }
115
+ }
116
+ /** The reactions under a message; a count that changes lands again. */
117
+ function Reactions({ list }) {
118
+ return (_jsx(XStack, { gap: 6, mt: 4, flexWrap: "wrap", children: list.map((r) => {
119
+ const Mark = MARKS[r.mark];
120
+ return (_jsxs(XStack, { "data-motion": "rise", items: "center", gap: 4, px: 8, py: 2, rounded: 9999, borderWidth: 1, borderColor: "$edge", bg: "$hover", "$platform-web": { borderRadius: '9999px' }, children: [_jsx(Mark, { size: 12, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$ink", "data-i18n-ltr": true, children: r.n })] }, `${r.mark}:${r.n}`));
121
+ }) }));
122
+ }
123
+ /** A message's name line: the name, an agent's tag, the time. */
124
+ function Byline({ id, time }) {
125
+ const { t } = useI18n();
126
+ return (_jsxs(XStack, { items: "center", gap: 6, minW: 0, children: [_jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$ink", numberOfLines: 1, children: who(id).name }), agent(id) ? (_jsx(Text, { fontSize: 10, lineHeight: 15, fontWeight: "600", px: 5, rounded: 4, bg: "$raised", color: "$soft", "$platform-web": { borderRadius: '4px' }, children: t('Agent') })) : null, _jsx(Text, { fontSize: 11, color: "$faint", "data-i18n-ltr": true, children: time })] }));
127
+ }
128
+ /** "9:41 AM", in the reader's language, for a minute of the sample day. */
129
+ function useClock() {
130
+ const { locale } = useI18n();
131
+ const time = useMemo(() => new Intl.DateTimeFormat(locale, { hour: 'numeric', minute: '2-digit' }), [locale]);
132
+ return (minute) => time.format(new Date(2026, 9, 29, Math.floor(minute / 60), minute % 60));
133
+ }
134
+ /** One message: the face (or nothing, under the same author's last), the words, its card, reactions and thread. */
135
+ function Post({ m, grouped, onThread, onPick }) {
136
+ const { t } = useI18n();
137
+ const clock = useClock();
138
+ const last = m.replies[m.replies.length - 1];
139
+ const faces = [...new Set(m.replies.map((r) => r.who))].slice(0, 3);
140
+ return (_jsxs(XStack, { "data-motion": "rise", gap: 10, items: "flex-start", pt: grouped ? 0 : 8, children: [_jsx(View, { width: 34, shrink: 0, items: "center", children: grouped ? null : _jsx(Avatar, { id: m.who, size: 34 }) }), _jsxs(YStack, { flex: 1, minW: 0, gap: 2, children: [grouped ? null : _jsx(Byline, { id: m.who, time: clock(m.time) }), _jsx(Text, { fontSize: "$2", lineHeight: "$3", color: "$ink", children: _jsx(Said, { text: t(m.text) }) }), m.card ? _jsx(Attachment, { card: m.card, onPick: onPick }) : null, m.reactions.length ? _jsx(Reactions, { list: m.reactions }) : null, m.replies.length ? (_jsxs(XStack, { render: _jsx("button", { type: "button", onClick: onThread, "aria-label": t('Open the thread: {replies}', { replies: replies(t, m.replies.length) }) }), self: "flex-start", items: "center", gap: 6, mt: 4, px: 4, py: 3, rounded: 8, bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: [_jsx(XStack, { children: faces.map((f, i) => (_jsx(View, { marginInlineStart: i ? -5 : 0, rounded: 9999, borderWidth: 1.5, borderColor: "var(--background)", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Avatar, { id: f, size: 18 }) }, f))) }), _jsx(Text, { fontSize: "$1", fontWeight: "700", color: "$ink", children: replies(t, m.replies.length) }), _jsx(Text, { fontSize: "$1", color: "$faint", numberOfLines: 1, children: last ? t('Last reply {time}', { time: clock(last.time) }) : null })] })) : null] })] }));
141
+ }
142
+ /** A count of what is unread, inked. */
143
+ function Count({ n }) {
144
+ return (_jsx(Text, { "data-motion": "rise", fontSize: 10, lineHeight: 16, minW: 18, px: 5, rounded: 9999, bg: "$ink", color: "$background", fontWeight: "700", text: "center", "$platform-web": { borderRadius: '9999px' }, "data-i18n-ltr": true, children: n }, n));
145
+ }
146
+ /**
147
+ * An organization's tile: its initial in its own hue, as the app's org chooser
148
+ * draws it (@hanzo/ui `Avatar`, seeded on the org's id). The active one wears a
149
+ * ring in that hue; the others what is unread there.
150
+ */
151
+ function Tile({ org, on, n, size, onPress }) {
152
+ const { t } = useI18n();
153
+ return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": n ? t('Open {org}, {count} unread', { org: org.name, count: n }) : t('Open {org}', { org: org.name }), onClick: onPress }), position: "relative", shrink: 0, p: 2, rounded: 10, borderWidth: 2, borderColor: on ? '$ink' : 'transparent', bg: "transparent", cursor: "pointer", opacity: on ? 1 : 0.8, hoverStyle: { opacity: 1 }, focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '10px', transition: 'opacity 200ms ease, border-color 260ms ease' }, children: [_jsx(Monogram, { size: size, shape: "rounded", name: org.name, colorSeed: org.id, variant: on ? 'outline' : 'soft' }), n ? (_jsx(View, { position: "absolute", t: -7, insetInlineEnd: -8, children: _jsx(Count, { n: n }) })) : null] }));
154
+ }
155
+ /** Three dots that take turns, beside who is typing. */
156
+ function Dots() {
157
+ return (_jsx(XStack, { gap: 3, "aria-hidden": true, children: ['0ms', '200ms', '400ms'].map((delay) => (_jsx(View, { "data-motion": "pulse", width: 4, height: 4, rounded: 9999, bg: "$soft", "$platform-web": { borderRadius: '9999px', animationDelay: delay } }, delay))) }));
135
158
  }
136
159
  /**
137
- * Hanzo Team's workspace, playing. From 768px the switcher and the workspace's
138
- * column stand beside the channel; on a phone the channel fills the window, the
139
- * org's mark flips to the next org and the channel's name opens the column as a
160
+ * Hanzo Team's workspace, playing. From 600px of its own width it is the
161
+ * desktop app (the rail, the workspace's column, the channel); narrower, or
162
+ * told `phone`, the phone app: the channel, with the rail and the column as a
140
163
  * drawer. A host (the landing's hero) can pause it, hear when it ends, and fit
141
164
  * it to a device's screen (`PreviewProps`).
142
165
  */
143
166
  export function TeamPreview(props) {
144
- const { compact } = props;
145
- const { t, dir } = useI18n();
167
+ const { compact, phone } = props;
168
+ const { t } = useI18n();
146
169
  const still = useStill();
147
170
  const { box, seen, width, visible, held, hold } = useStage();
148
171
  const { live, end } = useHost(props);
149
- const desk = useDesk(width, props);
172
+ // It always lays itself out by its own width, so it fits a page's column, a
173
+ // hero's half and a device's screen alike; the window decides only before it
174
+ // is measured (the server's render and the first paint).
175
+ const desk = phone ? false : width ? width >= DESK : null;
176
+ const roomy = desk !== false && width >= ROOM;
150
177
  const [driven, setDriven] = useState(false);
151
178
  const loop = useRef(true);
152
179
  const [replay, setReplay] = useState(0);
153
- // The room the reader opened by hand, and the channels they have read.
180
+ // The room the reader opened, the rooms they have read, and what they set by hand.
154
181
  const [opened, setOpened] = useState(null);
155
182
  const [read, setRead] = useState([]);
183
+ const [hand, setHand] = useState({});
184
+ const [threadHand, setThreadHand] = useState(undefined);
156
185
  const [drawer, setDrawer] = useState(false);
157
186
  useEffect(() => {
158
187
  loop.current = !driven;
159
188
  }, [driven]);
160
- const key = opened ? `${opened.org}/${opened.channel}` : 'script';
161
- const lines = opened ? (ROOMS[key] ?? ACME) : SCRIPT;
162
- const at = usePlay(lines, seen && !still, replay, { visible, held, loop, live, end });
163
- const shown = lines.slice(0, at);
164
- const last = shown[shown.length - 1];
165
- // Where the script stands: the last org it switched to, on that org's channel.
166
- const flip = [...shown].reverse().find((l) => l.kind === 'org');
167
- const here = opened?.org ?? (flip?.kind === 'org' ? flip.org : 'acme');
168
- const channel = opened?.channel ?? HOME[here];
169
- const o = org(here);
170
- const next = ORGS[(ORGS.indexOf(o) + 1) % ORGS.length];
189
+ const lines = useMemo(() => (opened ? (SCENE[opened] ?? pace([{ kind: 'open', room: opened, time: 9 * 60 }])) : DAY), [opened]);
190
+ const run = seen && !still;
191
+ const at = usePlay(lines, run, replay, { visible, held, loop, live, end });
192
+ // Before it plays, and under reduced motion, the day stands at its still frame.
193
+ const upto = opened || run ? at : STILL;
194
+ const f = useMemo(() => frame(lines, upto), [lines, upto]);
195
+ const here = f.room;
196
+ const o = orgOf(here);
197
+ const channel = channelOf(here);
171
198
  const topic = o.channels.find((c) => c.id === channel)?.topic ?? '';
172
- // The messages since the last switch, each with the reactions that landed on it.
173
- const since = flip ? shown.slice(shown.indexOf(flip) + 1) : shown;
174
- const messages = [];
175
- for (const l of since) {
176
- if (l.kind === 'say')
177
- messages.push({ line: l, reactions: [] });
178
- else if (l.kind === 'react' && messages.length)
179
- messages[messages.length - 1].reactions.push({ mark: l.mark, count: l.count });
180
- }
181
- const go = (next, room = HOME[next]) => {
199
+ const messages = (f.rooms[here] ?? []).map((m) => (hand[m.id] && m.card ? { ...m, card: { ...m.card, ...hand[m.id] } } : m));
200
+ const thread = threadHand === undefined ? f.thread : threadHand;
201
+ const parent = thread ? messages.find((m) => m.id === thread) : undefined;
202
+ const typing = f.typing;
203
+ const huddle = f.huddle[here] ?? [];
204
+ const unread = (room) => (room === here || read.includes(room) ? 0 : (f.unread[room] ?? 0));
205
+ /** What is unread across an org's channels. */
206
+ const waiting = (org) => ORGS.find((x) => x.id === org)?.channels.reduce((n, c) => n + unread(`${org}/${c.id}`), 0) ?? 0;
207
+ const members = [...o.people.slice(0, 2), ...o.agents.slice(0, 2)];
208
+ /** The reader takes over: nothing loops over what they set. */
209
+ const go = (room) => {
182
210
  setDriven(true);
183
211
  setDrawer(false);
184
- setOpened({ org: next, channel: room });
185
- setRead((r) => [...r, `${next}/${room}`]);
212
+ setThreadHand(undefined);
213
+ setOpened(room);
214
+ setRead((r) => (r.includes(room) ? r : [...r, room]));
186
215
  setReplay((n) => n + 1);
187
216
  };
188
- const unread = (orgId, c) => (c.unread && !read.includes(`${orgId}/${c.id}`) && !(orgId === here && c.id === channel) ? c.unread : 0);
189
- /** The organizations a person belongs to: the active one marked, "+" under them. */
190
- const switcher = (_jsxs(YStack, { items: "center", gap: 10, py: 12, width: 60, height: "100%", shrink: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: [ORGS.map((x) => {
191
- const on = x.id === here;
192
- const waiting = !on && x.channels.some((c) => unread(x.id, c) > 0);
193
- return (_jsxs(XStack, { position: "relative", items: "center", justify: "center", children: [_jsx(View, { position: "absolute", insetInlineStart: -12, width: 4, height: on ? 28 : 0, rounded: 9999, bg: "$ink", "$platform-web": { borderRadius: '9999px', transition: still ? 'none' : 'height 260ms ease' } }), _jsx(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Open {org}', { org: x.name }), onClick: () => go(x.id) }), width: 36, height: 36, rounded: 10, items: "center", justify: "center", bg: on ? '$ink' : '$raised', borderWidth: 0, cursor: "pointer", focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '10px', transition: still ? 'none' : 'background-color 260ms ease' }, children: _jsx(Text, { fontSize: "$3", fontWeight: "700", color: on ? '$background' : '$ink', "data-i18n-ltr": true, children: x.mark }) }), waiting ? (_jsx(View, { position: "absolute", t: -2, insetInlineEnd: -2, width: 10, height: 10, rounded: 9999, bg: "$ink", borderWidth: 2, borderColor: "$sunken", "$platform-web": { borderRadius: '9999px' } })) : null] }, x.id));
194
- }), _jsx(XStack, { width: 36, height: 36, rounded: 10, items: "center", justify: "center", borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '10px' }, children: _jsx(Plus, { size: 16, color: "var(--muted-foreground)", "aria-hidden": true }) })] }));
195
- /** The workspace's column: its name, the channels, the people and the agents. */
196
- const column = (_jsxs(YStack, { "data-motion": "rise", minH: 0, overflow: "hidden", gap: 2, px: 8, py: 10, children: [_jsxs(XStack, { items: "center", gap: 6, px: 6, pb: 10, children: [_jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, children: o.name }), _jsx(ChevronDown, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(View, { flex: 1 }), _jsx(SquarePen, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true })] }), _jsx(Text, { fontSize: "$1", color: "$soft", px: 6, pt: 4, pb: 2, children: t('Channels') }), o.channels.map((c) => {
197
- const on = c.id === channel;
198
- const n = unread(here, c);
199
- return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Open #{channel}', { channel: c.id }), onClick: () => go(here, c.id) }), items: "center", gap: 6, px: 8, py: 5, rounded: 8, bg: on ? '$raised' : 'transparent', ...ROW, "$platform-web": { borderRadius: '8px', textAlign: 'start' }, children: [_jsx(Hash, { size: 13, color: on || n ? 'var(--foreground)' : 'var(--muted-foreground)', "aria-hidden": true }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", fontWeight: on || n ? '700' : '400', color: on || n ? '$ink' : '$soft', numberOfLines: 1, "data-i18n-ltr": true, children: c.id }), n ? (_jsx(Text, { fontSize: 10, lineHeight: 16, minW: 18, px: 5, rounded: 9999, bg: "$ink", color: "$background", fontWeight: "700", text: "center", "$platform-web": { borderRadius: '9999px' }, "data-i18n-ltr": true, children: n })) : null] }, c.id));
200
- }), _jsx(Text, { fontSize: "$1", color: "$soft", px: 6, pt: 10, pb: 2, children: t('Direct messages') }), o.people.map((p) => (_jsxs(XStack, { items: "center", gap: 8, px: 8, py: 4, children: [_jsx(Face, { name: WHO[p].name, size: 24, person: true }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", color: "$soft", numberOfLines: 1, children: WHO[p].name }), _jsx(Here, {})] }, p))), _jsx(Text, { fontSize: "$1", color: "$soft", px: 6, pt: 10, pb: 2, children: t('Agents') }), o.agents.map((a) => (_jsxs(XStack, { items: "center", gap: 8, px: 8, py: 4, children: [_jsx(Face, { name: WHO[a].name, size: 24 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", color: "$soft", numberOfLines: 1, children: WHO[a].name }), last?.kind === 'typing' && last.who === a ? _jsx(View, { "data-motion": "pulse", width: 7, height: 7, rounded: 9999, bg: "var(--state-online)", "$platform-web": { borderRadius: '9999px' } }) : _jsx(Here, {})] }, a)))] }, here));
201
- const title = (opens) => (_jsxs(_Fragment, { children: [_jsxs(XStack, { items: "center", gap: 4, children: [_jsx(Hash, { size: 14, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, "data-i18n-ltr": true, children: channel }), opens ? _jsx(ChevronDown, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }) : null] }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t(topic) })] }));
202
- return (_jsxs(View, { ref: box, "data-slot": "team-preview", role: "group", "aria-label": t('Hanzo Team, playing a sample workspace'), ...hold, display: "grid", position: "relative", height: compact ? '100%' : 620, overflow: "hidden", bg: "var(--background)", gridTemplateColumns: "minmax(0, 1fr)", ...md(desk, { height: compact ? '100%' : 600, gridTemplateColumns: '60px 220px minmax(0, 1fr)' }), "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, children: switcher }), _jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, borderColor: "$edge", borderInlineEndWidth: 1, children: column }), _jsxs(YStack, { minW: 0, minH: 0, position: "relative", children: [_jsxs(XStack, { items: "center", gap: 10, px: 14, py: 10, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsx(XStack, { ...md(desk, { display: 'none' }), children: _jsx(XStack, { render: _jsx("button", { type: "button", "aria-label": t('Open {org}', { org: next.name }), onClick: () => go(next.id) }), width: 30, height: 30, shrink: 0, rounded: 8, items: "center", justify: "center", bg: "$ink", borderWidth: 0, cursor: "pointer", "$platform-web": { borderRadius: '8px' }, children: _jsx(Text, { fontSize: "$2", fontWeight: "700", color: "$background", "data-i18n-ltr": true, children: o.mark }) }) }), _jsx(YStack, { flex: 1, minW: 0, display: "none", ...md(desk, { display: 'flex' }), children: title(false) }), _jsx(YStack, { flex: 1, minW: 0, render: _jsx("button", { type: "button", "aria-expanded": drawer, "aria-label": t('Channels in {org}', { org: o.name }), onClick: () => setDrawer(!drawer) }), borderWidth: 0, bg: "transparent", p: 0, cursor: "pointer", ...md(desk, { display: 'none' }), "$platform-web": { textAlign: 'start' }, children: title(true) }), _jsx(XStack, { display: "none", ...md(desk, { display: 'flex' }), children: o.agents.map((p, i) => (_jsx(View, { marginInlineStart: i ? -6 : 0, rounded: 9999, borderWidth: 2, borderColor: "var(--background)", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Face, { name: WHO[p].name, size: 24 }) }, p))) }), _jsxs(XStack, { items: "center", gap: 6, px: 10, py: 5, rounded: 8, borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '8px' }, children: [_jsx(Headphones, { size: 14, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { display: "none", ...md(desk, { display: 'flex' }), fontSize: "$1", color: "$ink", children: t('Huddle') })] })] }), _jsx(YStack, { flex: 1, minH: 0, overflow: "hidden", justify: "flex-end", gap: 14, px: 16, py: 14, "$platform-web": { maskImage: 'linear-gradient(to bottom, transparent, black 56px)', WebkitMaskImage: 'linear-gradient(to bottom, transparent, black 56px)' }, children: messages.map(({ line, reactions }) => (_jsx(Message, { who: line.who, file: line.file, replies: line.replies, reactions: reactions, children: t(line.text) }, `${here}/${line.text}`))) }), _jsx(Text, { fontSize: "$1", color: "$soft", px: 16, minH: 18, children: last?.kind === 'typing' ? t('{name} is typing…', { name: WHO[last.who].name }) : '' }), _jsxs(YStack, { mx: 12, mb: 12, mt: 4, gap: 8, px: 12, py: 10, rounded: 12, borderWidth: 1, borderColor: "$edge", bg: "$panel", "$platform-web": { borderRadius: '12px' }, children: [_jsx(Text, { fontSize: "$2", color: "$faint", numberOfLines: 1, children: t('Message #{channel}', { channel }) }), _jsxs(XStack, { items: "center", gap: 12, children: [_jsx(Plus, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(AtSign, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Smile, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Mic, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(View, { flex: 1 }), _jsx(SendHorizontal, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true, "data-i18n-mirror": true })] })] }), _jsxs(XStack, { "aria-hidden": !drawer, position: "absolute", t: 0, b: 0, insetInlineStart: 0, width: "86%", maxW: 320, bg: "var(--background)", borderColor: "$edge", borderInlineEndWidth: 1, boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", pointerEvents: drawer ? 'auto' : 'none', ...md(desk, { display: 'none' }), "$platform-web": {
203
- transform: drawer ? 'none' : `translateX(calc((100% + 32px) * ${dir === 'rtl' ? 1 : -1}))`,
204
- transition: still ? 'none' : 'transform 320ms cubic-bezier(0.2, 0.7, 0.2, 1)',
205
- visibility: drawer ? 'visible' : 'hidden',
206
- }, children: [switcher, _jsx(YStack, { flex: 1, minW: 0, children: column })] })] })] }));
217
+ const pick = (id) => (patch) => {
218
+ setDriven(true);
219
+ setHand((h) => ({ ...h, [id]: { ...h[id], ...patch } }));
220
+ };
221
+ const openThread = (id) => {
222
+ setDriven(true);
223
+ setThreadHand(id);
224
+ };
225
+ /** The organizations a person belongs to: the active one marked, "+" under them, the reader at the foot. */
226
+ const rail = (_jsxs(YStack, { items: "center", gap: 12, py: 12, width: 60, height: "100%", shrink: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: [ORGS.map((x) => {
227
+ const on = x.id === o.id;
228
+ return (_jsxs(XStack, { position: "relative", items: "center", justify: "center", children: [_jsx(View, { position: "absolute", insetInlineStart: -8, width: 4, height: on ? 28 : 0, rounded: 9999, bg: "$ink", "$platform-web": { borderRadius: '9999px', transition: still ? 'none' : 'height 260ms ease' } }), _jsx(Tile, { org: x, on: on, n: on ? 0 : waiting(x.id), size: "xl", onPress: () => go(HOME[x.id]) })] }, x.id));
229
+ }), _jsx(XStack, { width: 32, height: 32, rounded: 8, items: "center", justify: "center", borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '8px' }, children: _jsx(Plus, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }) }), _jsx(View, { flex: 1 }), _jsxs(View, { position: "relative", children: [_jsx(Avatar, { id: ME, size: 30 }), _jsx(View, { position: "absolute", b: -1, insetInlineEnd: -1, rounded: 9999, borderWidth: 2, borderColor: "$sunken", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Here, {}) })] })] }));
230
+ const heading = (label) => (_jsxs(XStack, { items: "center", gap: 4, px: 8, pt: 12, pb: 3, children: [_jsx(ChevronDown, { size: 12, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", fontWeight: "600", color: "$soft", children: label })] }));
231
+ /** The workspace's column: its name, search, the channels, the direct messages and the agents. */
232
+ const column = (_jsxs(YStack, { "data-motion": "rise", flex: 1, minH: 0, overflow: "hidden", px: 8, py: 10, "$platform-web": FOOT, children: [_jsxs(XStack, { items: "center", gap: 6, px: 8, pb: 10, children: [_jsx(Text, { fontSize: "$4", fontWeight: "700", color: "$ink", numberOfLines: 1, children: o.name }), _jsx(ChevronDown, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(View, { flex: 1 }), _jsx(XStack, { width: 28, height: 28, rounded: 8, items: "center", justify: "center", bg: "$raised", "$platform-web": { borderRadius: '8px' }, children: _jsx(SquarePen, { size: 14, color: "var(--foreground)", "aria-hidden": true }) })] }), _jsxs(XStack, { items: "center", gap: 6, mx: 4, mb: 4, px: 10, height: 28, rounded: 8, borderWidth: 1, borderColor: "$edge", "$platform-web": { borderRadius: '8px' }, children: [_jsx(Search, { size: 12, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$faint", numberOfLines: 1, children: t('Search {org}', { org: o.name }) })] }), heading(t('Channels')), o.channels.map((c) => {
233
+ const room = `${o.id}/${c.id}`;
234
+ const on = room === here;
235
+ const n = unread(room);
236
+ return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Open #{channel}', { channel: c.id }), onClick: () => go(room) }), items: "center", gap: 6, px: 10, py: 4, rounded: 8, bg: on ? '$raised' : 'transparent', ...ROW, "$platform-web": { borderRadius: '8px', textAlign: 'start' }, children: [_jsx(Hash, { size: 13, color: on || n ? 'var(--foreground)' : 'var(--muted-foreground)', "aria-hidden": true }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", lineHeight: 20, fontWeight: on || n ? '700' : '400', color: on || n ? '$ink' : '$soft', numberOfLines: 1, "data-i18n-ltr": true, children: c.id }), n ? _jsx(Count, { n: n }) : null] }, c.id));
237
+ }), heading(t('Direct messages')), o.people.map((p, i) => (_jsxs(XStack, { items: "center", gap: 8, px: 10, py: 3, children: [_jsx(Avatar, { id: p, size: 20 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", color: "$soft", numberOfLines: 1, children: who(p).name }), _jsx(Here, { away: i === o.people.length - 1, busy: typing?.who === p })] }, p))), heading(t('Agents')), o.agents.map((a) => (_jsxs(XStack, { items: "center", gap: 8, px: 10, py: 3, children: [_jsx(Avatar, { id: a, size: 20 }), _jsx(Text, { flex: 1, minW: 0, fontSize: "$2", color: "$soft", numberOfLines: 1, children: t('{name} · {role}', { name: who(a).name, role: t(who(a).role ?? '') }) }), _jsx(Here, { busy: typing?.who === a })] }, a)))] }, o.id));
238
+ const title = (_jsxs(YStack, { flex: 1, minW: 0, children: [_jsxs(XStack, { items: "center", gap: 3, children: [_jsx(Hash, { size: 15, color: "var(--foreground)", "aria-hidden": true }), _jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, "data-i18n-ltr": true, children: channel }), _jsx(ChevronDown, { size: 13, color: "var(--muted-foreground)", "aria-hidden": true })] }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t(topic) })] }));
239
+ /** A conversation's messages, the oldest leaving the top; a run of one author's lines shares one face. */
240
+ const list = (items, threads) => (_jsx(YStack, { flex: 1, minH: 0, overflow: "hidden", justify: "flex-end", gap: 6, px: 16, pt: 8, pb: 4, "$platform-web": TOP, children: items.map((m, i) => {
241
+ const before = items[i - 1];
242
+ const grouped = !!before && before.who === m.who && !before.card && !before.replies.length && m.time - before.time < 5;
243
+ return _jsx(Post, { m: m, grouped: grouped, onThread: threads ? () => openThread(m.id) : undefined, onPick: pick(m.id) }, m.id);
244
+ }) }));
245
+ const composer = (placeholder) => (_jsxs(YStack, { mx: 12, mb: 12, gap: 8, px: 12, py: 10, rounded: 12, borderWidth: 1, borderColor: "$edge", bg: "$panel", "$platform-web": { borderRadius: '12px' }, children: [_jsx(Text, { fontSize: "$2", color: "$faint", numberOfLines: 1, children: placeholder }), _jsxs(XStack, { items: "center", gap: 12, children: [_jsx(Plus, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(AtSign, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Smile, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(Mic, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }), _jsx(View, { flex: 1 }), _jsx(SendHorizontal, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true, "data-i18n-mirror": true })] })] }));
246
+ /** The thread a message started: the message, its replies, a reply box. */
247
+ const side = parent ? (_jsxs(YStack, { flex: 1, minH: 0, bg: "var(--background)", children: [_jsxs(XStack, { items: "center", gap: 8, px: 14, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsxs(YStack, { flex: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", children: t('Thread') }), _jsx(Text, { fontSize: "$1", color: "$soft", "data-i18n-ltr": true, children: `#${channel}` })] }), _jsx(XStack, { render: _jsx("button", { type: "button", "aria-label": t('Close the thread'), onClick: () => openThread(null) }), width: 28, height: 28, rounded: 8, items: "center", justify: "center", bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: _jsx(X, { size: 15, color: "var(--muted-foreground)", "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflow: "hidden", justify: "flex-end", gap: 6, px: 14, pt: 8, pb: 4, "$platform-web": TOP, children: [_jsx(Post, { m: { ...parent, replies: [] }, grouped: false, onPick: pick(parent.id) }), _jsxs(XStack, { items: "center", gap: 8, py: 6, children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: replies(t, parent.replies.length) }), _jsx(View, { flex: 1, height: 1, bg: "$edge" })] }), parent.replies.map((r, i) => (_jsx(Post, { m: { id: `${parent.id}/${i}`, who: r.who, text: r.text, time: r.time, reactions: [], replies: [] }, grouped: false, onPick: () => undefined }, i)))] }), composer(t('Reply…'))] }, parent.id)) : null;
248
+ return (_jsxs(View, { ref: box, "data-slot": "team-preview", role: "group", "aria-label": t('Hanzo Team, playing a sample workspace'), ...hold, display: "grid", position: "relative", height: compact ? '100%' : 620, overflow: "hidden", bg: "var(--background)", gridTemplateColumns: "minmax(0, 1fr)", ...md(desk, {
249
+ height: compact ? '100%' : 640,
250
+ gridTemplateColumns: `60px ${breadth(width)}px minmax(0, 1fr)${roomy && parent ? ' 300px' : ''}`,
251
+ }), "$platform-web": { textAlign: 'start' }, children: [_jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, children: rail }), _jsx(YStack, { display: "none", ...md(desk, { display: 'flex' }), minH: 0, borderColor: "$edge", borderInlineEndWidth: 1, bg: "$sunken", children: column }), _jsxs(YStack, { minW: 0, minH: 0, position: "relative", children: [_jsxs(XStack, { items: "center", gap: 10, px: 14, minH: 52, borderBottomWidth: 1, borderColor: "$edge", children: [_jsx(XStack, { ...md(desk, { display: 'none' }), children: _jsx(XStack, { render: _jsx("button", { type: "button", "aria-expanded": drawer, "aria-label": t('Channels in {org}', { org: o.name }), onClick: () => setDrawer(!drawer) }), width: 32, height: 32, rounded: 8, items: "center", justify: "center", bg: "transparent", ...ROW, "$platform-web": { borderRadius: '8px' }, children: _jsx(Menu, { size: 17, color: "var(--foreground)", "aria-hidden": true }) }) }), title, _jsxs(XStack, { display: "none", ...(width >= FACES ? { display: 'flex' } : {}), items: "center", children: [members.map((p, i) => (_jsx(View, { marginInlineStart: i ? -6 : 0, rounded: 9999, borderWidth: 2, borderColor: "var(--background)", "$platform-web": { borderRadius: '9999px' }, children: _jsx(Avatar, { id: p, size: 22 }) }, p))), _jsx(Text, { fontSize: "$1", color: "$soft", marginInlineStart: 6, "data-i18n-ltr": true, children: o.people.length + o.agents.length })] }), _jsxs(XStack, { "data-motion": "rise", items: "center", gap: 6, px: 10, height: 30, rounded: 8, borderWidth: 1, borderColor: huddle.length ? '$ink' : '$edge', bg: huddle.length ? '$ink' : 'transparent', "$platform-web": { borderRadius: '8px' }, children: [huddle.length ? _jsx(View, { "data-motion": "pulse", width: 7, height: 7, rounded: 9999, bg: "var(--state-online)", "$platform-web": { borderRadius: '9999px' } }) : null, _jsx(Headphones, { size: 14, color: huddle.length ? 'var(--background)' : 'var(--foreground)', "aria-hidden": true }), _jsx(Text, { display: "none", ...md(desk, { display: 'flex' }), fontSize: "$1", fontWeight: "600", color: huddle.length ? '$background' : '$ink', children: huddle.length ? t('Huddle · {count}', { count: huddle.length }) : t('Huddle') })] }, huddle.length ? 'on' : 'off')] }), _jsxs(YStack, { ...md(desk, { display: 'none' }), gap: 8, pt: 10, pb: 8, borderBottomWidth: 1, borderColor: "$edge", children: [_jsxs(XStack, { items: "center", gap: 10, px: 12, children: [ORGS.map((x) => (_jsx(Tile, { org: x, on: x.id === o.id, n: x.id === o.id ? 0 : waiting(x.id), size: "lg", onPress: () => go(HOME[x.id]) }, x.id))), _jsx(Text, { "data-motion": "rise", flex: 1, minW: 0, fontSize: "$3", fontWeight: "700", color: "$ink", numberOfLines: 1, marginInlineStart: 4, children: o.name }, o.id)] }), _jsx(XStack, { flexWrap: "wrap", gap: 6, px: 12, children: o.channels.map((c) => {
252
+ const room = `${o.id}/${c.id}`;
253
+ const on = room === here;
254
+ const n = unread(room);
255
+ return (_jsxs(XStack, { render: _jsx("button", { type: "button", "aria-pressed": on, "aria-label": t('Open #{channel}', { channel: c.id }), onClick: () => go(room) }), shrink: 0, items: "center", gap: 5, px: 10, height: 28, rounded: 9999, borderWidth: 1, borderColor: on ? '$ink' : '$edge', bg: on ? '$ink' : 'transparent', cursor: "pointer", focusVisibleStyle: ROW.focusVisibleStyle, "$platform-web": { borderRadius: '9999px' }, children: [_jsx(Text, { fontSize: "$1", fontWeight: on || n ? '700' : '500', color: on ? '$background' : n ? '$ink' : '$soft', "data-i18n-ltr": true, children: `#${c.id}` }), n && !on ? _jsx(Count, { n: n }) : null] }, c.id));
256
+ }) })] }), list(messages, true), _jsx(XStack, { items: "center", gap: 6, px: 18, minH: 20, children: typing && typing.room === here ? (_jsxs(_Fragment, { children: [_jsx(Dots, {}), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: t('{name} is typing…', { name: who(typing.who).name }) })] })) : null }), composer(t('Message #{channel}', { channel })), side && !roomy ? (_jsx(YStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineEnd: 0, width: "100%", maxW: 420, borderColor: "$edge", borderInlineStartWidth: 1, bg: "var(--background)", boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", children: side })) : null, drawer && desk !== true ? (_jsxs(XStack, { "data-motion": "rise", position: "absolute", t: 0, b: 0, insetInlineStart: 0, width: "88%", maxW: 340, bg: "var(--background)", borderColor: "$edge", borderInlineEndWidth: 1, boxShadow: "0 24px 60px -24px color-mix(in srgb, var(--pure-black) 60%, transparent)", ...md(desk, { display: 'none' }), children: [rail, _jsx(YStack, { flex: 1, minW: 0, bg: "$sunken", children: column })] })) : null] }), side && roomy ? (_jsx(YStack, { minW: 0, minH: 0, borderColor: "$edge", borderInlineStartWidth: 1, children: side })) : null] }));
207
257
  }
package/dist/bots/Bots.js CHANGED
@@ -153,7 +153,7 @@ const EXAMPLE_ACTIONS = {
153
153
  'Code Reviewer': {
154
154
  title: 'Computer',
155
155
  status: 'Done',
156
- summary: 'Analyzed pull request #142 for architectural consistency, security considerations, and edge cases.',
156
+ summary: 'Analyzed pull request 142 for architectural consistency, security considerations, and edge cases.',
157
157
  tasks: [
158
158
  'Verified zero memory leaks and confirmed strict typing',
159
159
  'Validated test suite passes across all target environments',