@hanzo/app 0.2.56 → 0.2.57
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/Board.js +121 -37
- package/dist/Boxes.js +16 -12
- package/dist/CalScheduler.js +81 -40
- package/dist/Chat.js +1 -2
- package/dist/Contents.d.ts +1 -1
- package/dist/Contents.js +1 -2
- package/dist/Drive.js +121 -100
- package/dist/Inbox.js +7 -7
- package/dist/Market.js +15 -10
- package/dist/Meet.js +78 -48
- package/dist/Orgs.js +9 -10
- package/dist/Palette.d.ts +1 -1
- package/dist/Palette.js +1 -2
- package/dist/Schedule.js +15 -11
- package/dist/Settings.d.ts +1 -1
- package/dist/SettingsPane.js +2 -2
- package/dist/Shared.js +16 -11
- package/dist/Talk.js +4 -4
- package/dist/Terminals.js +3 -1
- package/dist/Usage.js +3 -3
- package/dist/WindowControls.js +5 -3
- package/dist/Work.js +51 -28
- package/dist/bots/Bots.js +129 -73
- package/dist/bots/runtime.js +103 -41
- 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/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 +4 -5
- package/dist/lib/orgname.d.ts +1 -1
- package/dist/lib/orgname.js +1 -1
- package/dist/lib/pay.d.ts +6 -2
- package/dist/lib/pay.js +15 -2
- 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 +10 -8
- package/dist/recent.d.ts +1 -1
- package/dist/recent.js +1 -2
- package/dist/thread.js +1 -1
- package/package.json +3 -3
- package/dist/say.d.ts +0 -4
- package/dist/say.js +0 -7
package/dist/Board.js
CHANGED
|
@@ -27,12 +27,14 @@ 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';
|
|
30
31
|
import { useAgents, usePeople } from '@hanzo/ai/react';
|
|
31
32
|
import { Box, Text, View, XStack, YStack } from '@hanzo/ui';
|
|
32
33
|
import { Select, SelectContent, SelectItem, SelectTrigger, SelectValue } from '@hanzo/ui';
|
|
33
34
|
import { useIam, useOrganizations } from '@hanzo/iam/react';
|
|
34
35
|
import { Calendar, CalendarClock, Check, ChevronLeft, ChevronRight, Columns3, ListChecks, ListFilter, SquareTerminal, Plus, Tag, UserPlus, X, } from 'lucide-react';
|
|
35
36
|
import { useOpen } from './open.js';
|
|
37
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
36
38
|
import { useAi } from './lib/ai.js';
|
|
37
39
|
import { Face } from './cast.js';
|
|
38
40
|
import { say } from './failure.js';
|
|
@@ -40,9 +42,73 @@ import { AGENT_QUEUE, AGENT_WORKFLOW, reads, runOf, start as startRun, } from '.
|
|
|
40
42
|
import { COLUMNS, PRIORITIES, addStep, board as readBoard, claim, edit, open as openCard, projects as readProjects, sift, steps, tick, } from './lib/todo.js';
|
|
41
43
|
import { BAD } from './lib/mix.js';
|
|
42
44
|
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
|
+
}
|
|
43
108
|
/** A pane with nothing in it yet, centred, saying which nothing it is. */
|
|
44
109
|
function Empty({ children }) {
|
|
45
|
-
|
|
110
|
+
const { t, locale } = useI18n();
|
|
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 })] }));
|
|
46
112
|
}
|
|
47
113
|
/** A quiet control that says its verb. */
|
|
48
114
|
function Act({ icon: Icon, label, on, onPress, }) {
|
|
@@ -52,14 +118,14 @@ function Act({ icon: Icon, label, on, onPress, }) {
|
|
|
52
118
|
function Label({ name }) {
|
|
53
119
|
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 }) }));
|
|
54
120
|
}
|
|
55
|
-
/** A date, as a person says it. */
|
|
56
|
-
function when(unix) {
|
|
121
|
+
/** A date, as a person says it, in the language they chose. */
|
|
122
|
+
function when(unix, locale) {
|
|
57
123
|
if (!unix)
|
|
58
124
|
return '';
|
|
59
125
|
const at = new Date(unix * 1000);
|
|
60
126
|
const now = new Date();
|
|
61
127
|
const same = at.getFullYear() === now.getFullYear();
|
|
62
|
-
return at.toLocaleDateString(
|
|
128
|
+
return at.toLocaleDateString(locale, {
|
|
63
129
|
month: 'short',
|
|
64
130
|
day: 'numeric',
|
|
65
131
|
...(same ? {} : { year: 'numeric' }),
|
|
@@ -75,19 +141,22 @@ function when(unix) {
|
|
|
75
141
|
* weekday, and one outside this week gets its date too, because "Tuesday" stops
|
|
76
142
|
* being an answer once there is more than one of them in view.
|
|
77
143
|
*/
|
|
78
|
-
function dayName(day, now = new Date()) {
|
|
144
|
+
function dayName(day, t, locale, now = new Date()) {
|
|
79
145
|
const at = (d) => new Date(d.getFullYear(), d.getMonth(), d.getDate()).getTime();
|
|
80
146
|
const days = Math.round((at(day) - at(now)) / 86400000);
|
|
81
147
|
if (days === 0)
|
|
82
|
-
return 'Today';
|
|
148
|
+
return t('Today');
|
|
83
149
|
if (days === 1)
|
|
84
|
-
return 'Tomorrow';
|
|
150
|
+
return t('Tomorrow');
|
|
85
151
|
if (days === -1)
|
|
86
|
-
return 'Yesterday';
|
|
87
|
-
const weekday = day.toLocaleDateString(
|
|
152
|
+
return t('Yesterday');
|
|
153
|
+
const weekday = day.toLocaleDateString(locale, { weekday: 'long' });
|
|
88
154
|
if (days > 1 && days < 7)
|
|
89
155
|
return weekday;
|
|
90
|
-
return
|
|
156
|
+
return t('{weekday} {date}', {
|
|
157
|
+
weekday,
|
|
158
|
+
date: day.toLocaleDateString(locale, { month: 'short', day: 'numeric' }),
|
|
159
|
+
});
|
|
91
160
|
}
|
|
92
161
|
/** The value a date input wants, from unix seconds. */
|
|
93
162
|
const asInput = (unix) => unix ? new Date(unix * 1000).toISOString().slice(0, 10) : '';
|
|
@@ -100,10 +169,11 @@ const asInput = (unix) => unix ? new Date(unix * 1000).toISOString().slice(0, 10
|
|
|
100
169
|
* task items — the same ones the forge renders.
|
|
101
170
|
*/
|
|
102
171
|
function Tile({ card, who, onOpen, }) {
|
|
172
|
+
const { t, locale } = useI18n();
|
|
103
173
|
const list = steps(card.description);
|
|
104
174
|
const done = list.filter((s) => s.done).length;
|
|
105
175
|
const late = card.dueAt ? card.dueAt * 1000 < Date.now() : false;
|
|
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 }),
|
|
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, locale) })] })) : null, list.length > 0 ? (_jsxs(XStack, { items: "center", gap: "$1", children: [_jsx(ListChecks, { size: 12, "aria-hidden": true }), _jsx(Text, { fontSize: "$1", color: done === list.length ? '$ink' : '$soft', children: t('{done}/{total}', { done: done.toLocaleString(locale), total: list.length.toLocaleString(locale) }) })] })) : null, card.priority && card.priority !== 'none' ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: priorityName(card.priority, t) })) : null, _jsx(YStack, { flex: 1 }), card.assignee ? (_jsx(Face, { src: who?.avatar, emoji: who?.emoji, name: who?.name ?? card.assignee, size: 20 })) : null] })] }) }) }));
|
|
107
177
|
}
|
|
108
178
|
// ── the card, opened ────────────────────────────────────────────────────────
|
|
109
179
|
/**
|
|
@@ -114,6 +184,7 @@ function Tile({ card, who, onOpen, }) {
|
|
|
114
184
|
* field behind them — a cover, a file — are absent rather than drawn and inert.
|
|
115
185
|
*/
|
|
116
186
|
function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
187
|
+
const { t, locale } = useI18n();
|
|
117
188
|
const { client } = useAi();
|
|
118
189
|
const [panel, setPanel] = useState(null);
|
|
119
190
|
const [title, setTitle] = useState(card.title);
|
|
@@ -165,12 +236,12 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
165
236
|
onSaved();
|
|
166
237
|
}
|
|
167
238
|
catch (e) {
|
|
168
|
-
setWrong(e instanceof Error ? e.message : 'The change was refused');
|
|
239
|
+
setWrong(e instanceof Error ? e.message : t('The change was refused'));
|
|
169
240
|
}
|
|
170
241
|
finally {
|
|
171
242
|
setBusy(false);
|
|
172
243
|
}
|
|
173
|
-
}, [client, card.projectKey, card.number, onSaved]);
|
|
244
|
+
}, [client, card.projectKey, card.number, onSaved, t]);
|
|
174
245
|
// TICKING A STEP REWRITES ITS LINE, and only its line — the description is
|
|
175
246
|
// the reader's prose as well as the checklist, so a save that reformatted it
|
|
176
247
|
// would eat what they wrote around the boxes.
|
|
@@ -179,7 +250,7 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
179
250
|
setBody(written);
|
|
180
251
|
void save({ description: written });
|
|
181
252
|
};
|
|
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":
|
|
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": t('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": t(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": t('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: t('Labels'), on: panel === 'labels', onPress: () => setPanel(panel === 'labels' ? null : 'labels') }), _jsx(Act, { icon: Calendar, label: t('Dates'), on: panel === 'dates', onPress: () => setPanel(panel === 'dates' ? null : 'dates') }), _jsx(Act, { icon: UserPlus, label: t('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: t('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: t('None yet.') })), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('A label is a word on the forge issue, and its colour comes from the word — 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: t('Dates') }), _jsxs(XStack, { gap: "$3", flexWrap: "wrap", children: [_jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('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: t('Due') }), _jsx(Text, { render: _jsx("input", { type: "date", value: asInput(card.dueAt), readOnly: true }), ...DATE })] })] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t("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: t('Members') }), people.length === 0 ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('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: t('agent') })) : null, card.assignee === p.name ? _jsx(Check, { size: 14, "aria-hidden": true }) : null] }) }, p.id)))), _jsx(Box, { render: "button", onClick: () => {
|
|
183
254
|
if (!client || busy)
|
|
184
255
|
return;
|
|
185
256
|
setBusy(true);
|
|
@@ -187,16 +258,16 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
187
258
|
.then(onSaved)
|
|
188
259
|
.catch((e) => setWrong(e.message))
|
|
189
260
|
.finally(() => setBusy(false));
|
|
190
|
-
}, p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children:
|
|
261
|
+
}, p: "$2", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t('Take it myself') }) })] })) : null, _jsxs(YStack, { gap: "$2", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Description') }), _jsx(Text, { render: _jsx("textarea", { value: body, onChange: (e) => setBody(e.target.value), onBlur: () => body !== (card.description ?? '') && void save({ description: body }), placeholder: t('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: t('Checklist') }), list.length > 0 ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('{percent}%', { percent: pct.toLocaleString(locale) }) })) : 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) => {
|
|
191
262
|
if (e.key !== 'Enter' || !step.trim())
|
|
192
263
|
return;
|
|
193
264
|
const written = addStep(body, step);
|
|
194
265
|
setBody(written);
|
|
195
266
|
setStep('');
|
|
196
267
|
void save({ description: written });
|
|
197
|
-
}, placeholder:
|
|
198
|
-
?
|
|
199
|
-
: 'Nobody holds this yet — it can still be run, and the run is durable either way.' }), _jsx(Box, { render: "button", onClick: () => {
|
|
268
|
+
}, placeholder: t('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: t('Column') }), _jsxs(Select, { value: card.status, onValueChange: (v) => void save({ status: v }), children: [_jsx(SelectTrigger, { "aria-label": t('Column'), width: 160, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: COLUMNS.map((c) => (_jsx(SelectItem, { value: c.id, children: columnName(c.id, t) ?? c.label }, c.id))) })] })] }), _jsxs(YStack, { gap: "$1", children: [_jsx(Text, { fontSize: "$1", color: "$soft", children: t('Priority') }), _jsxs(Select, { value: card.priority || 'none', onValueChange: (v) => void save({ priority: v }), children: [_jsx(SelectTrigger, { "aria-label": t('Priority'), width: 160, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: PRIORITIES.map((p) => (_jsx(SelectItem, { value: p, children: priorityName(p, t) }, p))) })] })] })] }), _jsxs(YStack, { gap: "$2", pt: "$2", borderTopWidth: 1, borderColor: "$borderColor", children: [_jsx(Text, { fontSize: "$2", fontWeight: "600", color: "$ink", children: t('Durable run') }), run ? (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$2", color: "$ink", children: runStatus(run.status, t) }), _jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 1, children: run.workflowId }), run.historyLength ? (_jsx(Text, { fontSize: "$1", color: "$soft", children: t('{count} events', { count: run.historyLength.toLocaleString(locale) }) })) : null] })) : (_jsxs(XStack, { items: "center", gap: "$2", flexWrap: "wrap", children: [_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, children: card.assignee
|
|
269
|
+
? t('{name} holds this. Hand the work to the engine and it survives a crash.', { name: card.assignee })
|
|
270
|
+
: t('Nobody holds this yet — it can still be run, and the run is durable either way.') }), _jsx(Box, { render: "button", onClick: () => {
|
|
200
271
|
if (!client || starting)
|
|
201
272
|
return;
|
|
202
273
|
setStarting(true);
|
|
@@ -209,7 +280,7 @@ function Detail({ card, people, agents, onClose, onSaved, }) {
|
|
|
209
280
|
.then(setRun)
|
|
210
281
|
.catch((e) => setWrong(e.message))
|
|
211
282
|
.finally(() => setStarting(false));
|
|
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 }),
|
|
283
|
+
}, px: "$2.5", py: "$1.5", rounded: "$2", borderWidth: 1, borderColor: "$borderColor", hoverStyle: { bg: '$hover' }, children: _jsx(Text, { fontSize: "$1", color: "$ink", children: t(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 }), _jsx(Text, { fontSize: "$2", color: "$soft", children: t('{name} has this one.', { name: who.label }) })] })) : null, wrong ? (_jsx(Text, { fontSize: "$1", color: BAD, numberOfLines: 3, children: wrong })) : null] })] }));
|
|
213
284
|
}
|
|
214
285
|
/** A date the sheet shows and does not yet write. */
|
|
215
286
|
const DATE = {
|
|
@@ -233,6 +304,7 @@ const DATE = {
|
|
|
233
304
|
* the day rather than being placed at an hour nobody chose.
|
|
234
305
|
*/
|
|
235
306
|
function Planner({ cards, onOpen }) {
|
|
307
|
+
const { t, locale } = useI18n();
|
|
236
308
|
const [offset, setOffset] = useState(0);
|
|
237
309
|
const day = useMemo(() => {
|
|
238
310
|
const d = new Date();
|
|
@@ -242,10 +314,11 @@ function Planner({ cards, onOpen }) {
|
|
|
242
314
|
}, [offset]);
|
|
243
315
|
const start = Math.floor(day.getTime() / 1000);
|
|
244
316
|
const due = cards.filter((c) => c.dueAt && c.dueAt >= start && c.dueAt < start + DAY);
|
|
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(
|
|
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(locale, { month: 'long' }) }), _jsx(Box, { render: "button", onClick: () => setOffset((n) => n - 1), p: "$1", rounded: "$2", "aria-label": t('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: t('Today') }) }), _jsx(Box, { render: "button", onClick: () => setOffset((n) => n + 1), p: "$1", rounded: "$2", "aria-label": t('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, t, locale) }), _jsx(Text, { fontSize: "$4", fontWeight: "600", color: "$ink", children: day.getDate().toLocaleString(locale) })] }), _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: t('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: _jsx(Text, { fontSize: "$1", color: "$soft", children: hourLabel(hour, t, locale) }) }) }, hour)))] })] }));
|
|
246
318
|
}
|
|
247
319
|
// ── the board ───────────────────────────────────────────────────────────────
|
|
248
320
|
function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
321
|
+
const { t, locale } = useI18n();
|
|
249
322
|
const [over, setOver] = useState(false);
|
|
250
323
|
const [adding, setAdding] = useState(false);
|
|
251
324
|
const [title, setTitle] = useState('');
|
|
@@ -258,7 +331,7 @@ function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
|
258
331
|
const ref = e.dataTransfer.getData('text/plain');
|
|
259
332
|
if (ref)
|
|
260
333
|
onDrop(ref, column.id);
|
|
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) => {
|
|
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: columnName(column.id, t) ?? column.label }), _jsx(Text, { fontSize: "$1", color: "$soft", children: loading ? '' : cards.length.toLocaleString(locale) })] }), _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) => {
|
|
262
335
|
if (e.key === 'Escape') {
|
|
263
336
|
setAdding(false);
|
|
264
337
|
setTitle('');
|
|
@@ -277,11 +350,11 @@ function Column({ column, cards, people, onDrop, onOpen, onAdd, loading, }) {
|
|
|
277
350
|
setAdding(false);
|
|
278
351
|
});
|
|
279
352
|
}
|
|
280
|
-
}, placeholder:
|
|
353
|
+
}, placeholder: t('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",
|
|
281
354
|
// THE WHOLE ROW LIGHTS, not the words — it is a full-width target and
|
|
282
355
|
// a fill is what says so. The tint sits above the column's own
|
|
283
356
|
// ground so the row reads as raised rather than merely tinted.
|
|
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:
|
|
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: t('Add a card') })] }) }))] }) }));
|
|
285
358
|
}
|
|
286
359
|
/** One narrowing, as a box a reader ticks. */
|
|
287
360
|
function Tick({ on, label, onPress, }) {
|
|
@@ -301,19 +374,28 @@ function Tick({ on, label, onPress, }) {
|
|
|
301
374
|
* does not keep.
|
|
302
375
|
*/
|
|
303
376
|
function Filter({ want, labels, onWant, onClose, }) {
|
|
377
|
+
const { t, locale } = useI18n();
|
|
304
378
|
const set = (patch) => onWant({ ...want, ...patch });
|
|
305
379
|
const flipLabel = (l) => {
|
|
306
380
|
const held = want.labels ?? [];
|
|
307
381
|
set({ labels: held.includes(l) ? held.filter((x) => x !== l) : [...held, l] });
|
|
308
382
|
};
|
|
309
383
|
const Head = ({ children }) => (_jsx(Text, { fontSize: "$1", color: "$soft", px: "$2", pt: "$2", children: children }));
|
|
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:
|
|
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: t('Filter') }), _jsx(Box, { render: "button", onClick: onClose, p: "$1", rounded: "$2", "aria-label": t('Close filter'), children: _jsx(X, { size: 14, "aria-hidden": true }) })] }), _jsx(Tick, { on: want.holder === 'none', label: t('Nobody has it'), onPress: () => set({ holder: want.holder === 'none' ? undefined : 'none' }) }), _jsx(Tick, { on: want.holder === 'me', label: t('Mine'), onPress: () => set({ holder: want.holder === 'me' ? undefined : 'me' }) }), _jsx(Head, { children: t('Who did the work') }), _jsx(Tick, { on: want.by === 'person', label: t('A person'), onPress: () => set({ by: want.by === 'person' ? undefined : 'person' }) }), _jsx(Tick, { on: want.by === 'agent', label: t('An agent'), onPress: () => set({ by: want.by === 'agent' ? undefined : 'agent' }) }), _jsx(Head, { children: t('Card status') }), _jsx(Tick, { on: want.state === 'done', label: t('Finished'), onPress: () => set({ state: want.state === 'done' ? undefined : 'done' }) }), _jsx(Tick, { on: want.state === 'open', label: t('Still open'), onPress: () => set({ state: want.state === 'open' ? undefined : 'open' }) }), _jsx(Head, { children: t('Due date') }), [
|
|
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') }) })] }));
|
|
311
395
|
}
|
|
312
396
|
// ── 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.';
|
|
316
397
|
function Cards() {
|
|
398
|
+
const { t, locale } = useI18n();
|
|
317
399
|
const { client } = useAi();
|
|
318
400
|
const { user } = useIam();
|
|
319
401
|
const { currentOrgId } = useOrganizations();
|
|
@@ -366,12 +448,12 @@ function Cards() {
|
|
|
366
448
|
.catch(() => { });
|
|
367
449
|
void readBoard(client, key ? { key } : {}, stop.signal)
|
|
368
450
|
.then((rows) => live && (setCards(rows), setRefused(null)))
|
|
369
|
-
.catch((e) => live && (setCards([]), setRefused(say(e, 'this board'))));
|
|
451
|
+
.catch((e) => live && (setCards([]), setRefused(say(e, t('this board'), 'read', t))));
|
|
370
452
|
return () => {
|
|
371
453
|
live = false;
|
|
372
454
|
stop.abort();
|
|
373
455
|
};
|
|
374
|
-
}, [client, key, nonce]);
|
|
456
|
+
}, [client, key, nonce, t]);
|
|
375
457
|
// THE AGENT NAMES, so "an agent did this" can be answered about a card whose
|
|
376
458
|
// source says `team` but whose holder is a bot — which is what a person filing
|
|
377
459
|
// work and handing it over actually looks like.
|
|
@@ -401,18 +483,18 @@ function Cards() {
|
|
|
401
483
|
if (!n)
|
|
402
484
|
return;
|
|
403
485
|
if (!targetKey)
|
|
404
|
-
return setRefused(NOWHERE);
|
|
486
|
+
return setRefused(t(NOWHERE));
|
|
405
487
|
void edit(client, targetKey, Number(n), { status })
|
|
406
488
|
.then(() => bump((x) => x + 1))
|
|
407
|
-
.catch((e) => setRefused(say(e, 'this card', 'save')));
|
|
408
|
-
}, [client, key, keys]);
|
|
489
|
+
.catch((e) => setRefused(say(e, t('this card'), 'save', t)));
|
|
490
|
+
}, [client, key, keys, t]);
|
|
409
491
|
/**
|
|
410
492
|
* Files a card, and ANSWERS WHETHER IT LANDED.
|
|
411
493
|
*/
|
|
412
494
|
const add = useCallback(async (status, title) => {
|
|
413
495
|
const targetKey = key || keys[0];
|
|
414
496
|
if (!targetKey) {
|
|
415
|
-
setRefused(NOWHERE);
|
|
497
|
+
setRefused(t(NOWHERE));
|
|
416
498
|
return false;
|
|
417
499
|
}
|
|
418
500
|
try {
|
|
@@ -426,13 +508,15 @@ function Cards() {
|
|
|
426
508
|
return true;
|
|
427
509
|
}
|
|
428
510
|
catch (e) {
|
|
429
|
-
setRefused(say(e, 'this card', 'save'));
|
|
511
|
+
setRefused(say(e, t('this card'), 'save', t));
|
|
430
512
|
return false;
|
|
431
513
|
}
|
|
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:
|
|
514
|
+
}, [client, key, keys, t]);
|
|
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: t('Board') }), _jsxs(Select, { value: key || 'all', onValueChange: setKey, children: [_jsx(SelectTrigger, { "aria-label": t('Board'), width: 140, $sm: { width: 100 }, children: _jsx(SelectValue, {}) }), _jsxs(SelectContent, { children: [_jsx(SelectItem, { value: "all", children: t('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
|
|
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,
|
|
434
518
|
// One view at a time: the planner is the other reading of these cards.
|
|
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: [
|
|
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: [_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, minW: 0, children: t('{reason} Cards will appear here when it answers.', { reason: refused }) }), _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: t('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: t('Board'), on: view === 'board', onPress: () => setView('board') }), _jsx(Act, { icon: Calendar, label: t('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: t('A card is a forge issue — 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] }));
|
|
436
520
|
}
|
|
437
521
|
/**
|
|
438
522
|
* The pane, and the session its reads need.
|
package/dist/Boxes.js
CHANGED
|
@@ -19,6 +19,7 @@ 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';
|
|
22
23
|
import { say } from './failure.js';
|
|
23
24
|
import { Play, Plus, Square, X } from 'lucide-react';
|
|
24
25
|
import { ChannelHeader } from '@hanzo/ui/agents';
|
|
@@ -52,15 +53,15 @@ const HOURLY = {
|
|
|
52
53
|
/** Micro-USD as money. Two places, because that is how an hourly rate reads. */
|
|
53
54
|
const usd = (micros) => `$${(micros / 1_000_000).toFixed(2)}`;
|
|
54
55
|
/** Unix seconds to how long is left, or the fact that it is over. */
|
|
55
|
-
const remaining = (expiresAt) => {
|
|
56
|
+
const remaining = (expiresAt, t) => {
|
|
56
57
|
if (!expiresAt)
|
|
57
58
|
return '';
|
|
58
59
|
const left = expiresAt - Math.floor(Date.now() / 1000);
|
|
59
60
|
if (left <= 0)
|
|
60
|
-
return 'expired';
|
|
61
|
+
return t('expired');
|
|
61
62
|
if (left < 3600)
|
|
62
|
-
return
|
|
63
|
-
return
|
|
63
|
+
return t('{count}m left', { count: Math.ceil(left / 60) });
|
|
64
|
+
return t('{hours}h {minutes}m left', { hours: Math.floor(left / 3600), minutes: Math.ceil((left % 3600) / 60) });
|
|
64
65
|
};
|
|
65
66
|
/**
|
|
66
67
|
* Take a new lease.
|
|
@@ -75,6 +76,7 @@ const remaining = (expiresAt) => {
|
|
|
75
76
|
* The rate is stated on the button because taking this lease starts a meter.
|
|
76
77
|
*/
|
|
77
78
|
function Start({ onDone }) {
|
|
79
|
+
const { t } = useI18n();
|
|
78
80
|
const { client } = useAi();
|
|
79
81
|
const [klass, setKlass] = useState('exec');
|
|
80
82
|
const [project, setProject] = useState('');
|
|
@@ -85,7 +87,7 @@ function Start({ onDone }) {
|
|
|
85
87
|
if (!client || busy)
|
|
86
88
|
return;
|
|
87
89
|
if (keeps && !project.trim()) {
|
|
88
|
-
setFailed(
|
|
90
|
+
setFailed(t('A {class} sandbox keeps a disk, so it needs a project to name it.', { class: klass }));
|
|
89
91
|
return;
|
|
90
92
|
}
|
|
91
93
|
setBusy(true);
|
|
@@ -103,8 +105,8 @@ function Start({ onDone }) {
|
|
|
103
105
|
finally {
|
|
104
106
|
setBusy(false);
|
|
105
107
|
}
|
|
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":
|
|
108
|
+
}, [client, busy, keeps, klass, project, onDone, t]);
|
|
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": t('Sandbox class'), width: 200, children: _jsx(SelectValue, {}) }), _jsx(SelectContent, { children: Object.keys(HOURLY).map((c) => (_jsx(SelectItem, { value: c, children: t('{class} — {price}/hr list', { class: c, price: usd(HOURLY[c]) }) }, 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: t('Project — the disk it keeps'), "aria-label": t('Project — the disk it keeps') }), flex: 1, bg: "transparent", borderWidth: 0, outlineStyle: "none", color: "inherit" }) })) : (_jsx(Text, { fontSize: "$1", color: "$soft", flex: 1, children: t('Keeps nothing — 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 ? t('Leasing') : t('Lease') })] }) })] }), failed ? (_jsx(Text, { fontSize: "$1", color: "$soft", numberOfLines: 2, children: failed })) : null] }));
|
|
108
110
|
}
|
|
109
111
|
function Empty({ children }) {
|
|
110
112
|
return (_jsx(YStack, { flex: 1, items: "center", justify: "center", p: "$6", children: _jsx(Text, { fontSize: "$3", color: "$soft", text: "center", children: children }) }));
|
|
@@ -113,10 +115,12 @@ function Act({ icon: Icon, label, onPress, busy, }) {
|
|
|
113
115
|
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 })] }) }));
|
|
114
116
|
}
|
|
115
117
|
function Row({ box, onResume, onStop, onEnd, busy, }) {
|
|
118
|
+
const { t } = useI18n();
|
|
116
119
|
const rate = HOURLY[(box.class ?? 'exec')] ?? HOURLY.exec;
|
|
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}` : ''] }),
|
|
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}` : ''] }), _jsx(Text, { fontSize: "$1", color: "$soft", children: t('{price}/hr list', { price: usd(rate) }) })] }), _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, t) })] }), 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: t('Resume'), onPress: onResume, busy: busy === 'resume' }), _jsx(Act, { icon: Square, label: t('Stop'), onPress: onStop, busy: busy === 'stop' }), _jsx(Act, { icon: X, label: t('End'), onPress: onEnd, busy: busy === 'end' })] })] }));
|
|
118
121
|
}
|
|
119
122
|
export function Boxes() {
|
|
123
|
+
const { t } = useI18n();
|
|
120
124
|
const { client } = useAi();
|
|
121
125
|
// SIGNED IN IS THE CREDENTIAL, NOT THE PROFILE. This gated on `user`, which is
|
|
122
126
|
// the answer to a userinfo REQUEST — and `IamProvider` swallows that request's
|
|
@@ -164,10 +168,10 @@ export function Boxes() {
|
|
|
164
168
|
if (isLoading)
|
|
165
169
|
return _jsx(Empty, { children: "\u00A0" });
|
|
166
170
|
if (!signedIn)
|
|
167
|
-
return _jsx(Empty, { children:
|
|
171
|
+
return _jsx(Empty, { children: t('Sign in to see the compute your org is holding.') });
|
|
168
172
|
if (failed)
|
|
169
|
-
return _jsx(Empty, { children: say(failed, 'this list') });
|
|
173
|
+
return _jsx(Empty, { children: say(failed, t('this list'), 'read', t) });
|
|
170
174
|
if (!boxes)
|
|
171
|
-
return _jsx(Empty, { children:
|
|
172
|
-
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsx(ChannelHeader, { name:
|
|
175
|
+
return _jsx(Empty, { children: t('Reading your leases.') });
|
|
176
|
+
return (_jsxs(YStack, { flex: 1, minH: 0, children: [_jsx(ChannelHeader, { name: t('Sandboxes'), children: _jsx(Text, { fontSize: "$2", color: "$soft", children: t('from {price}/hr', { price: usd(HOURLY.exec) }) }) }), _jsx(Start, { onDone: reload }), boxes.length === 0 ? (_jsx(Empty, { children: t('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))) }))] }));
|
|
173
177
|
}
|