@hanzo/app 0.2.58 → 0.2.60
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/App.js +1 -4
- package/dist/Board.js +37 -121
- package/dist/Boxes.js +12 -16
- package/dist/CalScheduler.js +40 -81
- package/dist/Chat.js +87 -78
- package/dist/Chrome.d.ts +2 -14
- package/dist/Chrome.js +7 -44
- package/dist/Column.js +6 -2
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +2 -1
- package/dist/Drive.js +100 -121
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +10 -15
- package/dist/Meet.js +48 -78
- package/dist/Orgs.js +10 -9
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +2 -1
- package/dist/Rail.d.ts +1 -1
- package/dist/Rail.js +4 -4
- package/dist/Schedule.js +11 -15
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +11 -16
- package/dist/Shell.js +1 -1
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +1 -3
- package/dist/Top.js +1 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +3 -5
- package/dist/Work.js +28 -51
- package/dist/bots/Bots.js +73 -129
- package/dist/bots/runtime.js +41 -103
- package/dist/cast.d.ts +1 -1
- package/dist/cast.js +1 -1
- package/dist/failure.d.ts +1 -1
- package/dist/failure.js +1 -1
- package/dist/ground.d.ts +21 -0
- package/dist/ground.js +21 -0
- package/dist/lib/limits.d.ts +1 -1
- package/dist/lib/limits.js +1 -1
- package/dist/lib/org.d.ts +3 -3
- package/dist/lib/org.js +5 -4
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +2 -6
- package/dist/lib/pay.js +2 -15
- package/dist/lib/plans.d.ts +1 -1
- package/dist/lib/plans.js +1 -1
- package/dist/lib/tier.d.ts +2 -2
- package/dist/lib/tier.js +6 -6
- package/dist/look.js +8 -10
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +2 -1
- package/dist/say.d.ts +4 -0
- package/dist/say.js +7 -0
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/assets/memoji/art.svg +0 -22
- package/assets/memoji/cyber.svg +0 -22
- package/assets/memoji/data.svg +0 -22
- package/assets/memoji/des.svg +0 -22
- package/assets/memoji/dev.svg +0 -22
- package/assets/memoji/doc.svg +0 -22
- package/assets/memoji/edu.svg +0 -22
- package/assets/memoji/fin.svg +0 -22
- package/assets/memoji/gov.svg +0 -22
- package/assets/memoji/huma.svg +0 -22
- package/assets/memoji/lang.svg +0 -22
- package/assets/memoji/law.svg +0 -22
- package/assets/memoji/mana.svg +0 -22
- package/assets/memoji/mark.svg +0 -22
- package/assets/memoji/mu.svg +0 -22
- package/assets/memoji/opera.svg +0 -22
- package/assets/memoji/rev.svg +0 -22
- package/assets/memoji/sal.svg +0 -22
- package/assets/memoji/sci.svg +0 -22
- package/assets/memoji/su.svg +0 -22
- package/assets/memoji/vi.svg +0 -22
- package/dist/TeamPreview.d.ts +0 -9
- package/dist/TeamPreview.js +0 -305
- package/dist/TeamStory.d.ts +0 -49
- package/dist/TeamStory.js +0 -67
- package/dist/preview.d.ts +0 -84
- package/dist/preview.js +0 -120
- package/dist/workday.d.ts +0 -247
- package/dist/workday.js +0 -642
package/dist/App.js
CHANGED
|
@@ -275,8 +275,5 @@ function Window({ bar, betas }) {
|
|
|
275
275
|
// inline-style: the slide, a transform with no logical form whose sign and distance the drawer writes on the element itself, a drag every frame (Drawer.tsx).
|
|
276
276
|
style: drawer.slide ?? undefined, flex: 1, minW: 0, minH: 0, paddingInlineEnd: "var(--pane-gap)", pb: "var(--pane-gap)",
|
|
277
277
|
// The gap above the pane is the gap at its end and foot; a window's own bar above it is that gap.
|
|
278
|
-
pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsx(YStack, { height: "100%", "$max-md": { display: 'none' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage",
|
|
279
|
-
// The rest of the row beside the rail and the sidebar. At width 100% it was the whole row
|
|
280
|
-
// again, and a View does not shrink, so the pane stood past the window's edge.
|
|
281
|
-
flex: 1, height: "100%", minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Top, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", display: "grid", gridTemplateColumns: "1fr", width: "100%", height: "100%", minW: 0, minH: 0, children: mode === 'chat' ? (_jsx(Paned, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : at.mode === 'hosted' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsx(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), flex: 1, minW: 0, minH: 0, children: plans ? null : _jsx(Builder, { host: host, rail: false }) })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "$2", children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar }) })] }) })), finding ? _jsx(Palette, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null] }) }) }) }) }));
|
|
278
|
+
pt: bar ? 0 : 'var(--pane-gap)', "$max-md": { p: 0 }, children: [drawer.slide ? _jsx(Lift, {}) : null, _jsx(YStack, { height: "100%", "$max-md": { display: 'none' }, children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: !closed, toggle: bar ? undefined : flip, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), closed || alone ? null : (_jsx(YStack, { "$max-md": { display: 'none' }, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: () => setClosed(true), onSeek: seek, onBack: back, places: sidebar }) })), _jsxs(YStack, { "data-slot": "stage", flex: 1, minW: 0, minH: 0, marginInlineStart: closed || alone ? 0 : 'var(--pane-gap)', "$max-md": { marginInlineStart: 0, pb: `max(var(--pane-gap), ${FOOT})` }, children: [bar ? null : _jsx(Top, { host: host, mode: mode, places: sidebar, open: drawer.state !== 'shut', go: move, onMenu: drawer.open, onChat: toChat, onDev: toDev }), _jsx(XStack, { "data-slot": "panes", flex: 1, minW: 0, minH: 0, children: mode === 'chat' ? (_jsx(Paned, { framed: true, children: _jsx(Chat, {}) })) : mode === 'tabs' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Terminals, {}) }) })) : mode === 'studio' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(YStack, { flex: 1, minH: 0, height: "100%", children: _jsx(Suspense, { fallback: null, children: _jsx(Studio, { host: maker, rail: false }) }) }) })) : at.mode === 'hosted' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflow: "hidden", flex: 1, minW: 0, minH: 0, children: _jsx(Suspense, { fallback: null, children: _jsx(Hosted, { id: at.id, go: move }) }) })) : mode === 'beta' ? (_jsx(YStack, { render: "main", "data-slot": "pane", ...pane(), overflowY: "auto", overflowX: "hidden", flex: 1, minW: 0, minH: 0, p: "$4", $md: { p: '$6' }, children: betas ?? (_jsx(Suspense, { fallback: null, children: _jsx(Betas, { go: move }) })) })) : (_jsx(YStack, { render: "main", "data-slot": "pane", ...(run ? null : { ...pane(), overflow: 'hidden' }), flex: 1, minW: 0, minH: 0, children: plans ? null : _jsx(Builder, { host: host, rail: false }) })) })] })] }), drawer.state === 'shut' ? null : (_jsx(Layer, { drawer: drawer, top: bar ? BAR : 0, children: _jsxs(XStack, { flex: 1, minH: 0, children: [_jsx(YStack, { "data-slot": "drawer-rail", shrink: 0, pt: "$2", children: _jsx(Rail, { host: host, mode: mode, at: where, inside: inside, open: true, onChat: toChat, onDev: toDev, onStudio: toStudio, onTabs: toTabs, go: move, onOrg: org }) }), _jsx(YStack, { flex: 1, minW: 0, children: _jsx(Column, { host: host, mode: mode, thread: thread, go: move, onShut: shut, onSeek: seek, onBack: back, drawer: true, places: sidebar }) })] }) })), finding ? _jsx(Palette, { go: move, onClose: found, mode: mode, host: host }) : null, learning ? _jsx(Learning, { open: true, onClose: () => setLearning(false) }) : null] }) }) }) }) }));
|
|
282
279
|
}
|
package/dist/Board.js
CHANGED
|
@@ -27,14 +27,12 @@ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-run
|
|
|
27
27
|
// in the forge and a step written there arrives here. Covers and file
|
|
28
28
|
// attachments have nowhere to live yet, so they are not drawn.
|
|
29
29
|
import { useCallback, useEffect, useMemo, useState } from 'react';
|
|
30
|
-
import { phrase } from '@hanzo/i18n';
|
|
31
30
|
import { useAgents, usePeople } from '@hanzo/ai/react';
|
|
32
31
|
import { Box, Text, View, XStack, YStack } from '@hanzo/ui';
|
|
33
32
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@hanzo/ui';
|
|
34
33
|
import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
35
34
|
import { Calendar, CalendarClock, Check, ChevronLeft, ChevronRight, Columns3, ListChecks, ListFilter, SquareTerminal, Plus, Tag, UserPlus, X, } from 'lucide-react';
|
|
36
35
|
import { useOpen } from './open.js';
|
|
37
|
-
import { useI18n } from '@hanzo/i18n/react';
|
|
38
36
|
import { useAi } from './lib/ai.js';
|
|
39
37
|
import { Face } from './cast.js';
|
|
40
38
|
import { say } from './failure.js';
|
|
@@ -42,73 +40,9 @@ import { AGENT_QUEUE, AGENT_WORKFLOW, reads, runOf, start as startRun, } from '.
|
|
|
42
40
|
import { COLUMNS, PRIORITIES, addStep, board as readBoard, claim, edit, open as openCard, projects as readProjects, sift, steps, tick, } from './lib/todo.js';
|
|
43
41
|
import { BAD } from './lib/mix.js';
|
|
44
42
|
const DAY = 86400;
|
|
45
|
-
/** Said when a write has no board to write to. It is the same event whichever
|
|
46
|
-
* write asked, so it is one sentence rather than two wordings of one. */
|
|
47
|
-
const NOWHERE = phrase('No project answered, so there is nowhere to file this card.');
|
|
48
|
-
/** A column's name, as the board says it. The id is the forge's; the words match `COLUMNS`. */
|
|
49
|
-
function columnName(id, t) {
|
|
50
|
-
switch (id) {
|
|
51
|
-
case 'backlog':
|
|
52
|
-
return t('Backlog');
|
|
53
|
-
case 'todo':
|
|
54
|
-
return t('To do');
|
|
55
|
-
case 'in_progress':
|
|
56
|
-
return t('Doing');
|
|
57
|
-
case 'done':
|
|
58
|
-
return t('Done');
|
|
59
|
-
case 'canceled':
|
|
60
|
-
return t('Canceled');
|
|
61
|
-
default:
|
|
62
|
-
return null;
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
/** A priority as a person reads it. The value sent to the store stays the id. */
|
|
66
|
-
function priorityName(p, t) {
|
|
67
|
-
switch (p) {
|
|
68
|
-
case 'urgent':
|
|
69
|
-
return t('urgent');
|
|
70
|
-
case 'high':
|
|
71
|
-
return t('high');
|
|
72
|
-
case 'medium':
|
|
73
|
-
return t('medium');
|
|
74
|
-
case 'low':
|
|
75
|
-
return t('low');
|
|
76
|
-
case 'none':
|
|
77
|
-
return t('none');
|
|
78
|
-
default:
|
|
79
|
-
return p;
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
/** What `reads` says a durable run is doing, in the reader's words. An unrecognized status stays a token. */
|
|
83
|
-
function runStatus(status, t) {
|
|
84
|
-
switch (reads(status)) {
|
|
85
|
-
case 'unknown':
|
|
86
|
-
return t('unknown');
|
|
87
|
-
case 'running':
|
|
88
|
-
return t('running');
|
|
89
|
-
case 'done':
|
|
90
|
-
return t('done');
|
|
91
|
-
case 'failed':
|
|
92
|
-
return t('failed');
|
|
93
|
-
case 'canceled':
|
|
94
|
-
return t('canceled');
|
|
95
|
-
case 'stopped':
|
|
96
|
-
return t('stopped');
|
|
97
|
-
case 'timed out':
|
|
98
|
-
return t('timed out');
|
|
99
|
-
default:
|
|
100
|
-
return reads(status);
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
/** An hour on the planner, `8 am`, in the reader's language. */
|
|
104
|
-
function hourLabel(hour, t, locale) {
|
|
105
|
-
const h = (hour % 12 === 0 ? 12 : hour % 12).toLocaleString(locale);
|
|
106
|
-
return hour < 12 ? t('{hour} am', { hour: h }) : t('{hour} pm', { hour: h });
|
|
107
|
-
}
|
|
108
43
|
/** A pane with nothing in it yet, centred, saying which nothing it is. */
|
|
109
44
|
function Empty({ children }) {
|
|
110
|
-
|
|
111
|
-
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "var(--foreground)", children: t('Board') }), _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: children })] }));
|
|
45
|
+
return (_jsxs(YStack, { flex: 1, items: "center", justify: "center", p: "$6", gap: "$2", children: [_jsx(Text, { render: "h1", fontSize: "$6", fontWeight: "600", color: "var(--foreground)", children: "Board" }), _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: children })] }));
|
|
112
46
|
}
|
|
113
47
|
/** A quiet control that says its verb. */
|
|
114
48
|
function Act({ icon: Icon, label, on, onPress, }) {
|
|
@@ -118,14 +52,14 @@ function Act({ icon: Icon, label, on, onPress, }) {
|
|
|
118
52
|
function Label({ name }) {
|
|
119
53
|
return (_jsx(XStack, { px: "$2", py: "$0.5", rounded: "$2", bg: "$hover", borderWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: name }) }));
|
|
120
54
|
}
|
|
121
|
-
/** A date, as a person says it
|
|
122
|
-
function when(unix
|
|
55
|
+
/** A date, as a person says it. */
|
|
56
|
+
function when(unix) {
|
|
123
57
|
if (!unix)
|
|
124
58
|
return '';
|
|
125
59
|
const at = new Date(unix * 1000);
|
|
126
60
|
const now = new Date();
|
|
127
61
|
const same = at.getFullYear() === now.getFullYear();
|
|
128
|
-
return at.toLocaleDateString(
|
|
62
|
+
return at.toLocaleDateString(undefined, {
|
|
129
63
|
month: 'short',
|
|
130
64
|
day: 'numeric',
|
|
131
65
|
...(same ? {} : { year: 'numeric' }),
|
|
@@ -141,22 +75,19 @@ function when(unix, locale) {
|
|
|
141
75
|
* weekday, and one outside this week gets its date too, because "Tuesday" stops
|
|
142
76
|
* being an answer once there is more than one of them in view.
|
|
143
77
|
*/
|
|
144
|
-
function dayName(day,
|
|
78
|
+
function dayName(day, now = new Date()) {
|
|
145
79
|
const at = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
146
80
|
const days = Math.round((at(day) - at(now)) / 86400000);
|
|
147
81
|
if (days === 0)
|
|
148
|
-
return
|
|
82
|
+
return 'Today';
|
|
149
83
|
if (days === 1)
|
|
150
|
-
return
|
|
84
|
+
return 'Tomorrow';
|
|
151
85
|
if (days === -1)
|
|
152
|
-
return
|
|
153
|
-
const weekday = day.toLocaleDateString(
|
|
86
|
+
return 'Yesterday';
|
|
87
|
+
const weekday = day.toLocaleDateString(undefined, { weekday: 'long' });
|
|
154
88
|
if (days > 1 && days < 7)
|
|
155
89
|
return weekday;
|
|
156
|
-
return
|
|
157
|
-
weekday,
|
|
158
|
-
date: day.toLocaleDateString(locale, { month: 'short', day: 'numeric' }),
|
|
159
|
-
});
|
|
90
|
+
return `${weekday} ${day.toLocaleDateString(undefined, { month: 'short', day: 'numeric' })}`;
|
|
160
91
|
}
|
|
161
92
|
/** The value a date input wants, from unix seconds. */
|
|
162
93
|
const asInput = (unix) => unix ? new Date(unix * 1000).toISOString().slice(0, 10) : '';
|
|
@@ -169,11 +100,10 @@ const asInput = (unix) => unix ? new Date(unix * 1000).toISOString().slice(0, 10
|
|
|
169
100
|
* task items — the same ones the forge renders.
|
|
170
101
|
*/
|
|
171
102
|
function Tile({ card, who, onOpen, }) {
|
|
172
|
-
const { t, locale } = useI18n();
|
|
173
103
|
const list = steps(card.description);
|
|
174
104
|
const done = list.filter((s) => s.done).length;
|
|
175
105
|
const late = card.dueAt ? card.dueAt * 1000 < Date.now() : false;
|
|
176
|
-
return (_jsx(View, { render: _jsx("div", { draggable: true }), onDragStart: (e) => e.dataTransfer.setData('text/plain', `${card.projectKey}#${card.number}`), display: "block", cursor: "grab", children: _jsx(Box, { render: "button", onClick: onOpen, width: "100%", p: "$3", gap: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", hoverStyle: { borderColor: '$ink' }, children: _jsxs(YStack, { gap: "$2", width: "100%", children: [card.labels.length > 0 ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", children: card.labels.slice(0, 4).map((l) => (_jsx(Label, { name: l }, l))) })) : null, _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 3, text: "left", children: card.title }), _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [card.dueAt ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(CalendarClock, { size: 12, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: late ? BAD : '$soft', children: when(card.dueAt
|
|
106
|
+
return (_jsx(View, { render: _jsx("div", { draggable: true }), onDragStart: (e) => e.dataTransfer.setData('text/plain', `${card.projectKey}#${card.number}`), display: "block", cursor: "grab", children: _jsx(Box, { render: "button", onClick: onOpen, width: "100%", p: "$3", gap: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", hoverStyle: { borderColor: '$ink' }, children: _jsxs(YStack, { gap: "$2", width: "100%", children: [card.labels.length > 0 ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", children: card.labels.slice(0, 4).map((l) => (_jsx(Label, { name: l }, l))) })) : null, _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 3, text: "left", children: card.title }), _jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [card.dueAt ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(CalendarClock, { size: 12, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: late ? BAD : '$soft', children: when(card.dueAt) })] })) : null, list.length > 0 ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(ListChecks, { size: 12, "aria-hidden": true }), _jsxs(Text, { fontSize: "$1", color: done === list.length ? '$ink' : '$soft', children: [done, "/", list.length] })] })) : null, card.priority && card.priority !== 'none' ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: card.priority })) : null, _jsx(YStack, { flex: 1 }), card.assignee ? (_jsx(Face, { src: who?.avatar, emoji: who?.emoji, name: who?.name ?? card.assignee, size: 20 })) : null] })] }) }) }));
|
|
177
107
|
}
|
|
178
108
|
// ── the card, opened ────────────────────────────────────────────────────────
|
|
179
109
|
/**
|
|
@@ -184,7 +114,6 @@ function Tile({ card, who, onOpen, }) {
|
|
|
184
114
|
* field behind them — a cover, a file — are absent rather than drawn and inert.
|
|
185
115
|
*/
|
|
186
116
|
function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
187
|
-
const { t, locale } = useI18n();
|
|
188
117
|
const { client } = useAi();
|
|
189
118
|
const [panel, setPanel] = useState(null);
|
|
190
119
|
const [title, setTitle] = useState(card.title);
|
|
@@ -236,12 +165,12 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
236
165
|
onSaved();
|
|
237
166
|
}
|
|
238
167
|
catch (e) {
|
|
239
|
-
setWrong(e instanceof Error ? e.message :
|
|
168
|
+
setWrong(e instanceof Error ? e.message : 'The change was refused');
|
|
240
169
|
}
|
|
241
170
|
finally {
|
|
242
171
|
setBusy(false);
|
|
243
172
|
}
|
|
244
|
-
}, [client, card.projectKey, card.number, onSaved
|
|
173
|
+
}, [client, card.projectKey, card.number, onSaved]);
|
|
245
174
|
// TICKING A STEP REWRITES ITS LINE, and only its line — the description is
|
|
246
175
|
// the reader's prose as well as the checklist, so a save that reformatted it
|
|
247
176
|
// would eat what they wrote around the boxes.
|
|
@@ -250,7 +179,7 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
250
179
|
setBody(written);
|
|
251
180
|
void save({ description: written });
|
|
252
181
|
};
|
|
253
|
-
return (_jsxs(YStack, { position: "absolute", t: 0, r: 0, b: 0, width: 560, maxW: "100%", bg: "$panel", borderLeftWidth: 1, borderColor: "$borderColor", z: "var(--z-sheet)", children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, numberOfLines: 1, children: card.identifier }), _jsx(Box, { render: "button", onClick: onClose, p: "$1", rounded: "$2", "aria-label":
|
|
182
|
+
return (_jsxs(YStack, { position: "absolute", t: 0, r: 0, b: 0, width: 560, maxW: "100%", bg: "$panel", borderLeftWidth: 1, borderColor: "$borderColor", z: "var(--z-sheet)", children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$4", py: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, numberOfLines: 1, children: card.identifier }), _jsx(Box, { render: "button", onClick: onClose, p: "$1", rounded: "$2", "aria-label": "Close", children: _jsx(X, { size: 16, "aria-hidden": true }) })] }), _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$4", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Box, { render: "button", onClick: () => void save({ status: finished ? 'todo' : 'done' }), "aria-label": finished ? 'Reopen this card' : 'Mark this card done', "aria-pressed": finished, width: 22, height: 22, shrink: 0, rounded: 9999, borderWidth: finished ? 0 : 1.5, borderColor: "$soft", bg: finished ? '$ink' : 'transparent', items: "center", justify: "center", hoverStyle: { borderColor: '$ink' }, children: finished ? _jsx(Check, { size: 13, color: "var(--background)", "aria-hidden": true }) : null }), _jsx(Text, { render: _jsx("input", { value: title, onChange: (e) => setTitle(e.target.value), onBlur: () => title.trim() && title !== card.title && void save({ title: title.trim() }), "aria-label": "Card title" }), flex: 1, minW: 0, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit", fontSize: "$7", fontWeight: "600", textDecorationLine: finished ? 'line-through' : 'none' })] }), _jsxs(XStack, { gap: "$1.5", flexWrap: "wrap", children: [_jsx(Act, { icon: Tag, label: "Labels", on: panel === 'labels', onPress: () => setPanel(panel === 'labels' ? null : 'labels') }), _jsx(Act, { icon: Calendar, label: "Dates", on: panel === 'dates', onPress: () => setPanel(panel === 'dates' ? null : 'dates') }), _jsx(Act, { icon: UserPlus, label: "Members", on: panel === 'members', onPress: () => setPanel(panel === 'members' ? null : 'members') })] }), panel === 'labels' ? (_jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Labels" }), card.labels.length > 0 ? (_jsx(XStack, { gap: "$1", flexWrap: "wrap", children: card.labels.map((l) => (_jsx(Label, { name: l }, l))) })) : (_jsx(Text, { fontSize: "$1", color: "$soft", children: "None yet." })), _jsx(Text, { fontSize: "$1", color: "$soft", children: "A label is a word on the forge issue, and its colour comes from the word \u2014 so it reads the same here and there. Labels are added on the forge; this board does not write them yet." })] })) : null, panel === 'dates' ? (_jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Dates" }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Start" }), _jsx(Text, { render: _jsx("input", { type: "date", value: asInput(card.startAt), readOnly: true }), ...DATE })] }), _jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Due" }), _jsx(Text, { render: _jsx("input", { type: "date", value: asInput(card.dueAt), readOnly: true }), ...DATE })] })] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: "A card's dates come from its forge milestone, which is why they read here and cannot yet be set here." })] })) : null, panel === 'members' ? (_jsxs(YStack, { gap: "$2", p: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Members" }), people.length === 0 ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: "Nobody to assign yet." })) : (people.map((p) => (_jsx(Box, { render: "button", onClick: () => void save({ assignee: card.assignee === p.name ? '' : p.name }), width: "100%", p: "$2", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Face, { src: p.avatar, emoji: p.emoji, name: p.label, size: 22 }), _jsx(Text, { fontSize: "$2", color: "$ink", flex: 1, numberOfLines: 1, children: p.label }), p.agent ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: "agent" })) : null, card.assignee === p.name ? _jsx(Check, { size: 14, "aria-hidden": true }) : null] }) }, p.id)))), _jsx(Box, { render: "button", onClick: () => {
|
|
254
183
|
if (!client || busy)
|
|
255
184
|
return;
|
|
256
185
|
setBusy(true);
|
|
@@ -258,16 +187,16 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
258
187
|
.then(onSaved)
|
|
259
188
|
.catch((e) => setWrong(e.message))
|
|
260
189
|
.finally(() => setBusy(false));
|
|
261
|
-
}, p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children:
|
|
190
|
+
}, p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: "Take it myself" }) })] })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Description" }), _jsx(Text, { render: _jsx("textarea", { value: body, onChange: (e) => setBody(e.target.value), onBlur: () => body !== (card.description ?? '') && void save({ description: body }), placeholder: "What is this card about?", rows: 5 }), width: "100%", bg: "transparent", borderWidth: 1, borderColor: "var(--border)", rounded: 8, p: 10, outlineStyle: "none", color: "inherit", fontSize: "$2" })] }), _jsxs(YStack, { gap: "$2", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children: "Checklist" }), list.length > 0 ? (_jsxs(Text, { fontSize: "$1", color: "$soft", children: [pct, "%"] })) : null] }), list.length > 0 ? (_jsx(YStack, { height: 4, rounded: 9999, bg: "$hover", overflow: "hidden", children: _jsx(YStack, { width: `${pct}%`, height: 4, bg: "$ink" }) })) : null, list.map((s) => (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx("input", { type: "checkbox", checked: s.done, onChange: (e) => flip(s.line, e.target.checked), "aria-label": s.text }), _jsx(Text, { fontSize: "$2", color: s.done ? '$soft' : '$ink', textDecorationLine: s.done ? 'line-through' : 'none', flex: 1, children: s.text })] }, s.line))), _jsx(XStack, { gap: "$2", children: _jsx(Text, { render: _jsx("input", { value: step, onChange: (e) => setStep(e.target.value), onKeyDown: (e) => {
|
|
262
191
|
if (e.key !== 'Enter' || !step.trim())
|
|
263
192
|
return;
|
|
264
193
|
const written = addStep(body, step);
|
|
265
194
|
setBody(written);
|
|
266
195
|
setStep('');
|
|
267
196
|
void save({ description: written });
|
|
268
|
-
}, placeholder:
|
|
269
|
-
?
|
|
270
|
-
:
|
|
197
|
+
}, placeholder: "Add an item" }), flex: 1, bg: "transparent", borderWidth: 1, borderColor: "var(--border)", rounded: 6, px: 8, py: 6, outlineStyle: "none", color: "inherit", fontSize: "$2" }) })] }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Column" }), _jsxs(Select, { value: card.status, onValueChange: (v) => void save({ status: v }), children: [_jsx(SelectTrigger, { "aria-label": "Column", width: 160, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: COLUMNS.map((c) => (_jsx(SelectItem, { value: c.id, children: c.label }, c.id))) })] })] }), _jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Priority" }), _jsxs(Select, { value: card.priority || 'none', onValueChange: (v) => void save({ priority: v }), children: [_jsx(SelectTrigger, { "aria-label": "Priority", width: 160, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PRIORITIES.map((p) => (_jsx(SelectItem, { value: p, children: p }, p))) })] })] })] }), _jsxs(YStack, { gap: "$2", pt: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: "Durable run" }), run ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$2", color: "$ink", children: reads(run.status) }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: run.workflowId }), run.historyLength ? (_jsxs(Text, { fontSize: "$1", color: "$soft", children: [run.historyLength, " events"] })) : null] })) : (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, children: card.assignee
|
|
198
|
+
? `${card.assignee} holds this. Hand the work to the engine and it survives a crash.`
|
|
199
|
+
: 'Nobody holds this yet — it can still be run, and the run is durable either way.' }), _jsx(Box, { render: "button", onClick: () => {
|
|
271
200
|
if (!client || starting)
|
|
272
201
|
return;
|
|
273
202
|
setStarting(true);
|
|
@@ -280,7 +209,7 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
280
209
|
.then(setRun)
|
|
281
210
|
.catch((e) => setWrong(e.message))
|
|
282
211
|
.finally(() => setStarting(false));
|
|
283
|
-
}, px: "$2.5", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children:
|
|
212
|
+
}, px: "$2.5", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: starting ? 'Handing over…' : 'Run it' }) })] }))] }), who ? (_jsxs(XStack, { items: "center", gap: "$2", children: [_jsx(Face, { src: who.avatar, emoji: who.emoji, name: who.label, size: 22 }), _jsxs(Text, { fontSize: "$2", color: "$soft", children: [who.label, " has this one."] })] })) : null, wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 3, children: wrong })) : null] })] }));
|
|
284
213
|
}
|
|
285
214
|
/** A date the sheet shows and does not yet write. */
|
|
286
215
|
const DATE = {
|
|
@@ -304,7 +233,6 @@ const DATE = {
|
|
|
304
233
|
* the day rather than being placed at an hour nobody chose.
|
|
305
234
|
*/
|
|
306
235
|
function Planner({ cards, onOpen }) {
|
|
307
|
-
const { t, locale } = useI18n();
|
|
308
236
|
const [offset, setOffset] = useState(0);
|
|
309
237
|
const day = useMemo(() => {
|
|
310
238
|
const d = new Date();
|
|
@@ -314,11 +242,10 @@ function Planner({ cards, onOpen }) {
|
|
|
314
242
|
}, [offset]);
|
|
315
243
|
const start = Math.floor(day.getTime() / 1000);
|
|
316
244
|
const due = cards.filter((c) => c.dueAt && c.dueAt >= start && c.dueAt < start + DAY);
|
|
317
|
-
return (_jsxs(YStack, { flex: 1, minW: 0, minH: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Calendar, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children: day.toLocaleDateString(
|
|
245
|
+
return (_jsxs(YStack, { flex: 1, minW: 0, minH: 0, children: [_jsxs(XStack, { items: "center", gap: "$2", px: "$3", py: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Calendar, { size: 14, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children: day.toLocaleDateString(undefined, { month: 'long' }) }), _jsx(Box, { render: "button", onClick: () => setOffset((n) => n - 1), p: "$1", rounded: "$2", "aria-label": "Previous day", children: _jsx(ChevronLeft, { size: 14, "aria-hidden": true }) }), _jsx(Box, { render: "button", onClick: () => setOffset(0), px: "$2", py: "$1", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { fontSize: "$1", color: "$ink", children: "Today" }) }), _jsx(Box, { render: "button", onClick: () => setOffset((n) => n + 1), p: "$1", rounded: "$2", "aria-label": "Next day", children: _jsx(ChevronRight, { size: 14, "aria-hidden": true }) })] }), _jsxs(YStack, { items: "center", py: "$2", gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: dayName(day) }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: day.getDate() })] }), _jsxs(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", children: [due.length > 0 ? (_jsxs(YStack, { p: "$3", gap: "$2", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: "Due today" }), due.map((c) => (_jsx(Box, { render: "button", onClick: () => onOpen(c), width: "100%", p: "$2.5", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$raised", hoverStyle: { borderColor: '$ink' }, children: _jsx(Text, { fontSize: "$2", color: "$ink", numberOfLines: 2, text: "left", children: c.title }) }, c.id)))] })) : null, Array.from({ length: 12 }, (_, i) => i + 8).map((hour) => (_jsx(XStack, { height: 56, borderTopWidth: 1, borderColor: "$borderColor", children: _jsx(YStack, { width: 54, pt: "$1", pl: "$3", children: _jsxs(Text, { fontSize: "$1", color: "$soft", children: [hour % 12 === 0 ? 12 : hour % 12, " ", hour < 12 ? 'am' : 'pm'] }) }) }, hour)))] })] }));
|
|
318
246
|
}
|
|
319
247
|
// ── the board ───────────────────────────────────────────────────────────────
|
|
320
248
|
function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
321
|
-
const { t, locale } = useI18n();
|
|
322
249
|
const [over, setOver] = useState(false);
|
|
323
250
|
const [adding, setAdding] = useState(false);
|
|
324
251
|
const [title, setTitle] = useState('');
|
|
@@ -331,7 +258,7 @@ function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
|
331
258
|
const ref = e.dataTransfer.getData('text/plain');
|
|
332
259
|
if (ref)
|
|
333
260
|
onDrop(ref, column.id);
|
|
334
|
-
}, children: _jsxs(YStack, { width: 300, gap: "$2", p: "$2", rounded: "$3", borderWidth: 1, borderColor: over ? '$ink' : '$borderColor', bg: "$hover", maxH: "100%", children: [_jsxs(XStack, { items: "baseline", gap: "$2", px: "$2", pt: "$1", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children:
|
|
261
|
+
}, children: _jsxs(YStack, { width: 300, gap: "$2", p: "$2", rounded: "$3", borderWidth: 1, borderColor: over ? '$ink' : '$borderColor', bg: "$hover", maxH: "100%", children: [_jsxs(XStack, { items: "baseline", gap: "$2", px: "$2", pt: "$1", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children: column.label }), _jsx(Text, { fontSize: "$1", color: "$soft", children: loading ? '' : cards.length })] }), _jsx(YStack, { gap: "$2", overflowY: "auto", overflowX: "hidden", shrink: 1, children: cards.map((c) => (_jsx(Tile, { card: c, who: people.find((p) => p.name === c.assignee), onOpen: () => onOpen(c) }, c.id))) }), adding ? (_jsx(YStack, { gap: "$2", children: _jsx(Text, { render: _jsx("textarea", { value: title, autoFocus: true, onChange: (e) => setTitle(e.target.value), onKeyDown: (e) => {
|
|
335
262
|
if (e.key === 'Escape') {
|
|
336
263
|
setAdding(false);
|
|
337
264
|
setTitle('');
|
|
@@ -350,11 +277,11 @@ function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
|
350
277
|
setAdding(false);
|
|
351
278
|
});
|
|
352
279
|
}
|
|
353
|
-
}, placeholder:
|
|
280
|
+
}, placeholder: "What needs doing?", rows: 2 }), "$platform-web": { resize: 'none' }, width: "100%", bg: "var(--surface-card)", borderWidth: 1, borderColor: "var(--border)", rounded: 8, p: 8, outlineStyle: "none", color: "inherit", fontSize: "$2" }) })) : (_jsx(Box, { render: "button", onClick: () => setAdding(true), width: "100%", p: "$2", rounded: "$2",
|
|
354
281
|
// THE WHOLE ROW LIGHTS, not the words — it is a full-width target and
|
|
355
282
|
// a fill is what says so. The tint sits above the column's own
|
|
356
283
|
// ground so the row reads as raised rather than merely tinted.
|
|
357
|
-
hoverStyle: { bg: '$raised' }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Plus, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$soft", children:
|
|
284
|
+
hoverStyle: { bg: '$raised' }, children: _jsxs(XStack, { items: "center", gap: "$1.5", children: [_jsx(Plus, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$soft", children: "Add a card" })] }) }))] }) }));
|
|
358
285
|
}
|
|
359
286
|
/** One narrowing, as a box a reader ticks. */
|
|
360
287
|
function Tick({ on, label, onPress, }) {
|
|
@@ -374,28 +301,19 @@ function Tick({ on, label, onPress, }) {
|
|
|
374
301
|
* does not keep.
|
|
375
302
|
*/
|
|
376
303
|
function Filter({ want, labels, onWant, onClose, }) {
|
|
377
|
-
const { t, locale } = useI18n();
|
|
378
304
|
const set = (patch) => onWant({ ...want, ...patch });
|
|
379
305
|
const flipLabel = (l) => {
|
|
380
306
|
const held = want.labels ?? [];
|
|
381
307
|
set({ labels: held.includes(l) ? held.filter((x) => x !== l) : [...held, l] });
|
|
382
308
|
};
|
|
383
309
|
const Head = ({ children }) => (_jsx(Text, { fontSize: "$1", color: "$soft", px: "$2", pt: "$2", children: children }));
|
|
384
|
-
return (_jsxs(YStack, { position: "absolute", t: 52, r: 12, width: 300, maxH: 560, overflowY: "auto", overflowX: "hidden", p: "$2", gap: "$0.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", z: "var(--z-dock)", children: [_jsxs(XStack, { items: "center", px: "$2", py: "$1", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children:
|
|
385
|
-
['none', t('No dates')],
|
|
386
|
-
['late', t('Overdue')],
|
|
387
|
-
['day', t('Due in the next day')],
|
|
388
|
-
['week', t('Due in the next week')],
|
|
389
|
-
['month', t('Due in the next month')],
|
|
390
|
-
].map(([id, label]) => (_jsx(Tick, { on: want.due === id, label: label, onPress: () => set({ due: want.due === id ? undefined : id }) }, id))), labels.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Head, { children: t('Labels') }), labels.map((l) => (_jsx(Tick, { on: (want.labels ?? []).includes(l), label: _jsx(Label, { name: l }), onPress: () => flipLabel(l) }, l)))] })) : null, _jsx(Head, { children: t('Activity') }), [
|
|
391
|
-
[7, t('Moved in the last week')],
|
|
392
|
-
[14, t('Moved in the last two weeks')],
|
|
393
|
-
[28, t('Moved in the last four weeks')],
|
|
394
|
-
].map(([days, label]) => (_jsx(Tick, { on: want.active === days, label: label, onPress: () => set({ active: want.active === days ? undefined : days }) }, days))), _jsx(Box, { render: "button", onClick: () => onWant({}), width: "100%", mt: "$2", p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t('Clear') }) })] }));
|
|
310
|
+
return (_jsxs(YStack, { position: "absolute", t: 52, r: 12, width: 300, maxH: 560, overflowY: "auto", overflowX: "hidden", p: "$2", gap: "$0.5", rounded: "$4", borderWidth: 1, borderColor: "$borderColor", bg: "$panel", z: "var(--z-dock)", children: [_jsxs(XStack, { items: "center", px: "$2", py: "$1", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", flex: 1, children: "Filter" }), _jsx(Box, { render: "button", onClick: onClose, p: "$1", rounded: "$2", "aria-label": "Close filter", children: _jsx(X, { size: 14, "aria-hidden": true }) })] }), _jsx(Tick, { on: want.holder === 'none', label: "Nobody has it", onPress: () => set({ holder: want.holder === 'none' ? undefined : 'none' }) }), _jsx(Tick, { on: want.holder === 'me', label: "Mine", onPress: () => set({ holder: want.holder === 'me' ? undefined : 'me' }) }), _jsx(Head, { children: "Who did the work" }), _jsx(Tick, { on: want.by === 'person', label: "A person", onPress: () => set({ by: want.by === 'person' ? undefined : 'person' }) }), _jsx(Tick, { on: want.by === 'agent', label: "An agent", onPress: () => set({ by: want.by === 'agent' ? undefined : 'agent' }) }), _jsx(Head, { children: "Card status" }), _jsx(Tick, { on: want.state === 'done', label: "Finished", onPress: () => set({ state: want.state === 'done' ? undefined : 'done' }) }), _jsx(Tick, { on: want.state === 'open', label: "Still open", onPress: () => set({ state: want.state === 'open' ? undefined : 'open' }) }), _jsx(Head, { children: "Due date" }), [['none', 'No dates'], ['late', 'Overdue'], ['day', 'Due in the next day'], ['week', 'Due in the next week'], ['month', 'Due in the next month']].map(([id, label]) => (_jsx(Tick, { on: want.due === id, label: label, onPress: () => set({ due: want.due === id ? undefined : id }) }, id))), labels.length > 0 ? (_jsxs(_Fragment, { children: [_jsx(Head, { children: "Labels" }), labels.map((l) => (_jsx(Tick, { on: (want.labels ?? []).includes(l), label: _jsx(Label, { name: l }), onPress: () => flipLabel(l) }, l)))] })) : null, _jsx(Head, { children: "Activity" }), [[7, 'Moved in the last week'], [14, 'Moved in the last two weeks'], [28, 'Moved in the last four weeks']].map(([days, label]) => (_jsx(Tick, { on: want.active === days, label: label, onPress: () => set({ active: want.active === days ? undefined : days }) }, days))), _jsx(Box, { render: "button", onClick: () => onWant({}), width: "100%", mt: "$2", p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: "Clear" }) })] }));
|
|
395
311
|
}
|
|
396
312
|
// ── the room ────────────────────────────────────────────────────────────────
|
|
313
|
+
/** Said when a write has no board to write to. It is the same event whichever
|
|
314
|
+
* write asked, so it is one sentence rather than two wordings of one. */
|
|
315
|
+
const NOWHERE = 'No project answered, so there is nowhere to file this card.';
|
|
397
316
|
function Cards() {
|
|
398
|
-
const { t, locale } = useI18n();
|
|
399
317
|
const { client } = useAi();
|
|
400
318
|
const { user } = useIam();
|
|
401
319
|
const { currentOrgId } = useOrganizations();
|
|
@@ -448,12 +366,12 @@ function Cards() {
|
|
|
448
366
|
.catch(() => { });
|
|
449
367
|
void readBoard(client, key ? { key } : {}, stop.signal)
|
|
450
368
|
.then((rows) => live && (setCards(rows), setRefused(null)))
|
|
451
|
-
.catch((e) => live && (setCards([]), setRefused(say(e,
|
|
369
|
+
.catch((e) => live && (setCards([]), setRefused(say(e, 'this board'))));
|
|
452
370
|
return () => {
|
|
453
371
|
live = false;
|
|
454
372
|
stop.abort();
|
|
455
373
|
};
|
|
456
|
-
}, [client, key, nonce
|
|
374
|
+
}, [client, key, nonce]);
|
|
457
375
|
// THE AGENT NAMES, so "an agent did this" can be answered about a card whose
|
|
458
376
|
// source says `team` but whose holder is a bot — which is what a person filing
|
|
459
377
|
// work and handing it over actually looks like.
|
|
@@ -483,18 +401,18 @@ function Cards() {
|
|
|
483
401
|
if (!n)
|
|
484
402
|
return;
|
|
485
403
|
if (!targetKey)
|
|
486
|
-
return setRefused(
|
|
404
|
+
return setRefused(NOWHERE);
|
|
487
405
|
void edit(client, targetKey, Number(n), { status })
|
|
488
406
|
.then(() => bump((x) => x + 1))
|
|
489
|
-
.catch((e) => setRefused(say(e,
|
|
490
|
-
}, [client, key, keys
|
|
407
|
+
.catch((e) => setRefused(say(e, 'this card', 'save')));
|
|
408
|
+
}, [client, key, keys]);
|
|
491
409
|
/**
|
|
492
410
|
* Files a card, and ANSWERS WHETHER IT LANDED.
|
|
493
411
|
*/
|
|
494
412
|
const add = useCallback(async (status, title) => {
|
|
495
413
|
const targetKey = key || keys[0];
|
|
496
414
|
if (!targetKey) {
|
|
497
|
-
setRefused(
|
|
415
|
+
setRefused(NOWHERE);
|
|
498
416
|
return false;
|
|
499
417
|
}
|
|
500
418
|
try {
|
|
@@ -508,15 +426,13 @@ function Cards() {
|
|
|
508
426
|
return true;
|
|
509
427
|
}
|
|
510
428
|
catch (e) {
|
|
511
|
-
setRefused(say(e,
|
|
429
|
+
setRefused(say(e, 'this card', 'save'));
|
|
512
430
|
return false;
|
|
513
431
|
}
|
|
514
|
-
}, [client, key, keys
|
|
515
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { height: 52, shrink: 0, items: "center", gap: "$3", px: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { render: "h1", fontSize: "$4", fontWeight: "600", color: "$ink", numberOfLines: 1, children:
|
|
516
|
-
? t('{shown} of {total}', { shown: shown.length.toLocaleString(locale), total: cards.length.toLocaleString(locale) })
|
|
517
|
-
: t('{count} cards', { count: cards.length.toLocaleString(locale) }) })) : null, _jsx(Act, { icon: ListFilter, label: t('Filter'), on: filtering || narrowed, onPress: () => setFiltering((v) => !v) }), _jsx(XStack, { display: "none", $md: { display: 'flex' }, children: _jsx(Act, { icon: SquareTerminal, label: t('Tabs & Shell'), on: Boolean(aside), onPress: () => showAside(aside ? null : "tasks") }) })] }), _jsxs(XStack, { flex: 1, minH: 0, children: [view === 'planner' ? _jsx(Planner, { cards: cards ?? [], onOpen: setOpened }) : null, _jsxs(YStack, { flex: 1, minW: 0, minH: 0,
|
|
432
|
+
}, [client, key, keys]);
|
|
433
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, position: "relative", children: [_jsxs(XStack, { height: 52, shrink: 0, items: "center", gap: "$3", px: "$3", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { render: "h1", fontSize: "$4", fontWeight: "600", color: "$ink", numberOfLines: 1, children: "Board" }), _jsxs(Select, { value: key || 'all', onValueChange: setKey, children: [_jsx(SelectTrigger, { "aria-label": "Board", width: 140, $sm: { width: 100 }, children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: "All Boards" }, "all"), keys.map((k) => (_jsx(SelectItem, { value: k, children: k.charAt(0).toUpperCase() + k.slice(1) }, k)))] })] }), _jsx(YStack, { flex: 1 }), cards ? (_jsx(Text, { fontSize: "$1", color: "$soft", display: "none", $md: { display: 'flex' }, children: narrowed ? `${shown.length} of ${cards.length}` : `${cards.length} cards` })) : null, _jsx(Act, { icon: ListFilter, label: "Filter", on: filtering || narrowed, onPress: () => setFiltering((v) => !v) }), _jsx(XStack, { display: "none", $md: { display: 'flex' }, children: _jsx(Act, { icon: SquareTerminal, label: "Tabs & Shell", on: Boolean(aside), onPress: () => showAside(aside ? null : "tasks") }) })] }), _jsxs(XStack, { flex: 1, minH: 0, children: [view === 'planner' ? _jsx(Planner, { cards: cards ?? [], onOpen: setOpened }) : null, _jsxs(YStack, { flex: 1, minW: 0, minH: 0,
|
|
518
434
|
// One view at a time: the planner is the other reading of these cards.
|
|
519
|
-
display: view === 'planner' ? "none" : "flex", children: [refused ? (_jsxs(XStack, { items: "center", gap: "$2", mx: "$4", mt: "$3", px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$hover", children: [
|
|
435
|
+
display: view === 'planner' ? "none" : "flex", children: [refused ? (_jsxs(XStack, { items: "center", gap: "$2", mx: "$4", mt: "$3", px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", bg: "$hover", children: [_jsxs(Text, { fontSize: "$1", color: "$soft", flex: 1, minW: 0, children: [refused, " Cards will appear here when it answers."] }), _jsx(Box, { render: "button", onClick: () => bump((x) => x + 1), shrink: 0, px: "$2", py: "$1", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: "Try again" }) })] })) : null, _jsx(XStack, { flex: 1, minH: 0, overflowX: "auto", overflowY: "auto", p: "$4", gap: "$3", items: "flex-start", children: COLUMNS.map((c) => (_jsx(Column, { column: c, cards: filed.get(c.id) ?? [], people: roster, onDrop: move, onOpen: setOpened, onAdd: add, loading: cards === null && !refused }, c.id))) })] })] }), _jsxs(XStack, { shrink: 0, items: "center", gap: "$2", px: "$3", py: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Act, { icon: Columns3, label: "Board", on: view === 'board', onPress: () => setView('board') }), _jsx(Act, { icon: Calendar, label: "Planner", on: view === 'planner', onPress: () => setView('planner') }), _jsx(YStack, { flex: 1 }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, display: "none", $md: { display: 'flex' }, children: "A card is a forge issue \u2014 moving it here moves it there." })] }), filtering ? (_jsx(Filter, { want: want, labels: labels, onWant: setWant, onClose: () => setFiltering(false) })) : null, opened ? (_jsx(Detail, { card: cards?.find((c) => c.id === opened.id) ?? opened, people: roster, agents: agents, onClose: () => setOpened(null), onSaved: () => bump((x) => x + 1) })) : null] }));
|
|
520
436
|
}
|
|
521
437
|
/**
|
|
522
438
|
* The pane, and the session its reads need.
|
package/dist/Boxes.js
CHANGED
|
@@ -19,7 +19,6 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
19
19
|
// Both are drawn, because a runaway command and an unwanted box are different
|
|
20
20
|
// problems and one control for both would do the wrong one half the time.
|
|
21
21
|
import { useCallback, useEffect, useState } from 'react';
|
|
22
|
-
import { useI18n } from '@hanzo/i18n/react';
|
|
23
22
|
import { say } from './failure.js';
|
|
24
23
|
import { Play, Plus, Square, X } from 'lucide-react';
|
|
25
24
|
import { ChannelHeader } from '@hanzo/ui/agents';
|
|
@@ -53,15 +52,15 @@ const HOURLY = {
|
|
|
53
52
|
/** Micro-USD as money. Two places, because that is how an hourly rate reads. */
|
|
54
53
|
const usd = (micros) => `$${(micros / 1_000_000).toFixed(2)}`;
|
|
55
54
|
/** Unix seconds to how long is left, or the fact that it is over. */
|
|
56
|
-
const remaining = (expiresAt
|
|
55
|
+
const remaining = (expiresAt) => {
|
|
57
56
|
if (!expiresAt)
|
|
58
57
|
return '';
|
|
59
58
|
const left = expiresAt - Math.floor(Date.now() / 1000);
|
|
60
59
|
if (left <= 0)
|
|
61
|
-
return
|
|
60
|
+
return 'expired';
|
|
62
61
|
if (left < 3600)
|
|
63
|
-
return
|
|
64
|
-
return
|
|
62
|
+
return `${Math.ceil(left / 60)}m left`;
|
|
63
|
+
return `${Math.floor(left / 3600)}h ${Math.ceil((left % 3600) / 60)}m left`;
|
|
65
64
|
};
|
|
66
65
|
/**
|
|
67
66
|
* Take a new lease.
|
|
@@ -76,7 +75,6 @@ const remaining = (expiresAt, t) => {
|
|
|
76
75
|
* The rate is stated on the button because taking this lease starts a meter.
|
|
77
76
|
*/
|
|
78
77
|
function Start({ onDone }) {
|
|
79
|
-
const { t } = useI18n();
|
|
80
78
|
const { client } = useAi();
|
|
81
79
|
const [klass, setKlass] = useState('exec');
|
|
82
80
|
const [project, setProject] = useState('');
|
|
@@ -87,7 +85,7 @@ function Start({ onDone }) {
|
|
|
87
85
|
if (!client || busy)
|
|
88
86
|
return;
|
|
89
87
|
if (keeps && !project.trim()) {
|
|
90
|
-
setFailed(
|
|
88
|
+
setFailed(`A ${klass} sandbox keeps a disk, so it needs a project to name it.`);
|
|
91
89
|
return;
|
|
92
90
|
}
|
|
93
91
|
setBusy(true);
|
|
@@ -105,8 +103,8 @@ function Start({ onDone }) {
|
|
|
105
103
|
finally {
|
|
106
104
|
setBusy(false);
|
|
107
105
|
}
|
|
108
|
-
}, [client, busy, keeps, klass, project, onDone
|
|
109
|
-
return (_jsxs(YStack, { gap: "$2", p: "$4", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsxs(Select, { value: klass, onValueChange: (v) => setKlass(v), children: [_jsx(SelectTrigger, { "aria-label":
|
|
106
|
+
}, [client, busy, keeps, klass, project, onDone]);
|
|
107
|
+
return (_jsxs(YStack, { gap: "$2", p: "$4", borderBottomWidth: 1, borderColor: "$borderColor", children: [_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsxs(Select, { value: klass, onValueChange: (v) => setKlass(v), children: [_jsx(SelectTrigger, { "aria-label": "Sandbox class", width: 200, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: Object.keys(HOURLY).map((c) => (_jsxs(SelectItem, { value: c, children: [c, " \u2014 ", usd(HOURLY[c]), "/hr list"] }, c))) })] }), keeps ? (_jsx(XStack, { flex: 1, minW: 160, height: 34, items: "center", px: "$3", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", children: _jsx(Text, { render: _jsx("input", { value: project, onChange: (e) => setProject(e.target.value), onKeyDown: (e) => e.key === 'Enter' && void take(), placeholder: "Project \u2014 the disk it keeps" }), flex: 1, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit" }) })) : (_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, children: "Keeps nothing \u2014 an exec sandbox has no disk." })), _jsx(Box, { render: "button", onClick: () => void take(), px: "$3", py: "$2", rounded: "$3", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Plus, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$2", color: "$ink", children: busy ? 'Leasing' : 'Lease' })] }) })] }), failed ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 2, children: failed })) : null] }));
|
|
110
108
|
}
|
|
111
109
|
function Empty({ children }) {
|
|
112
110
|
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: children }) }));
|
|
@@ -115,12 +113,10 @@ function Act({ icon: Icon, label, onPress, busy, }) {
|
|
|
115
113
|
return (_jsx(Box, { render: "button", onClick: onPress, "aria-label": label, px: "$2", py: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, children: _jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(Icon, { size: 13, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: "$soft", children: busy ? '…' : label })] }) }));
|
|
116
114
|
}
|
|
117
115
|
function Row({ box, onResume, onStop, onEnd, busy, }) {
|
|
118
|
-
const { t } = useI18n();
|
|
119
116
|
const rate = HOURLY[(box.class ?? 'exec')] ?? HOURLY.exec;
|
|
120
|
-
return (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Text, { fontSize: "$3", color: "$ink", flex: 1, numberOfLines: 1, children: [box.class ?? 'exec', box.project ? ` · ${box.project}` : ''] }),
|
|
117
|
+
return (_jsxs(YStack, { gap: "$2", p: "$3", borderWidth: 1, borderColor: "$borderColor", rounded: "$3", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Text, { fontSize: "$3", color: "$ink", flex: 1, numberOfLines: 1, children: [box.class ?? 'exec', box.project ? ` · ${box.project}` : ''] }), _jsxs(Text, { fontSize: "$1", color: "$soft", children: [usd(rate), "/hr list"] })] }), _jsxs(XStack, { gap: "$2", items: "baseline", flexWrap: "wrap", children: [_jsxs(Text, { fontSize: "$1", color: "$soft", children: [box.status ?? 'unknown', box.runtime ? ` · ${box.runtime}` : ''] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: remaining(box.expiresAt) })] }), box.status === 'error' && box.error ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 2, children: box.error })) : null, _jsxs(XStack, { gap: "$1", children: [_jsx(Act, { icon: Play, label: "Resume", onPress: onResume, busy: busy === 'resume' }), _jsx(Act, { icon: Square, label: "Stop", onPress: onStop, busy: busy === 'stop' }), _jsx(Act, { icon: X, label: "End", onPress: onEnd, busy: busy === 'end' })] })] }));
|
|
121
118
|
}
|
|
122
119
|
export function Boxes() {
|
|
123
|
-
const { t } = useI18n();
|
|
124
120
|
const { client } = useAi();
|
|
125
121
|
// SIGNED IN IS THE CREDENTIAL, NOT THE PROFILE. This gated on `user`, which is
|
|
126
122
|
// the answer to a userinfo REQUEST — and `IamProvider` swallows that request's
|
|
@@ -168,10 +164,10 @@ export function Boxes() {
|
|
|
168
164
|
if (isLoading)
|
|
169
165
|
return _jsx(Empty, { children: "\u00A0" });
|
|
170
166
|
if (!signedIn)
|
|
171
|
-
return _jsx(Empty, { children:
|
|
167
|
+
return _jsx(Empty, { children: "Sign in to see the compute your org is holding." });
|
|
172
168
|
if (failed)
|
|
173
|
-
return _jsx(Empty, { children: say(failed,
|
|
169
|
+
return _jsx(Empty, { children: say(failed, 'this list') });
|
|
174
170
|
if (!boxes)
|
|
175
|
-
return _jsx(Empty, { children:
|
|
176
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsx(ChannelHeader, { name:
|
|
171
|
+
return _jsx(Empty, { children: "Reading your leases." });
|
|
172
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsx(ChannelHeader, { name: "Sandboxes", children: _jsxs(Text, { fontSize: "$2", color: "$soft", children: ["from ", usd(HOURLY.exec), "/hr"] }) }), _jsx(Start, { onDone: reload }), boxes.length === 0 ? (_jsx(Empty, { children: "Nothing is running. A sandbox is leased when an agent needs somewhere to work, and billed for the hours it is held." })) : (_jsx(YStack, { flex: 1, minH: 0, overflowY: "auto", overflowX: "hidden", p: "$4", gap: "$3", children: boxes.map((box) => (_jsx(Row, { box: box, busy: busy[box.id], onResume: () => void act(box.id, 'resume'), onStop: () => void act(box.id, 'stop'), onEnd: () => void act(box.id, 'end') }, box.id))) }))] }));
|
|
177
173
|
}
|