@hanzo/app 0.3.94 → 0.3.96
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Account.d.ts +9 -3
- package/dist/Account.js +142 -141
- package/dist/App.js +71 -37
- package/dist/Bar.js +1 -1
- package/dist/Betas.d.ts +1 -1
- package/dist/Betas.js +16 -22
- package/dist/Board.js +114 -48
- package/dist/CalScheduler.d.ts +1 -0
- package/dist/CalScheduler.js +223 -57
- package/dist/Chat.js +432 -153
- package/dist/Contacts.js +35 -31
- package/dist/ContextMenu.js +126 -42
- package/dist/Directory.js +1 -1
- package/dist/Drawer.js +1 -1
- package/dist/Drive.js +351 -119
- package/dist/Gate.js +156 -13
- package/dist/Home.js +31 -53
- package/dist/Inbox.js +29 -15
- package/dist/InlineRename.d.ts +6 -0
- package/dist/InlineRename.js +41 -0
- package/dist/Learning.js +132 -13
- package/dist/Market.js +13 -9
- package/dist/Meet.d.ts +5 -0
- package/dist/Meet.js +75 -51
- package/dist/MoreMenu.d.ts +19 -0
- package/dist/MoreMenu.js +33 -0
- package/dist/NeedMoreUsage.js +2 -2
- package/dist/OrgSwitcher.js +6 -2
- package/dist/PreferencesDialog.js +5 -2
- package/dist/Rail.d.ts +73 -7
- package/dist/Rail.js +372 -111
- package/dist/Recents.js +77 -24
- package/dist/RightPane.js +2 -2
- package/dist/Search.d.ts +13 -1
- package/dist/Search.js +366 -50
- package/dist/Setup.js +34 -5
- package/dist/Shared.js +12 -12
- package/dist/Shell.d.ts +10 -0
- package/dist/Shell.js +258 -158
- package/dist/Sidebar.d.ts +14 -3
- package/dist/Sidebar.js +411 -129
- package/dist/SkipLink.d.ts +8 -0
- package/dist/SkipLink.js +11 -0
- package/dist/Start.js +51 -52
- package/dist/Terminals.js +159 -11
- package/dist/ToBottom.js +1 -1
- package/dist/Upgrade.d.ts +8 -3
- package/dist/Upgrade.js +194 -103
- package/dist/Usage.d.ts +1 -1
- package/dist/Usage.js +186 -82
- package/dist/WalletPill.js +8 -2
- package/dist/Work.js +162 -53
- package/dist/archive.d.ts +8 -0
- package/dist/archive.js +16 -0
- package/dist/bots/Bots.js +16 -1
- package/dist/bots/ComputerDialog.js +53 -26
- package/dist/bots/ConnectorsDialog.js +34 -15
- package/dist/bots/Make.js +5 -1
- package/dist/bots/Panel.js +37 -31
- package/dist/bots/Roster.d.ts +4 -1
- package/dist/bots/Roster.js +71 -25
- package/dist/bots/Thread.js +54 -27
- package/dist/bots/face.js +9 -3
- package/dist/bots/grid.d.ts +36 -0
- package/dist/bots/grid.js +91 -0
- package/dist/bots/ink.d.ts +1 -1
- package/dist/bots/ink.js +1 -1
- package/dist/bots/kit.d.ts +9 -4
- package/dist/bots/kit.js +3 -2
- package/dist/chord.d.ts +13 -0
- package/dist/chord.js +30 -1
- package/dist/crew.js +47 -4
- package/dist/ground.d.ts +2 -2
- package/dist/ground.js +3 -3
- package/dist/help.d.ts +7 -3
- package/dist/help.js +19 -14
- package/dist/keys.d.ts +28 -0
- package/dist/keys.js +58 -0
- package/dist/lib/arrival.d.ts +5 -0
- package/dist/lib/arrival.js +10 -0
- package/dist/lib/betas.d.ts +2 -0
- package/dist/lib/betas.js +10 -0
- package/dist/lib/branch.d.ts +11 -0
- package/dist/lib/branch.js +11 -0
- package/dist/lib/chatPreferences.d.ts +1 -1
- package/dist/lib/chatPreferences.js +1 -1
- package/dist/lib/dev-mode.d.ts +18 -0
- package/dist/lib/dev-mode.js +102 -0
- package/dist/lib/durable.d.ts +1 -1
- package/dist/lib/durable.js +1 -1
- package/dist/lib/info-hint.d.ts +7 -0
- package/dist/lib/info-hint.js +8 -0
- package/dist/lib/model-picker.d.ts +2 -0
- package/dist/lib/model-picker.js +12 -0
- package/dist/lib/owners.d.ts +5 -0
- package/dist/lib/owners.js +15 -0
- package/dist/lib/pay.d.ts +2 -0
- package/dist/lib/pay.js +4 -0
- package/dist/lib/todo.d.ts +7 -1
- package/dist/lib/todo.js +41 -29
- package/dist/look.js +39 -8
- package/dist/rail-open.d.ts +9 -0
- package/dist/rail-open.js +34 -0
- package/dist/renaming.d.ts +10 -0
- package/dist/renaming.js +25 -0
- package/dist/seek.d.ts +6 -1
- package/dist/seek.js +13 -0
- package/dist/thread.d.ts +2 -1
- package/dist/thread.js +85 -44
- package/package.json +11 -11
package/dist/CalScheduler.js
CHANGED
|
@@ -1,63 +1,67 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
-
import { useState, useEffect } from 'react';
|
|
4
|
-
import { Calendar as CalendarIcon, Plus, Bot, Video, ExternalLink, Zap, Trash2, X, } from 'lucide-react';
|
|
3
|
+
import { useState, useEffect, useRef, useCallback } from 'react';
|
|
4
|
+
import { Calendar as CalendarIcon, Check, ChevronDown, Plus, Bot, Video, ExternalLink, Zap, Trash2, X, } from 'lucide-react';
|
|
5
5
|
import { phrase } from '@hanzo/i18n';
|
|
6
6
|
import { Text, View, XStack, YStack } from '@hanzo/gui';
|
|
7
|
-
import { Button } from '@hanzo/ui';
|
|
7
|
+
import { Button, Popover, PopoverContent, PopoverTrigger, toast } from '@hanzo/ui';
|
|
8
8
|
import { useI18n } from '@hanzo/i18n/react';
|
|
9
|
+
import { useDevMode } from './lib/dev-mode.js';
|
|
10
|
+
const LEGACY_PORT_DESCRIPTION = 'Sync on port 9005 drive server performance and ingress routing.';
|
|
11
|
+
const PLAIN_SYNC_DESCRIPTION = phrase('Sync on file storage performance and traffic routing.');
|
|
9
12
|
const DEFAULT_EVENTS = [
|
|
10
13
|
{
|
|
11
14
|
id: 'evt-1',
|
|
12
|
-
title: phrase('Daily
|
|
15
|
+
title: phrase('Daily morning AI intelligence digest'),
|
|
13
16
|
type: 'bot_automation',
|
|
14
17
|
date: '2026-09-04',
|
|
15
18
|
time: '09:00',
|
|
16
19
|
duration: phrase('15m'),
|
|
17
20
|
botName: 'Chief',
|
|
18
21
|
cronPattern: '0 9 * * 1-5',
|
|
19
|
-
description: phrase('
|
|
20
|
-
status: 'scheduled',
|
|
21
|
-
},
|
|
22
|
-
{
|
|
23
|
-
id: 'evt-2',
|
|
24
|
-
title: phrase('Platform Architecture & Inference Sync'),
|
|
25
|
-
type: 'meeting',
|
|
26
|
-
date: '2026-09-04',
|
|
27
|
-
time: '18:00',
|
|
28
|
-
duration: phrase('45m'),
|
|
29
|
-
meetUrl: 'https://meet.hanzo.ai/platform-architecture',
|
|
30
|
-
botName: 'Hanzo Coder (Bot Co-pilot)',
|
|
31
|
-
description: phrase('Sync on port 9005 drive server performance and ingress routing.'),
|
|
22
|
+
description: phrase('Collect frontier AI papers, benchmark shifts, and pull requests into team channels.'),
|
|
32
23
|
status: 'scheduled',
|
|
33
24
|
},
|
|
34
25
|
{
|
|
35
26
|
id: 'evt-3',
|
|
36
|
-
title: phrase('Autonomous
|
|
27
|
+
title: phrase('Autonomous outbound prospecting run'),
|
|
37
28
|
type: 'bot_automation',
|
|
38
29
|
date: '2026-09-04',
|
|
39
30
|
time: '11:00',
|
|
40
31
|
duration: phrase('60m'),
|
|
41
32
|
botName: 'Sales Outbound',
|
|
42
33
|
cronPattern: '0 11 * * 1-5',
|
|
43
|
-
description: phrase('
|
|
34
|
+
description: phrase('Find 50 lookalike enterprise leads and prepare personalized outreach drafts.'),
|
|
44
35
|
status: 'scheduled',
|
|
45
36
|
},
|
|
46
37
|
{
|
|
47
38
|
id: 'evt-4',
|
|
48
|
-
title: phrase('Hourly GitHub PR
|
|
39
|
+
title: phrase('Hourly GitHub PR and typecheck review'),
|
|
49
40
|
type: 'agent_query',
|
|
50
41
|
date: '2026-09-04',
|
|
51
42
|
time: '14:00',
|
|
52
43
|
duration: phrase('20m'),
|
|
53
44
|
botName: 'Hanzo Coder',
|
|
54
45
|
cronPattern: '0 * * * *',
|
|
55
|
-
description: phrase('Verify type safety and lint across
|
|
46
|
+
description: phrase('Verify type safety and lint across open pull requests in the organization.'),
|
|
47
|
+
status: 'scheduled',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
id: 'evt-2',
|
|
51
|
+
title: phrase('Platform architecture and inference sync'),
|
|
52
|
+
type: 'meeting',
|
|
53
|
+
date: '2026-09-04',
|
|
54
|
+
time: '18:00',
|
|
55
|
+
duration: phrase('45m'),
|
|
56
|
+
meetUrl: 'https://meet.hanzo.ai/platform-architecture',
|
|
57
|
+
botName: 'Hanzo Coder (Bot Co-pilot)',
|
|
58
|
+
description: PLAIN_SYNC_DESCRIPTION,
|
|
59
|
+
devDescription: phrase(LEGACY_PORT_DESCRIPTION),
|
|
56
60
|
status: 'scheduled',
|
|
57
61
|
},
|
|
58
62
|
{
|
|
59
63
|
id: 'evt-5',
|
|
60
|
-
title: phrase('Research
|
|
64
|
+
title: phrase('Research review'),
|
|
61
65
|
type: 'meeting',
|
|
62
66
|
date: '2026-09-04',
|
|
63
67
|
time: '20:00',
|
|
@@ -68,39 +72,70 @@ const DEFAULT_EVENTS = [
|
|
|
68
72
|
status: 'scheduled',
|
|
69
73
|
},
|
|
70
74
|
];
|
|
75
|
+
/** Format a 24h clock pair into plain English (e.g. `9:00 AM`). */
|
|
76
|
+
function formatHourMinute(hour, minute) {
|
|
77
|
+
const period = hour >= 12 ? 'PM' : 'AM';
|
|
78
|
+
const h12 = hour % 12 === 0 ? 12 : hour % 12;
|
|
79
|
+
const mm = String(minute).padStart(2, '0');
|
|
80
|
+
return `${h12}:${mm} ${period}`;
|
|
81
|
+
}
|
|
82
|
+
/** Human-readable schedule phrase for common 5-field cron patterns when Developer mode is off. */
|
|
83
|
+
function humanizeCron(pattern, t) {
|
|
84
|
+
const parts = pattern.trim().split(/\s+/);
|
|
85
|
+
if (parts.length !== 5)
|
|
86
|
+
return t('Recurring schedule');
|
|
87
|
+
const [min, hour, dom, mon, dow] = parts;
|
|
88
|
+
if (min === '0' && hour === '*' && dom === '*' && mon === '*' && dow === '*') {
|
|
89
|
+
return t('Every hour');
|
|
90
|
+
}
|
|
91
|
+
const everyMin = /^\*\/(\d+)$/.exec(min);
|
|
92
|
+
if (everyMin && hour === '*' && dom === '*' && mon === '*' && dow === '*') {
|
|
93
|
+
return t('Every {n} minutes', { n: everyMin[1] });
|
|
94
|
+
}
|
|
95
|
+
const mNum = Number(min);
|
|
96
|
+
const hNum = Number(hour);
|
|
97
|
+
if (Number.isInteger(mNum) && Number.isInteger(hNum) && dom === '*' && mon === '*') {
|
|
98
|
+
const time = formatHourMinute(hNum, mNum);
|
|
99
|
+
if (dow === '1-5')
|
|
100
|
+
return t('Weekdays · {time}', { time });
|
|
101
|
+
if (dow === '*')
|
|
102
|
+
return t('Daily · {time}', { time });
|
|
103
|
+
}
|
|
104
|
+
return t('Recurring schedule');
|
|
105
|
+
}
|
|
71
106
|
/** The public booking pages, one card each on the Booker tab. */
|
|
72
107
|
const BOOKINGS = [
|
|
73
108
|
{
|
|
74
|
-
title: phrase('Quick
|
|
109
|
+
title: phrase('Quick sync'),
|
|
75
110
|
duration: phrase('15m'),
|
|
76
111
|
slug: '15min',
|
|
77
112
|
description: phrase('Fast 15-minute alignment or triage call on Hanzo Meet.'),
|
|
78
113
|
},
|
|
79
114
|
{
|
|
80
|
-
title: phrase('Technical
|
|
115
|
+
title: phrase('Technical deep dive'),
|
|
81
116
|
duration: phrase('30m'),
|
|
82
117
|
slug: '30min',
|
|
83
118
|
description: phrase('In-depth architectural review, bug diagnosis, or sprint planning.'),
|
|
84
119
|
},
|
|
85
120
|
{
|
|
86
|
-
title: phrase('AI
|
|
121
|
+
title: phrase('AI pair programming'),
|
|
87
122
|
duration: phrase('45m'),
|
|
88
123
|
slug: 'pair-ai',
|
|
89
124
|
description: phrase('Interactive coding session with Hanzo Coder assisting in the terminal.'),
|
|
90
125
|
},
|
|
91
126
|
{
|
|
92
|
-
title: phrase('Executive
|
|
127
|
+
title: phrase('Executive and strategy sync'),
|
|
93
128
|
duration: phrase('60m'),
|
|
94
129
|
slug: '60min',
|
|
95
130
|
description: phrase('Quarterly roadmap sync, partnerships, and leadership decision forum.'),
|
|
96
131
|
},
|
|
97
132
|
];
|
|
98
133
|
/** Demo titles and descriptions. A reader's own event is drawn as they wrote it. */
|
|
99
|
-
const AUTHORED = new Set(DEFAULT_EVENTS.flatMap((event) => [event.title, event.description].filter((line) => Boolean(line))));
|
|
134
|
+
const AUTHORED = new Set(DEFAULT_EVENTS.flatMap((event) => [event.title, event.description, event.devDescription].filter((line) => Boolean(line))));
|
|
100
135
|
const TYPE_LABEL = {
|
|
101
|
-
meeting: phrase('
|
|
102
|
-
bot_automation: phrase('
|
|
103
|
-
agent_query: phrase('
|
|
136
|
+
meeting: phrase('Meeting'),
|
|
137
|
+
bot_automation: phrase('Bot automation'),
|
|
138
|
+
agent_query: phrase('Agent query'),
|
|
104
139
|
};
|
|
105
140
|
/** A bot's label. Names stay as written; a role this screen authors is translated. */
|
|
106
141
|
function botLabel(name, t) {
|
|
@@ -124,7 +159,7 @@ function botLabel(name, t) {
|
|
|
124
159
|
}
|
|
125
160
|
}
|
|
126
161
|
/** design's smallest rung (`--text-floor`, 10px), below gui's `$1`; gui's font size takes a rung or a number. */
|
|
127
|
-
const FLOOR =
|
|
162
|
+
const FLOOR = 11; // minimum readable badge size (11px)
|
|
128
163
|
const MODAL = 'var(--z-modal)';
|
|
129
164
|
/** One field of the dialog: the box every input, select and textarea in it draws. */
|
|
130
165
|
const FIELD = {
|
|
@@ -132,21 +167,71 @@ const FIELD = {
|
|
|
132
167
|
py: 8,
|
|
133
168
|
bg: '$background',
|
|
134
169
|
borderWidth: 1,
|
|
135
|
-
borderColor: 'var(--border-
|
|
170
|
+
borderColor: 'var(--border-strong)',
|
|
136
171
|
rounded: 6,
|
|
137
172
|
color: '$ink',
|
|
138
173
|
fontSize: '$2',
|
|
139
174
|
};
|
|
140
175
|
/** A dialog label. */
|
|
141
176
|
const LABEL = { render: 'label', fontSize: '$1', color: '$soft', mb: 4, display: 'block' };
|
|
177
|
+
const FOCUS_RING = { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' };
|
|
178
|
+
/** Monochrome Popover selector — replaces native OS `<select>` menus inside the scheduler modal. */
|
|
179
|
+
function MonoSelect({ value, options, onChange, label, slotName, }) {
|
|
180
|
+
const [open, setOpen] = useState(false);
|
|
181
|
+
const [triggerW, setTriggerW] = useState(0);
|
|
182
|
+
const triggerRef = useRef(null);
|
|
183
|
+
const close = useCallback((restoreFocus = false) => {
|
|
184
|
+
setOpen(false);
|
|
185
|
+
if (restoreFocus)
|
|
186
|
+
queueMicrotask(() => triggerRef.current?.focus?.());
|
|
187
|
+
}, []);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
const el = triggerRef.current;
|
|
190
|
+
if (!el)
|
|
191
|
+
return;
|
|
192
|
+
const measure = () => {
|
|
193
|
+
const next = Math.round(el.getBoundingClientRect().width);
|
|
194
|
+
setTriggerW((prev) => (prev === next ? prev : next));
|
|
195
|
+
};
|
|
196
|
+
measure();
|
|
197
|
+
if (typeof ResizeObserver === 'undefined')
|
|
198
|
+
return;
|
|
199
|
+
const ro = new ResizeObserver(measure);
|
|
200
|
+
ro.observe(el);
|
|
201
|
+
return () => ro.disconnect();
|
|
202
|
+
}, [open]);
|
|
203
|
+
const selected = options.find((o) => o.value === value) ?? options[0];
|
|
204
|
+
return (_jsxs(Popover, { open: open, onOpenChange: setOpen, placement: "bottom-start", allowFlip: true, stayInFrame: true, children: [_jsx(PopoverTrigger, { asChild: true, disablePressTrigger: true, children: _jsxs(XStack, { ref: (node) => {
|
|
205
|
+
triggerRef.current = node ?? null;
|
|
206
|
+
}, render: _jsx("button", { type: "button" }), onClick: () => setOpen((prev) => !prev), "data-slot": slotName, "aria-haspopup": "listbox", "aria-expanded": open, "aria-label": label, width: "100%", minH: 38, "$max-sm": { minH: 44 }, px: 12, py: 8, bg: "$background", borderWidth: 1, borderColor: "var(--border-strong)", rounded: 6, items: "center", justify: "space-between", gap: 8, cursor: "pointer", hoverStyle: { bg: '$hover' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 1, flex: 1, minW: 0, text: "start", children: selected?.label ?? '' }), _jsx(ChevronDown, { size: 14, color: "var(--muted-foreground)", "aria-hidden": true })] }) }), _jsx(PopoverContent, { solid: true, "data-slot": `${slotName}-menu`, bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", boxShadow: "var(--shadow-floating)", rounded: "$4", p: "$1.5", width: triggerW > 0 ? triggerW : 320, maxW: "calc(100vw - 48px)", maxH: 260, overflowY: "auto", z: "var(--z-popover)", onCloseAutoFocus: (e) => {
|
|
207
|
+
e.preventDefault();
|
|
208
|
+
triggerRef.current?.focus?.();
|
|
209
|
+
}, onKeyDown: (e) => {
|
|
210
|
+
if (e.key === 'Escape') {
|
|
211
|
+
e.preventDefault?.();
|
|
212
|
+
e.stopPropagation?.();
|
|
213
|
+
close(true);
|
|
214
|
+
}
|
|
215
|
+
}, children: _jsx(YStack, { role: 'listbox', "aria-label": label, gap: 2, children: options.map((opt) => {
|
|
216
|
+
const active = opt.value === value;
|
|
217
|
+
return (_jsxs(XStack, { render: _jsx("button", { type: "button" }), role: "option", "aria-selected": active, onClick: () => {
|
|
218
|
+
onChange(opt.value);
|
|
219
|
+
close(true);
|
|
220
|
+
}, width: "100%", minH: 36, "$max-sm": { minH: 44 }, px: 10, py: 8, rounded: 8, borderWidth: 1, borderColor: active ? 'var(--border-strong)' : 'transparent', bg: active ? '$panel' : 'transparent', items: "center", justify: "space-between", gap: 8, cursor: "pointer", hoverStyle: { bg: '$hover', borderColor: 'var(--border-strong)' }, focusVisibleStyle: FOCUS_RING, children: [_jsx(Text, { fontSize: "$2", fontWeight: active ? '600' : '400', color: "$ink", numberOfLines: 1, flex: 1, minW: 0, text: "start", children: opt.label }), active ? _jsx(Check, { size: 14, color: "var(--foreground)", "aria-hidden": true }) : null] }, opt.value));
|
|
221
|
+
}) }) })] }));
|
|
222
|
+
}
|
|
142
223
|
export function CalScheduler() {
|
|
143
224
|
const { t, locale } = useI18n();
|
|
225
|
+
const [devMode] = useDevMode();
|
|
144
226
|
const [events, setEvents] = useState(() => {
|
|
145
227
|
if (typeof window !== 'undefined') {
|
|
146
228
|
try {
|
|
147
229
|
const stored = localStorage.getItem('hanzo_calendar_events_v1');
|
|
148
|
-
if (stored)
|
|
149
|
-
|
|
230
|
+
if (stored) {
|
|
231
|
+
const parsed = JSON.parse(stored);
|
|
232
|
+
if (Array.isArray(parsed))
|
|
233
|
+
return parsed;
|
|
234
|
+
}
|
|
150
235
|
}
|
|
151
236
|
catch { }
|
|
152
237
|
}
|
|
@@ -170,11 +255,32 @@ export function CalScheduler() {
|
|
|
170
255
|
}
|
|
171
256
|
catch { }
|
|
172
257
|
}, [events]);
|
|
173
|
-
|
|
258
|
+
useEffect(() => {
|
|
259
|
+
if (activeTab === 'automations' && filterType === 'meeting') {
|
|
260
|
+
setFilterType('all');
|
|
261
|
+
}
|
|
262
|
+
}, [activeTab, filterType]);
|
|
263
|
+
useEffect(() => {
|
|
264
|
+
if (!showModal)
|
|
265
|
+
return;
|
|
266
|
+
const onKeyDown = (e) => {
|
|
267
|
+
if (e.key === 'Escape') {
|
|
268
|
+
e.preventDefault();
|
|
269
|
+
setShowModal(false);
|
|
270
|
+
}
|
|
271
|
+
};
|
|
272
|
+
window.addEventListener('keydown', onKeyDown);
|
|
273
|
+
return () => window.removeEventListener('keydown', onKeyDown);
|
|
274
|
+
}, [showModal]);
|
|
275
|
+
const filteredEvents = [...events]
|
|
276
|
+
.filter((e) => {
|
|
277
|
+
if (activeTab === 'automations' && e.type === 'meeting')
|
|
278
|
+
return false;
|
|
174
279
|
if (filterType === 'all')
|
|
175
280
|
return true;
|
|
176
281
|
return e.type === filterType;
|
|
177
|
-
})
|
|
282
|
+
})
|
|
283
|
+
.sort((a, b) => `${a.date} ${a.time}`.localeCompare(`${b.date} ${b.time}`));
|
|
178
284
|
const handleCreateEvent = (e) => {
|
|
179
285
|
e.preventDefault();
|
|
180
286
|
if (!newEvent.title.trim())
|
|
@@ -205,33 +311,93 @@ export function CalScheduler() {
|
|
|
205
311
|
description: '',
|
|
206
312
|
});
|
|
207
313
|
};
|
|
314
|
+
const deletedRef = useRef(new Map());
|
|
208
315
|
const handleDeleteEvent = (id) => {
|
|
316
|
+
const target = events.find((e) => e.id === id);
|
|
317
|
+
if (!target)
|
|
318
|
+
return;
|
|
319
|
+
const snapshot = { ...target };
|
|
320
|
+
deletedRef.current.set(snapshot.id, snapshot);
|
|
209
321
|
setEvents((prev) => prev.filter((e) => e.id !== id));
|
|
322
|
+
const label = AUTHORED.has(snapshot.title) ? t(snapshot.title) : snapshot.title;
|
|
323
|
+
toast(t('Removed “{title}”', { title: label }), {
|
|
324
|
+
id: `hanzo:cal-delete:${snapshot.id}`,
|
|
325
|
+
duration: 5000,
|
|
326
|
+
action: {
|
|
327
|
+
label: t('Undo'),
|
|
328
|
+
onClick: () => {
|
|
329
|
+
const restored = deletedRef.current.get(snapshot.id) ?? snapshot;
|
|
330
|
+
deletedRef.current.delete(snapshot.id);
|
|
331
|
+
setEvents((prev) => (prev.some((e) => e.id === restored.id) ? prev : [...prev, restored]));
|
|
332
|
+
},
|
|
333
|
+
},
|
|
334
|
+
onAutoClose: () => {
|
|
335
|
+
deletedRef.current.delete(snapshot.id);
|
|
336
|
+
},
|
|
337
|
+
onDismiss: () => {
|
|
338
|
+
deletedRef.current.delete(snapshot.id);
|
|
339
|
+
},
|
|
340
|
+
});
|
|
210
341
|
};
|
|
211
|
-
return (_jsxs(YStack, { width: "100%", height: "100%", bg: "$background", overflowX: "
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
{ id: '
|
|
215
|
-
|
|
342
|
+
return (_jsxs(YStack, { width: "100%", height: "100%", bg: "$background", overflowX: "hidden", overflowY: "auto", children: [_jsxs(XStack, { minH: 56, px: 24, py: 10, gap: 10, flexWrap: "wrap", bg: "$panel", borderBottomWidth: 1, borderBottomColor: "$borderColor", items: "center", justify: "space-between", "$max-sm": { px: 16 }, children: [_jsxs(XStack, { items: "center", gap: 12, shrink: 1, minW: 0, children: [_jsx(XStack, { width: 32, height: 32, rounded: 8, bg: "$raised", items: "center", justify: "center", shrink: 0, children: _jsx(CalendarIcon, { size: 18, color: "var(--foreground)" }) }), _jsxs(YStack, { shrink: 1, minW: 0, children: [_jsxs(XStack, { items: "center", gap: 8, flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$4", fontWeight: "700", color: "$ink", children: t('Calendar & scheduler') }), _jsx(Text, { fontSize: FLOOR, fontWeight: "600", bg: "$hover", color: "$soft", borderWidth: 1, borderColor: "$borderColor", px: 6, py: 1, rounded: 4, children: "cal.hanzo.ai" })] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: devMode
|
|
343
|
+
? t('Unified scheduler across meetings, bot routines, automated crons, and query triggers')
|
|
344
|
+
: t('Unified schedule for meetings, bot routines, and recurring tasks') })] })] }), _jsxs(XStack, { items: "center", gap: 10, shrink: 1, minW: 0, flexWrap: "wrap", children: [_jsx(XStack, { items: "center", gap: 2, bg: "$hover", rounded: 8, p: 2, borderWidth: 1, borderColor: "var(--border-strong)", shrink: 1, minW: 0, flexWrap: "wrap", children: [
|
|
345
|
+
{ id: 'scheduler', label: t('Master schedule') },
|
|
346
|
+
{ id: 'automations', label: devMode ? t('Bot crons') : t('Bot routines') },
|
|
347
|
+
{ id: 'booker', label: t('Public booking') },
|
|
348
|
+
].map((tab) => (_jsx(Button, { size: "sm", variant: activeTab === tab.id ? 'primary' : 'ghost', ...(activeTab === tab.id ? null : { color: '$soft' }), "aria-pressed": activeTab === tab.id, onClick: () => setActiveTab(tab.id), children: tab.label }, tab.id))) }), _jsxs(Button, { variant: "primary", size: "sm", onClick: () => setShowModal(true), children: [_jsx(Plus, { size: 14 }), t('Schedule event')] })] })] }), activeTab === 'booker' ? (_jsxs(YStack, { flex: 1, p: 28, "$max-sm": { p: 16 }, overflowY: "auto", overflowX: "hidden", gap: 20, children: [_jsxs(YStack, { gap: 4, children: [_jsx(Text, { fontSize: "$7", fontWeight: "800", color: "$ink", children: t('Public booking pages') }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('Shareable links powered by {link}. Allows teammates, clients, and agents to book dedicated time slots.', {
|
|
216
349
|
link: (_jsx(Text, { render: _jsx("a", { href: "https://cal.hanzo.ai", target: "_blank", rel: "noopener noreferrer" }), color: "$ink", textDecorationLine: "none", children: "cal.hanzo.ai" })),
|
|
217
|
-
}) })] }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(
|
|
218
|
-
navigator.clipboard
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
{ id: '
|
|
224
|
-
|
|
350
|
+
}) })] }), _jsx(View, { display: "grid", gridTemplateColumns: "repeat(auto-fill, minmax(min(280px, 100%), 1fr))", gap: 16, children: BOOKINGS.map((card) => (_jsxs(YStack, { bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: 10, p: 18, gap: 12, minW: 0, children: [_jsxs(XStack, { items: "center", justify: "space-between", gap: 8, children: [_jsx(Text, { fontSize: "$4", fontWeight: "700", color: "$ink", flex: 1, minW: 0, children: t(card.title) }), _jsx(Text, { fontSize: "$1", fontWeight: "600", bg: "$hover", px: 8, py: 2, rounded: 4, color: "$soft", shrink: 0, children: t(card.duration) })] }), _jsx(Text, { fontSize: "$2", color: "$soft", lineHeight: "$2", children: t(card.description) }), _jsxs(Text, { px: 10, py: 8, bg: "$sunken", rounded: 6, fontSize: "$1", fontFamily: "$mono", color: "$soft", numberOfLines: 1, children: ["https://cal.hanzo.ai/alex/", card.slug] }), _jsxs(XStack, { gap: 8, mt: 4, children: [_jsx(Button, { size: "sm", flex: 1, "$max-sm": { minH: 44 }, onClick: () => {
|
|
351
|
+
void navigator.clipboard
|
|
352
|
+
.writeText(`https://cal.hanzo.ai/alex/${card.slug}`)
|
|
353
|
+
.then(() => toast.success(t('Link copied')))
|
|
354
|
+
.catch(() => toast.error(t('Could not copy link.')));
|
|
355
|
+
}, children: t('Copy link') }), _jsx(Button, { asChild: true, variant: "primary", size: "sm", children: _jsxs("a", { href: `https://cal.hanzo.ai/alex/${card.slug}`, target: "_blank", rel: "noopener noreferrer", children: [t('Open'), _jsx(ExternalLink, { size: 12 })] }) })] })] }, card.slug))) })] })) : (_jsxs(YStack, { flex: 1, minH: 0, overflow: "hidden", children: [_jsxs(XStack, { px: 24, py: 12, "$max-sm": { px: 16 }, bg: "$panel", borderBottomWidth: 1, borderBottomColor: "$borderColor", items: "center", justify: "space-between", flexWrap: "wrap", gap: 8, children: [_jsxs(XStack, { items: "center", gap: 6, shrink: 1, minW: 0, flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$soft", children: t('Filter:') }), [
|
|
356
|
+
{ id: 'all', label: t('All items') },
|
|
357
|
+
{ id: 'meeting', label: t('Meetings'), icon: Video },
|
|
358
|
+
{ id: 'bot_automation', label: t('Bot routines'), icon: Bot },
|
|
359
|
+
{ id: 'agent_query', label: t('Agent queries'), icon: Zap },
|
|
360
|
+
].filter((f) => !(activeTab === 'automations' && f.id === 'meeting')).map((f) => (_jsxs(Button, { size: "sm", variant: filterType === f.id ? 'secondary' : 'ghost', color: filterType === f.id ? '$ink' : '$soft', "aria-pressed": filterType === f.id, onClick: () => setFilterType(f.id), children: ['icon' in f ? _jsx(f.icon, { size: 13, "aria-hidden": true }) : null, f.label] }, f.id)))] }), _jsx(Text, { fontSize: "$1", color: "$faint", children: t('Showing {count} scheduled items', {
|
|
225
361
|
count: filteredEvents.length.toLocaleString(locale),
|
|
226
|
-
}) })] }), _jsx(YStack, { flex: 1, overflowY: "auto", px: 24, py: 20, gap: 10, children: filteredEvents.
|
|
362
|
+
}) })] }), _jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", px: 24, py: 20, "$max-sm": { px: 16, py: 16 }, gap: 10, children: filteredEvents.length === 0 ? (_jsxs(YStack, { items: "center", justify: "center", gap: 10, px: 20, py: 48, children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", text: "center", children: filterType !== 'all' ? t('No matching schedule items') : t('Nothing scheduled yet') }), _jsx(Text, { fontSize: "$2", color: "$soft", text: "center", maxW: 360, children: filterType !== 'all'
|
|
363
|
+
? t('Try switching or clearing the active filter to view all scheduled items.')
|
|
364
|
+
: t('Add a meeting, bot routine, or agent query to get started.') }), filterType !== 'all' ? (_jsx(Button, { size: "sm", variant: "outline", focusVisibleStyle: FOCUS_RING, "$max-sm": { minH: 44 }, onClick: () => setFilterType('all'), children: t('Clear filter') })) : (_jsx(Button, { size: "sm", variant: "primary", focusVisibleStyle: FOCUS_RING, "$max-sm": { minH: 44 }, onClick: () => setShowModal(true), children: t('Schedule') }))] })) : filteredEvents.map((evt) => {
|
|
227
365
|
const isMeeting = evt.type === 'meeting';
|
|
228
366
|
const isAutomation = evt.type === 'bot_automation';
|
|
229
|
-
|
|
367
|
+
const rawDescription = devMode
|
|
368
|
+
? (evt.devDescription ?? evt.description)
|
|
369
|
+
: evt.description === LEGACY_PORT_DESCRIPTION
|
|
370
|
+
? PLAIN_SYNC_DESCRIPTION
|
|
371
|
+
: evt.description;
|
|
372
|
+
return (_jsxs(XStack, { bg: "$panel", borderWidth: 1, borderColor: "$borderColor", rounded: 10, px: 20, py: 16, items: "center", justify: "space-between", flexWrap: "wrap", gap: 16, minW: 0, "$max-md": {
|
|
373
|
+
flexDirection: 'column',
|
|
374
|
+
items: 'stretch',
|
|
375
|
+
px: 16,
|
|
376
|
+
py: 14,
|
|
377
|
+
gap: 12,
|
|
378
|
+
}, children: [_jsxs(XStack, { items: "center", gap: 12, minW: 170, shrink: 0, "$max-md": { minW: 0, width: '100%' }, children: [_jsx(XStack, { width: 40, height: 40, rounded: 8, bg: "$raised", items: "center", justify: "center", shrink: 0, children: isMeeting ? _jsx(Video, { size: 20, color: "var(--foreground)" }) : isAutomation ? _jsx(Bot, { size: 20, color: "var(--foreground)" }) : _jsx(Zap, { size: 20, color: "var(--foreground)" }) }), _jsxs(YStack, { shrink: 1, minW: 0, children: [_jsx(Text, { fontSize: "$3", fontWeight: "700", color: "$ink", fontFamily: "$mono", children: evt.time }), _jsx(Text, { fontSize: "$1", color: "$faint", children: t('{date} · {duration}', { date: evt.date, duration: t(evt.duration) }) })] })] }), _jsxs(YStack, { flex: 1, minW: 0, $md: { minW: 240 }, gap: 4, children: [_jsxs(XStack, { items: "center", gap: 8, flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$3", fontWeight: "600", color: "$ink", shrink: 1, minW: 0, children: AUTHORED.has(evt.title) ? t(evt.title) : evt.title }), _jsx(Text, { fontSize: "$1", fontWeight: "500", bg: "$hover", color: "$soft", borderWidth: 1, borderColor: "$borderColor", px: 8, py: 1, rounded: 4, shrink: 0, children: t(TYPE_LABEL[evt.type]) })] }), rawDescription ? (_jsx(Text, { display: "block", fontSize: "$2", color: "$soft", children: AUTHORED.has(rawDescription) ? t(rawDescription) : rawDescription })) : null, _jsxs(XStack, { items: "center", gap: 10, flexWrap: "wrap", pt: 2, children: [evt.botName ? (_jsx(Text, { fontSize: "$1", color: "$faint", children: t('Bot: {name}', {
|
|
230
379
|
name: (_jsx(Text, { render: "strong", fontSize: "$1", color: "$quiet", children: botLabel(evt.botName, t) })),
|
|
231
|
-
}) })) : null, evt.cronPattern ? (_jsx(Text, { fontSize: "$1", color: "$faint", children: t('Cron: {pattern}', {
|
|
232
|
-
pattern: (_jsx(Text, { render: "code", color: "$ink", children: evt.cronPattern })),
|
|
233
|
-
}) })) :
|
|
234
|
-
|
|
235
|
-
}) })) : null
|
|
236
|
-
|
|
380
|
+
}) })) : null, evt.cronPattern ? (devMode ? (_jsx(Text, { fontSize: "$1", color: "$faint", children: t('Cron: {pattern}', {
|
|
381
|
+
pattern: (_jsx(Text, { render: "code", fontFamily: "$mono", color: "$ink", children: evt.cronPattern })),
|
|
382
|
+
}) })) : (_jsx(Text, { fontSize: "$1", color: "$faint", children: t('Schedule: {label}', {
|
|
383
|
+
label: (_jsx(Text, { fontSize: "$1", color: "$quiet", children: humanizeCron(evt.cronPattern, t) })),
|
|
384
|
+
}) }))) : null, evt.meetUrl && devMode ? (_jsx(Text, { fontSize: "$1", color: "$faint", numberOfLines: 1, children: t('Link: {url}', {
|
|
385
|
+
url: (_jsx(Text, { render: "code", fontFamily: "$mono", color: "$ink", children: evt.meetUrl })),
|
|
386
|
+
}) })) : null] })] }), _jsxs(XStack, { items: "center", gap: 8, shrink: 0, "$max-md": { width: '100%', justify: 'space-between', pt: 4, borderTopWidth: 1, borderTopColor: '$borderColor' }, children: [isMeeting ? (_jsx(Button, { asChild: true, variant: "primary", size: "sm", children: _jsxs("a", { href: "/meet", children: [_jsx(Video, { size: 13 }), t('Join meeting')] }) })) : (_jsx(Button, { asChild: true, variant: "primary", size: "sm", children: _jsxs("a", { href: "/bots", children: [_jsx(Bot, { size: 13 }), t('View bots')] }) })), _jsx(Button, { variant: "ghost", size: "icon-sm", color: "$soft", "$max-sm": { minW: 44, minH: 44 }, focusVisibleStyle: { outlineWidth: 2, outlineStyle: 'solid', outlineColor: '$outlineColor' }, onClick: () => handleDeleteEvent(evt.id), "aria-label": t('Remove schedule'), title: t('Remove schedule'), children: _jsx(Trash2, { size: 14 }) })] })] }, evt.id));
|
|
387
|
+
}) })] })), showModal ? (_jsx(XStack, { position: "fixed", inset: 0, bg: "var(--surface-scrim)", backdropFilter: "blur(8px)", items: "center", justify: "center", p: 16, z: MODAL, onClick: (e) => {
|
|
388
|
+
if (e.target === e.currentTarget)
|
|
389
|
+
setShowModal(false);
|
|
390
|
+
}, children: _jsxs(YStack, { role: "dialog", "aria-modal": true, "aria-label": t('Schedule event or routine'), width: "100%", maxW: 460, maxH: "90dvh", overflowY: "auto", bg: "var(--popover)", borderWidth: 1, borderColor: "var(--border-strong)", rounded: 12, p: 24, "$max-sm": { p: 16 }, gap: 16, boxShadow: "var(--shadow-floating)", onClick: (e) => e.stopPropagation?.(), children: [_jsxs(XStack, { items: "center", justify: "space-between", children: [_jsx(Text, { fontSize: "$4", fontWeight: "700", color: "$ink", children: t('Schedule event or routine') }), _jsx(Button, { type: "button", variant: "ghost", size: "icon-sm", mr: -8, onClick: () => setShowModal(false), "aria-label": t('Close'), children: _jsx(X, { size: 16, "aria-hidden": true }) })] }), _jsxs(YStack, { render: "form", onSubmit: handleCreateEvent, gap: 12, children: [_jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Title') }), _jsx(Text, { render: _jsx("input", { type: "text", value: newEvent.title, onChange: (e) => setNewEvent({ ...newEvent, title: e.target.value }), placeholder: t('e.g. Daily security audit or team sync'), required: true }), ...FIELD, px: 12 })] }), _jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Schedule type') }), _jsx(MonoSelect, { slotName: "cal-schedule-type-select", label: t('Schedule type'), value: newEvent.type, onChange: (next) => setNewEvent({ ...newEvent, type: next }), options: [
|
|
391
|
+
{ value: 'bot_automation', label: t('Automated bot routine') },
|
|
392
|
+
{ value: 'meeting', label: t('Video meeting') },
|
|
393
|
+
{ value: 'agent_query', label: t('Recurring agent query') },
|
|
394
|
+
] })] }), _jsxs(View, { display: "grid", gridTemplateColumns: "1fr 1fr", gap: 10, children: [_jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Date') }), _jsx(Text, { render: _jsx("input", { type: "date", value: newEvent.date, onChange: (e) => setNewEvent({ ...newEvent, date: e.target.value }) }), ...FIELD, px: 8 })] }), _jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Time') }), _jsx(Text, { render: _jsx("input", { type: "time", value: newEvent.time, onChange: (e) => setNewEvent({ ...newEvent, time: e.target.value }) }), ...FIELD, px: 8 })] })] }), _jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Assigned bot') }), _jsx(MonoSelect, { slotName: "cal-assigned-bot-select", label: t('Assigned bot'), value: newEvent.botName, onChange: (next) => setNewEvent({ ...newEvent, botName: next }), options: [
|
|
395
|
+
{ value: 'Chief', label: 'Chief' },
|
|
396
|
+
{ value: 'Sales Outbound', label: t('Sales Outbound') },
|
|
397
|
+
{ value: 'Inbox Manager', label: t('Inbox Manager') },
|
|
398
|
+
{ value: 'Account Manager', label: t('Account Manager') },
|
|
399
|
+
{ value: 'Talent Scout', label: t('Talent Scout') },
|
|
400
|
+
{ value: 'Expense Manager', label: t('Expense Manager') },
|
|
401
|
+
{ value: 'Offsite crew', label: t('Offsite crew') },
|
|
402
|
+
] })] }), _jsxs(View, { display: "block", children: [_jsx(Text, { ...LABEL, children: t('Description') }), _jsx(Text, { render: _jsx("textarea", { value: newEvent.description, onChange: (e) => setNewEvent({ ...newEvent, description: e.target.value }), placeholder: t('Details or instructions…'), rows: 3 }), ...FIELD, px: 12, "$platform-web": { resize: 'none' } })] }), _jsxs(XStack, { justify: "flex-end", gap: 8, mt: 8, children: [_jsx(Button, { type: "button", onClick: () => setShowModal(false), children: t('Cancel') }), _jsx(Button, { type: "submit", variant: "primary", children: t('Save schedule') })] })] })] }) })) : null] }));
|
|
237
403
|
}
|