@skillcdn/console 0.1.3 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +7 -6
- package/dist/api.d.ts +4 -3
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +4 -3
- package/dist/api.js.map +1 -1
- package/dist/cli/cli.d.ts +3 -3
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +45 -15
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/credentials.d.ts +1 -1
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +7 -4
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +3 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/terminal.d.ts +0 -5
- package/dist/cli/terminal.d.ts.map +1 -1
- package/dist/cli/terminal.js +0 -43
- package/dist/cli/terminal.js.map +1 -1
- package/dist/client.d.ts +20 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +10 -2
- package/dist/client.js.map +1 -1
- package/dist/components/board.d.ts.map +1 -1
- package/dist/components/board.js +6 -3
- package/dist/components/board.js.map +1 -1
- package/dist/components/connect.d.ts +28 -0
- package/dist/components/connect.d.ts.map +1 -0
- package/dist/components/connect.js +30 -0
- package/dist/components/connect.js.map +1 -0
- package/dist/components/decision-form.d.ts.map +1 -1
- package/dist/components/decision-form.js +4 -1
- package/dist/components/decision-form.js.map +1 -1
- package/dist/components/decision-list.d.ts +4 -0
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +15 -7
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/documents.d.ts +7 -5
- package/dist/components/documents.d.ts.map +1 -1
- package/dist/components/documents.js +28 -16
- package/dist/components/documents.js.map +1 -1
- package/dist/components/event-feed.d.ts +3 -2
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +50 -52
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/people.d.ts +2 -0
- package/dist/components/people.d.ts.map +1 -1
- package/dist/components/people.js +4 -2
- package/dist/components/people.js.map +1 -1
- package/dist/components/projects.d.ts +1 -0
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +16 -10
- package/dist/components/projects.js.map +1 -1
- package/dist/components/runs.d.ts +1 -0
- package/dist/components/runs.d.ts.map +1 -1
- package/dist/components/runs.js +6 -2
- package/dist/components/runs.js.map +1 -1
- package/dist/components/shell.d.ts +32 -1
- package/dist/components/shell.d.ts.map +1 -1
- package/dist/components/shell.js +56 -8
- package/dist/components/shell.js.map +1 -1
- package/dist/components/sign-in.d.ts +3 -0
- package/dist/components/sign-in.d.ts.map +1 -1
- package/dist/components/sign-in.js +3 -9
- package/dist/components/sign-in.js.map +1 -1
- package/dist/components/skills.d.ts.map +1 -1
- package/dist/components/skills.js +8 -12
- package/dist/components/skills.js.map +1 -1
- package/dist/components/task-form.d.ts.map +1 -1
- package/dist/components/task-form.js +5 -2
- package/dist/components/task-form.js.map +1 -1
- package/dist/components/task-view.d.ts +7 -0
- package/dist/components/task-view.d.ts.map +1 -1
- package/dist/components/task-view.js +6 -13
- package/dist/components/task-view.js.map +1 -1
- package/dist/components/tokens.d.ts +12 -0
- package/dist/components/tokens.d.ts.map +1 -1
- package/dist/components/tokens.js +25 -10
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/ui.d.ts +3 -3
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +15 -9
- package/dist/components/ui.js.map +1 -1
- package/dist/connect-page.d.ts +10 -0
- package/dist/connect-page.d.ts.map +1 -0
- package/dist/connect-page.js +67 -0
- package/dist/connect-page.js.map +1 -0
- package/dist/connect.d.ts +11 -0
- package/dist/connect.d.ts.map +1 -0
- package/dist/connect.js +24 -0
- package/dist/connect.js.map +1 -0
- package/dist/console.css +976 -201
- package/dist/console.d.ts +6 -1
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +339 -136
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts +10 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +10 -0
- package/dist/data.js.map +1 -1
- package/dist/docs-page.d.ts +4 -1
- package/dist/docs-page.d.ts.map +1 -1
- package/dist/docs-page.js +74 -54
- package/dist/docs-page.js.map +1 -1
- package/dist/i18n/en.d.ts +473 -0
- package/dist/i18n/en.d.ts.map +1 -0
- package/dist/i18n/en.js +483 -0
- package/dist/i18n/en.js.map +1 -0
- package/dist/i18n/index.d.ts +26 -0
- package/dist/i18n/index.d.ts.map +1 -0
- package/dist/i18n/index.js +46 -0
- package/dist/i18n/index.js.map +1 -0
- package/dist/i18n/ko.d.ts +3 -0
- package/dist/i18n/ko.d.ts.map +1 -0
- package/dist/i18n/ko.js +472 -0
- package/dist/i18n/ko.js.map +1 -0
- package/dist/index.d.ts +5 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -2
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +4 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +4 -0
- package/dist/limits.js.map +1 -1
- package/dist/router.d.ts +88 -11
- package/dist/router.d.ts.map +1 -1
- package/dist/router.js +163 -34
- package/dist/router.js.map +1 -1
- package/dist/routes.d.ts +8 -0
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +14 -0
- package/dist/routes.js.map +1 -1
- package/dist/schemas.d.ts +59 -2
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +55 -9
- package/dist/schemas.js.map +1 -1
- package/dist/use-action.d.ts +2 -1
- package/dist/use-action.d.ts.map +1 -1
- package/dist/use-action.js +7 -3
- package/dist/use-action.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { MAX_BODY_LENGTH, MAX_LINK_LABEL_LENGTH, MAX_LINKS, MAX_TITLE_LENGTH, MAX_URL_LENGTH, TASK_PRIORITIES, TASK_STATES, } from "../api.js";
|
|
4
|
-
import {
|
|
4
|
+
import { useWords } from "../i18n/index.js";
|
|
5
|
+
import { Button } from "./ui.js";
|
|
5
6
|
export function TaskForm(props) {
|
|
7
|
+
const words = useWords();
|
|
8
|
+
const form = words.task.form;
|
|
6
9
|
const { task } = props;
|
|
7
10
|
const [title, setTitle] = useState(task?.title ?? "");
|
|
8
11
|
const [body, setBody] = useState(task?.body ?? "");
|
|
@@ -29,6 +32,6 @@ export function TaskForm(props) {
|
|
|
29
32
|
});
|
|
30
33
|
};
|
|
31
34
|
const parents = (props.parents ?? []).filter((candidate) => candidate.id !== task?.id);
|
|
32
|
-
return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children:
|
|
35
|
+
return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.title }), _jsx("input", { className: "sc-input", value: title, maxLength: MAX_TITLE_LENGTH, required: true, onChange: (event) => setTitle(event.target.value) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.body }), _jsx("textarea", { className: "sc-input sc-textarea", value: body, maxLength: MAX_BODY_LENGTH, rows: 6, placeholder: form.bodyPlaceholder, onChange: (event) => setBody(event.target.value) })] }), _jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.state }), _jsx("select", { className: "sc-input", value: state, onChange: (event) => setState(event.target.value), children: TASK_STATES.map((candidate) => (_jsx("option", { value: candidate, children: words.vocabulary.state[candidate] }, candidate))) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.priority }), _jsx("select", { className: "sc-input", value: priority, onChange: (event) => setPriority(event.target.value), children: TASK_PRIORITIES.map((candidate) => (_jsx("option", { value: candidate, children: words.vocabulary.priority[candidate] }, candidate))) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.assignee }), _jsxs("select", { className: "sc-input", value: assigneeId, onChange: (event) => setAssigneeId(event.target.value), children: [_jsx("option", { value: "", children: words.common.nobody }), props.people.map((person) => (_jsx("option", { value: person.id, children: person.login }, person.id)))] })] }), parents.length > 0 && (_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: form.partOf }), _jsxs("select", { className: "sc-input", value: parentId, onChange: (event) => setParentId(event.target.value), children: [_jsx("option", { value: "", children: words.common.nothing }), parents.map((candidate) => (_jsxs("option", { value: candidate.id, children: ["#", candidate.number, " ", candidate.title] }, candidate.id)))] })] }))] }), _jsxs("fieldset", { className: "sc-field sc-links", children: [_jsx("legend", { className: "sc-field-label", children: form.links }), links.map((link, index) => (_jsxs("div", { className: "sc-link-row", children: [_jsx("input", { className: "sc-input", type: "url", placeholder: "https://", pattern: "https://.*", maxLength: MAX_URL_LENGTH, value: link.url, onChange: (event) => setLinks(links.map((entry, at) => at === index ? { ...entry, url: event.target.value } : entry)) }), _jsx("input", { className: "sc-input", placeholder: form.label, maxLength: MAX_LINK_LABEL_LENGTH, value: link.label, onChange: (event) => setLinks(links.map((entry, at) => at === index ? { ...entry, label: event.target.value } : entry)) }), _jsx(Button, { variant: "ghost", size: "sm", onClick: () => setLinks(links.filter((_, at) => at !== index)), children: words.common.remove })] }, index))), links.length < MAX_LINKS && (_jsx(Button, { variant: "ghost", size: "sm", onClick: () => setLinks([...links, { url: "", label: "" }]), children: form.addLink }))] }), props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), _jsxs("div", { className: "sc-form-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: props.busy === true || title.trim() === "", children: task === undefined ? form.write : words.common.save }), props.onCancel !== undefined && (_jsx(Button, { variant: "ghost", onClick: props.onCancel, children: words.common.cancel }))] })] }));
|
|
33
36
|
}
|
|
34
37
|
//# sourceMappingURL=task-form.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-form.js","sourceRoot":"","sources":["../../src/components/task-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,cAAc,EAId,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"task-form.js","sourceRoot":"","sources":["../../src/components/task-form.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjD,OAAO,EACL,eAAe,EACf,qBAAqB,EACrB,SAAS,EACT,gBAAgB,EAChB,cAAc,EAId,eAAe,EACf,WAAW,GACZ,MAAM,WAAW,CAAC;AACnB,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAqBjC,MAAM,UAAU,QAAQ,CAAC,KAAoB;IAC3C,MAAM,KAAK,GAAG,QAAQ,EAAE,CAAC;IACzB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;IAC7B,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,CAAC;IACvB,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,EAAE,CAAC,CAAC;IACtD,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,IAAI,IAAI,EAAE,CAAC,CAAC;IACnD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,KAAK,IAAI,MAAM,CAAC,CAAC;IAC1D,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,IAAI,EAAE,QAAQ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CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,IAAI,GAC7C,EACR,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,CAC/B,KAAC,MAAM,IAAC,OAAO,EAAC,OAAO,EAAC,OAAO,EAAE,KAAK,CAAC,QAAQ,YAC5C,KAAK,CAAC,MAAM,CAAC,MAAM,GACb,CACV,IACG,IACD,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { RestAnswerInput, RestArtifact, RestDecision, RestDecisionInput, RestDecisionPatch, RestEvent, RestPerson, RestRun, RestTask, RestTaskInput, TaskState } from "../api.js";
|
|
2
|
+
import type { TaskFormKind } from "../router.js";
|
|
2
3
|
export interface TaskViewProps {
|
|
3
4
|
readonly task: RestTask;
|
|
4
5
|
readonly people: readonly RestPerson[];
|
|
@@ -16,6 +17,12 @@ export interface TaskViewProps {
|
|
|
16
17
|
readonly fileHref?: ((artifact: RestArtifact) => string) | undefined;
|
|
17
18
|
/** Where a document of the project is read, by its path, for the links in what was written. */
|
|
18
19
|
readonly docHref?: ((path: string) => string) | undefined;
|
|
20
|
+
/** The form open on the page, if one: the task edited, or a decision raised about it. */
|
|
21
|
+
readonly form?: TaskFormKind | undefined;
|
|
22
|
+
/** Where each form is opened; left out, the forms cannot be opened from here. */
|
|
23
|
+
readonly formHref?: ((form: TaskFormKind) => string) | undefined;
|
|
24
|
+
/** Called when a form is cancelled. */
|
|
25
|
+
readonly onCancel?: (() => void) | undefined;
|
|
19
26
|
readonly busy?: boolean | undefined;
|
|
20
27
|
readonly error?: string | undefined;
|
|
21
28
|
readonly onChange: (task: RestTask, patch: RestTaskInput) => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-view.d.ts","sourceRoot":"","sources":["../../src/components/task-view.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"task-view.d.ts","sourceRoot":"","sources":["../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,QAAQ,CAAC,EAAE,CAAC,CAAC,IAAI,EAAE,YAAY,KAAK,MAAM,CAAC,GAAG,SAAS,CAAC;IACjE,uCAAuC;IACvC,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7C,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,QAAQ,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAClE,QAAQ,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IAC5D,QAAQ,CAAC,eAAe,EAAE,CAAC,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC;IAC7D,QAAQ,CAAC,QAAQ,EAAE,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,eAAe,KAAK,IAAI,CAAC;IAC5E,6DAA6D;IAC7D,QAAQ,CAAC,gBAAgB,CAAC,EACtB,CAAC,CAAC,QAAQ,EAAE,YAAY,EAAE,KAAK,EAAE,iBAAiB,KAAK,IAAI,CAAC,GAC5D,SAAS,CAAC;IACd,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,OAAO,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9D;AAED,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA8M5C"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { useWords } from "../i18n/index.js";
|
|
3
3
|
import { TASK_STATES } from "../vocabulary.js";
|
|
4
4
|
import { DecisionForm } from "./decision-form.js";
|
|
5
5
|
import { DecisionCard } from "./decision-list.js";
|
|
@@ -7,11 +7,10 @@ import { EventFeed } from "./event-feed.js";
|
|
|
7
7
|
import { Markdown } from "./markdown.js";
|
|
8
8
|
import { RunList } from "./runs.js";
|
|
9
9
|
import { TaskForm } from "./task-form.js";
|
|
10
|
-
import {
|
|
10
|
+
import { PersonChip, PriorityBadge, StateBadge, Time } from "./ui.js";
|
|
11
11
|
export function TaskView(props) {
|
|
12
|
+
const words = useWords();
|
|
12
13
|
const { task } = props;
|
|
13
|
-
const [editing, setEditing] = useState(false);
|
|
14
|
-
const [asking, setAsking] = useState(false);
|
|
15
14
|
const parent = task.parentId === null
|
|
16
15
|
? undefined
|
|
17
16
|
: props.tasks.find((candidate) => candidate.id === task.parentId);
|
|
@@ -19,15 +18,9 @@ export function TaskView(props) {
|
|
|
19
18
|
const about = props.decisions.filter((decision) => decision.taskId === task.id);
|
|
20
19
|
const runs = (props.runs ?? []).filter((run) => run.taskId === task.id);
|
|
21
20
|
const tasksById = new Map(props.tasks.map((candidate) => [candidate.id, candidate]));
|
|
22
|
-
if (
|
|
23
|
-
return (_jsxs("div", { className: "sc-task", children: [_jsxs("h1", { className: "sc-task-title", children: [_jsxs("span", { className: "sc-card-number", children: ["#", task.number] }), " ", task.title] }), _jsx(TaskForm, { people: props.people, task: task, parents: props.tasks, busy: props.busy, error: props.error, onSubmit: (input) =>
|
|
24
|
-
props.onChange(task, input);
|
|
25
|
-
setEditing(false);
|
|
26
|
-
}, onCancel: () => setEditing(false) })] }));
|
|
21
|
+
if (props.form === "edit") {
|
|
22
|
+
return (_jsxs("div", { className: "sc-task sc-task-editing", children: [_jsxs("h1", { className: "sc-task-title", children: [_jsxs("span", { className: "sc-card-number", children: ["#", task.number] }), " ", task.title] }), _jsx(TaskForm, { people: props.people, task: task, parents: props.tasks, busy: props.busy, error: props.error, onSubmit: (input) => props.onChange(task, input), onCancel: props.onCancel })] }));
|
|
27
23
|
}
|
|
28
|
-
return (_jsxs("div", { className: "sc-task", children: [_jsxs("header", { className: "sc-task-header", children: [parent !== undefined && (_jsxs("p", { className: "sc-task-parent", children: [
|
|
29
|
-
props.onRaiseDecision(input);
|
|
30
|
-
setAsking(false);
|
|
31
|
-
}, onCancel: () => setAsking(false) })] })), runs.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Runs", children: [_jsx("h2", { className: "sc-section-title", children: "Agents at work" }), _jsx(RunList, { runs: runs, decisionHref: props.decisionHref, fileHref: props.fileHref, docHref: props.docHref, onAbandon: props.onAbandonRun, busy: props.busy })] })), about.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Decisions", children: [_jsx("h2", { className: "sc-section-title", children: "Decisions" }), about.map((decision) => (_jsx(DecisionCard, { decision: decision, task: decision.taskId === null ? undefined : tasksById.get(decision.taskId), docHref: props.docHref, onAnswer: props.onAnswer, onUpdate: props.onUpdateDecision, busy: props.busy }, decision.id)))] })), props.history !== undefined && props.history.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "History", children: [_jsx("h2", { className: "sc-section-title", children: "What happened" }), _jsx(EventFeed, { events: props.history })] })), subtasks.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": "Subtasks", children: [_jsx("h2", { className: "sc-section-title", children: "Part of it" }), _jsx("ul", { className: "sc-subtasks", children: subtasks.map((subtask) => (_jsxs("li", { children: [_jsxs("a", { href: props.taskHref(subtask), children: [_jsxs("span", { className: "sc-card-number", children: ["#", subtask.number] }), " ", subtask.title] }), " ", _jsx(StateBadge, { state: subtask.state })] }, subtask.id))) })] }))] }));
|
|
24
|
+
return (_jsxs("div", { className: "sc-task", children: [_jsxs("header", { className: "sc-task-header", children: [parent !== undefined && (_jsxs("p", { className: "sc-task-parent", children: [words.task.partOf, " ", _jsxs("a", { href: props.taskHref(parent), children: ["#", parent.number, " ", parent.title] })] })), _jsxs("h1", { className: "sc-task-title", children: [_jsxs("span", { className: "sc-card-number", children: ["#", task.number] }), " ", task.title] }), _jsxs("div", { className: "sc-task-badges", children: [_jsx(StateBadge, { state: task.state }), _jsx(PriorityBadge, { priority: task.priority })] })] }), _jsxs("div", { className: "sc-task-body", children: [_jsxs("div", { className: "sc-task-main", children: [props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), task.body.length > 0 ? (_jsx(Markdown, { source: task.body, docHref: props.docHref })) : (_jsx("p", { className: "sc-muted", children: words.task.nothingMore })), task.links.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.links, children: [_jsx("h2", { className: "sc-section-title", children: words.task.links }), _jsx("ul", { className: "sc-link-list", children: task.links.map((link) => (_jsx("li", { children: _jsx("a", { href: link.url, target: "_blank", rel: "noopener noreferrer nofollow", children: link.label ?? link.url }) }, link.url))) })] })), props.form === "ask" && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.raiseDecision, children: [_jsx("h2", { className: "sc-section-title", children: words.task.raiseDecision }), _jsx(DecisionForm, { tasks: props.tasks, taskId: task.id, busy: props.busy, onSubmit: props.onRaiseDecision, onCancel: props.onCancel })] })), runs.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.runs, children: [_jsx("h2", { className: "sc-section-title", children: words.task.agentsAtWork }), _jsx(RunList, { runs: runs, decisionHref: props.decisionHref, fileHref: props.fileHref, docHref: props.docHref, onAbandon: props.onAbandonRun, busy: props.busy })] })), about.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.decisions, children: [_jsx("h2", { className: "sc-section-title", children: words.task.decisions }), about.map((decision) => (_jsx(DecisionCard, { decision: decision, task: decision.taskId === null ? undefined : tasksById.get(decision.taskId), docHref: props.docHref, onAnswer: props.onAnswer, onUpdate: props.onUpdateDecision, busy: props.busy }, decision.id)))] })), props.history !== undefined && props.history.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.history, children: [_jsx("h2", { className: "sc-section-title", children: words.task.history }), _jsx(EventFeed, { events: props.history })] })), subtasks.length > 0 && (_jsxs("section", { className: "sc-task-section", "aria-label": words.task.subtasks, children: [_jsx("h2", { className: "sc-section-title", children: words.task.partOfIt }), _jsx("ul", { className: "sc-subtasks", children: subtasks.map((subtask) => (_jsxs("li", { children: [_jsxs("a", { href: props.taskHref(subtask), children: [_jsxs("span", { className: "sc-card-number", children: ["#", subtask.number] }), " ", subtask.title] }), " ", _jsx(StateBadge, { state: subtask.state })] }, subtask.id))) })] }))] }), _jsxs("aside", { className: "sc-task-aside", "aria-label": words.task.facts, children: [_jsxs("dl", { className: "sc-facts", children: [_jsxs("div", { children: [_jsx("dt", { children: words.task.state }), _jsx("dd", { children: _jsx("select", { className: "sc-input", "aria-label": words.task.state, value: task.state, disabled: props.busy === true, onChange: (event) => props.onMove(task, event.target.value), children: TASK_STATES.map((state) => (_jsx("option", { value: state, children: words.vocabulary.state[state] }, state))) }) })] }), _jsxs("div", { children: [_jsx("dt", { children: words.task.form.priority }), _jsx("dd", { children: words.vocabulary.priority[task.priority] })] }), _jsxs("div", { children: [_jsx("dt", { children: words.task.owner }), _jsx("dd", { children: _jsx(PersonChip, { person: task.owner }) })] }), _jsxs("div", { children: [_jsx("dt", { children: words.task.assignee }), _jsx("dd", { children: task.assignee === null ? (_jsx("span", { className: "sc-muted", children: words.common.nobody })) : (_jsx(PersonChip, { person: task.assignee })) })] }), _jsxs("div", { children: [_jsx("dt", { children: words.task.written }), _jsx("dd", { children: _jsx(Time, { iso: task.createdAt }) })] }), _jsxs("div", { children: [_jsx("dt", { children: words.task.changed }), _jsx("dd", { children: _jsx(Time, { iso: task.updatedAt }) })] })] }), props.formHref !== undefined && (_jsxs("div", { className: "sc-task-actions", children: [_jsx("a", { className: "sc-button sc-button-secondary", href: props.formHref("edit"), children: words.common.edit }), _jsx("a", { className: "sc-button sc-button-secondary", href: props.formHref("ask"), children: words.task.raiseDecision })] }))] })] })] }));
|
|
32
25
|
}
|
|
33
26
|
//# sourceMappingURL=task-view.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"task-view.js","sourceRoot":"","sources":["../../src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AAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAI,GAC1B,IACD,EACN,0BACE,uBAAK,KAAK,CAAC,IAAI,CAAC,OAAO,GAAM,EAC7B,uBACE,KAAC,IAAI,IAAC,GAAG,EAAE,IAAI,CAAC,SAAS,GAAI,GAC1B,IACD,IACH,EACJ,KAAK,CAAC,QAAQ,KAAK,SAAS,IAAI,CAC/B,eAAK,SAAS,EAAC,iBAAiB,aAC9B,YAAG,SAAS,EAAC,+BAA+B,EAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,YACtE,KAAK,CAAC,MAAM,CAAC,IAAI,GAChB,EACJ,YAAG,SAAS,EAAC,+BAA+B,EAAC,IAAI,EAAE,KAAK,CAAC,QAAQ,CAAC,KAAK,CAAC,YACrE,KAAK,CAAC,IAAI,CAAC,aAAa,GACvB,IACA,CACP,IACK,IACJ,IACF,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
2
|
import { type RestToken, type RestTokenInput } from "../api.js";
|
|
3
|
+
/**
|
|
4
|
+
* The spans a form offers: the usual ones, within the most days the workspace allows when it
|
|
5
|
+
* names some, and that limit itself; with a limit there is no "never".
|
|
6
|
+
*/
|
|
7
|
+
export declare function dayChoices(daysAtMost: number | null | undefined): readonly string[];
|
|
3
8
|
export interface TokenListProps {
|
|
4
9
|
readonly tokens: readonly RestToken[];
|
|
5
10
|
/** Called to take a token away. Left out, tokens cannot be removed here. */
|
|
@@ -9,8 +14,15 @@ export interface TokenListProps {
|
|
|
9
14
|
}
|
|
10
15
|
export declare function TokenList(props: TokenListProps): import("react").JSX.Element;
|
|
11
16
|
export interface TokenFormProps {
|
|
17
|
+
/** What the token is called to begin with: what the agent calls itself, for one connecting. */
|
|
18
|
+
readonly name?: string | undefined;
|
|
19
|
+
/** The most days a token may be good for here, or nothing when a person chooses. */
|
|
20
|
+
readonly daysAtMost?: number | null | undefined;
|
|
12
21
|
readonly busy?: boolean | undefined;
|
|
13
22
|
readonly error?: string | undefined;
|
|
23
|
+
/** What the button says; "Make the token" when left out. */
|
|
24
|
+
readonly submitLabel?: string | undefined;
|
|
25
|
+
readonly cancelLabel?: string | undefined;
|
|
14
26
|
readonly onSubmit: (input: RestTokenInput) => void;
|
|
15
27
|
readonly onCancel?: (() => void) | undefined;
|
|
16
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/components/tokens.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../../src/components/tokens.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,SAAS,EAAY,MAAM,OAAO,CAAC;AACjE,OAAO,EAGL,KAAK,SAAS,EACd,KAAK,cAAc,EACpB,MAAM,WAAW,CAAC;AAcnB;;;GAGG;AACH,wBAAgB,UAAU,CAAC,UAAU,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,SAAS,MAAM,EAAE,CAMnF;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,CAAC,MAAM,EAAE,SAAS,SAAS,EAAE,CAAC;IACtC,4EAA4E;IAC5E,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC,GAAG,SAAS,CAAC;IAC7D,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAiD9C;AAED,MAAM,WAAW,cAAc;IAC7B,+FAA+F;IAC/F,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACnC,oFAAoF;IACpF,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IACpC,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACpC,4DAA4D;IAC5D,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1C,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,cAAc,KAAK,IAAI,CAAC;IACnD,QAAQ,CAAC,QAAQ,CAAC,EAAE,CAAC,MAAM,IAAI,CAAC,GAAG,SAAS,CAAC;CAC9C;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,cAAc,+BAgE9C;AAED,MAAM,WAAW,aAAa;IAC5B,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,oEAAoE;IACpE,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,MAAM,EAAE,MAAM,IAAI,CAAC;CAC7B;AAED,mFAAmF;AACnF,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,+BA2C5C"}
|
|
@@ -1,24 +1,37 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useState } from "react";
|
|
3
3
|
import { DEFAULT_TOKEN_DAYS, MAX_TOKEN_NAME_LENGTH, } from "../api.js";
|
|
4
|
+
import { useWords } from "../i18n/index.js";
|
|
4
5
|
import { Button, Callout, Time } from "./ui.js";
|
|
5
|
-
// The tokens a person holds for their agents, scripts and consoles of their own
|
|
6
|
-
// way to make one, and the one just made, whose
|
|
7
|
-
// as props and nothing from the network.
|
|
6
|
+
// The tokens a person holds for their agents, scripts and consoles of their own, shown as the
|
|
7
|
+
// agents that hold them: the list, the way to make one by hand, and the one just made, whose
|
|
8
|
+
// secret is shown this once. Each takes its data as props and nothing from the network.
|
|
8
9
|
/** How long a token may be good for, as the form offers it; `never` for one that does not expire. */
|
|
9
10
|
const DAY_CHOICES = ["30", "90", "180", "365", "never"];
|
|
10
11
|
const DEFAULT_CHOICE = DAY_CHOICES.find((choice) => choice === String(DEFAULT_TOKEN_DAYS)) ?? "90";
|
|
11
|
-
|
|
12
|
-
|
|
12
|
+
/**
|
|
13
|
+
* The spans a form offers: the usual ones, within the most days the workspace allows when it
|
|
14
|
+
* names some, and that limit itself; with a limit there is no "never".
|
|
15
|
+
*/
|
|
16
|
+
export function dayChoices(daysAtMost) {
|
|
17
|
+
if (daysAtMost === null || daysAtMost === undefined) {
|
|
18
|
+
return DAY_CHOICES;
|
|
19
|
+
}
|
|
20
|
+
const within = DAY_CHOICES.filter((choice) => choice !== "never" && Number(choice) < daysAtMost);
|
|
21
|
+
return [...within, String(daysAtMost)];
|
|
22
|
+
}
|
|
13
23
|
export function TokenList(props) {
|
|
24
|
+
const words = useWords().agents;
|
|
14
25
|
if (props.tokens.length === 0) {
|
|
15
26
|
return _jsx(_Fragment, { children: props.empty ?? null });
|
|
16
27
|
}
|
|
17
|
-
return (_jsx("ul", { className: "sc-token-list", "aria-label":
|
|
28
|
+
return (_jsx("ul", { className: "sc-token-list", "aria-label": words.list, children: props.tokens.map((token) => (_jsxs("li", { className: "sc-token", children: [_jsxs("div", { children: [_jsx("p", { className: "sc-token-name", children: token.name }), _jsxs("p", { className: "sc-token-meta", children: [_jsxs("span", { children: [words.connected, " ", _jsx(Time, { iso: token.createdAt })] }), _jsx("span", { children: token.expiresAt === null ? (words.doesNotExpire) : (_jsxs(_Fragment, { children: [words.goodUntil, " ", _jsx(Time, { iso: token.expiresAt })] })) }), _jsx("span", { children: token.lastUsedAt === null ? (words.notActive) : (_jsxs(_Fragment, { children: [words.lastActive, " ", _jsx(Time, { iso: token.lastUsedAt })] })) })] })] }), props.onRevoke !== undefined && (_jsx(Button, { variant: "danger", size: "sm", disabled: props.busy === true, onClick: () => props.onRevoke?.(token), children: words.disconnect }))] }, token.id))) }));
|
|
18
29
|
}
|
|
19
30
|
export function TokenForm(props) {
|
|
20
|
-
const
|
|
21
|
-
const
|
|
31
|
+
const words = useWords();
|
|
32
|
+
const choices = dayChoices(props.daysAtMost);
|
|
33
|
+
const [name, setName] = useState(props.name ?? "");
|
|
34
|
+
const [choice, setChoice] = useState(choices.includes(DEFAULT_CHOICE) ? DEFAULT_CHOICE : (choices.at(-1) ?? DEFAULT_CHOICE));
|
|
22
35
|
const submit = (event) => {
|
|
23
36
|
event.preventDefault();
|
|
24
37
|
props.onSubmit({
|
|
@@ -26,10 +39,12 @@ export function TokenForm(props) {
|
|
|
26
39
|
expiresInDays: choice === "never" ? null : Number(choice),
|
|
27
40
|
});
|
|
28
41
|
};
|
|
29
|
-
return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children:
|
|
42
|
+
return (_jsxs("form", { className: "sc-form", onSubmit: submit, children: [_jsxs("div", { className: "sc-field-row", children: [_jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.agents.form.name }), _jsx("input", { className: "sc-input", value: name, maxLength: MAX_TOKEN_NAME_LENGTH, required: true, placeholder: words.agents.form.namePlaceholder, onChange: (event) => setName(event.target.value) })] }), _jsxs("label", { className: "sc-field", children: [_jsx("span", { className: "sc-field-label", children: words.agents.form.goodFor }), _jsx("select", { className: "sc-input", value: choice, onChange: (event) => setChoice(event.target.value), children: choices.map((option) => (_jsx("option", { value: option, children: option === "never" ? words.agents.doesNotExpire : words.agents.form.days(option) }, option))) })] })] }), props.error !== undefined && (_jsx("p", { className: "sc-form-error", role: "alert", children: props.error })), _jsxs("div", { className: "sc-form-actions", children: [_jsx(Button, { type: "submit", variant: "primary", disabled: props.busy === true || name.trim() === "", children: props.submitLabel ?? words.agents.form.make }), props.onCancel !== undefined && (_jsx(Button, { variant: "ghost", onClick: props.onCancel, disabled: props.busy === true, children: props.cancelLabel ?? words.common.cancel }))] })] }));
|
|
30
43
|
}
|
|
31
44
|
/** The token just made, with its secret shown this once and the way to copy it. */
|
|
32
45
|
export function NewToken(props) {
|
|
46
|
+
const words = useWords();
|
|
47
|
+
const fresh = words.agents.fresh;
|
|
33
48
|
const [copied, setCopied] = useState(false);
|
|
34
49
|
const copy = () => {
|
|
35
50
|
if (typeof navigator === "undefined" || navigator.clipboard === undefined) {
|
|
@@ -37,6 +52,6 @@ export function NewToken(props) {
|
|
|
37
52
|
}
|
|
38
53
|
void navigator.clipboard.writeText(props.secret).then(() => setCopied(true), () => setCopied(false));
|
|
39
54
|
};
|
|
40
|
-
return (_jsxs(Callout, { tone: "warning", title:
|
|
55
|
+
return (_jsxs(Callout, { tone: "warning", title: fresh.ready(props.token.name), action: _jsx(Button, { size: "sm", variant: "ghost", onClick: props.onDone, children: words.common.done }), children: [_jsx("p", { children: fresh.copyNow }), _jsxs("p", { className: "sc-secret", children: [_jsx("code", { className: "sc-secret-value", children: props.secret }), _jsx(Button, { size: "sm", onClick: copy, children: copied ? fresh.copied : fresh.copy })] }), _jsxs("p", { children: [fresh.useIt, " ", props.token.expiresAt === null ? (fresh.removeWhenDone) : (_jsxs(_Fragment, { children: [fresh.goodUntilBefore, " ", _jsx(Time, { iso: props.token.expiresAt }), fresh.goodUntilAfter] }))] })] }));
|
|
41
56
|
}
|
|
42
57
|
//# sourceMappingURL=tokens.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../../src/components/tokens.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkC,QAAQ,EAAE,MAAM,OAAO,CAAC;AACjE,OAAO,EACL,kBAAkB,EAClB,qBAAqB,GAGtB,MAAM,W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,GAAG,EAChB,KAAK,CAAC,KAAK,CAAC,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAChC,KAAK,CAAC,cAAc,CACrB,CAAC,CAAC,CAAC,CACF,8BACG,KAAK,CAAC,eAAe,OAAE,KAAC,IAAI,IAAC,GAAG,EAAE,KAAK,CAAC,KAAK,CAAC,SAAS,GAAI,EAC3D,KAAK,CAAC,cAAc,IACpB,CACJ,IACC,IACI,CACX,CAAC;AACJ,CAAC"}
|
package/dist/components/ui.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ export declare function PersonChip(props: {
|
|
|
29
29
|
readonly person: RestPerson;
|
|
30
30
|
readonly size?: "sm" | "md";
|
|
31
31
|
}): import("react").JSX.Element;
|
|
32
|
-
/** The words of the vocabulary as people read them. */
|
|
32
|
+
/** The words of the vocabulary as people read them, in English: the default pack's. */
|
|
33
33
|
export declare const STATE_LABELS: Readonly<Record<TaskState, string>>;
|
|
34
34
|
export declare const PRIORITY_LABELS: Readonly<Record<TaskPriority, string>>;
|
|
35
35
|
export declare const ROLE_LABELS: Readonly<Record<PersonRole, string>>;
|
|
@@ -51,8 +51,8 @@ export declare function EmptyState(props: {
|
|
|
51
51
|
readonly body?: string;
|
|
52
52
|
readonly action?: ReactNode;
|
|
53
53
|
}): import("react").JSX.Element;
|
|
54
|
-
/** An instant as people read one: the date, and the time of day. */
|
|
55
|
-
export declare function formatInstant(iso: string): string;
|
|
54
|
+
/** An instant as people read one in a language: the date, and the time of day. */
|
|
55
|
+
export declare function formatInstant(iso: string, language?: string): string;
|
|
56
56
|
/** A size in bytes as people read one: `12 B`, `3.4 KB`, `120 MB`. */
|
|
57
57
|
export declare function formatBytes(size: number): string;
|
|
58
58
|
export declare function Time(props: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.d.ts","sourceRoot":"","sources":["../../src/components/ui.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,SAAS,EAAE,MAAM,OA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AAED,kFAAkF;AAClF,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAYpE;AAED,sEAAsE;AACtE,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAUhD;AAED,wBAAgB,IAAI,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAA;CAAE,+BAOnD"}
|
package/dist/components/ui.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useLanguage, useWords } from "../i18n/index.js";
|
|
2
3
|
// Small building blocks. Each one is a class in styles/console.css and nothing more. Classes
|
|
3
|
-
// are prefixed `sc-` so that a custom console's own styles never collide with them.
|
|
4
|
+
// are prefixed `sc-` so that a custom console's own styles never collide with them. The words
|
|
5
|
+
// come from the language the page is in (ADR-0012).
|
|
4
6
|
export function cx(...names) {
|
|
5
7
|
return names.filter(Boolean).join(" ");
|
|
6
8
|
}
|
|
@@ -31,7 +33,7 @@ export function Avatar(props) {
|
|
|
31
33
|
export function PersonChip(props) {
|
|
32
34
|
return (_jsxs("span", { className: "sc-person", title: props.person.name ?? props.person.login, children: [_jsx(Avatar, { person: props.person, size: props.size ?? "sm" }), _jsx("span", { className: "sc-person-login", children: props.person.login })] }));
|
|
33
35
|
}
|
|
34
|
-
/** The words of the vocabulary as people read them. */
|
|
36
|
+
/** The words of the vocabulary as people read them, in English: the default pack's. */
|
|
35
37
|
export const STATE_LABELS = {
|
|
36
38
|
idea: "Idea",
|
|
37
39
|
ready: "Ready",
|
|
@@ -51,9 +53,11 @@ export const ROLE_LABELS = {
|
|
|
51
53
|
member: "Member",
|
|
52
54
|
};
|
|
53
55
|
export function RoleBadge(props) {
|
|
54
|
-
|
|
56
|
+
const words = useWords();
|
|
57
|
+
return (_jsx(Badge, { tone: props.role === "admin" ? "point" : "neutral", children: words.vocabulary.role[props.role] }));
|
|
55
58
|
}
|
|
56
59
|
export function StateBadge(props) {
|
|
60
|
+
const words = useWords();
|
|
57
61
|
const tone = props.state === "done"
|
|
58
62
|
? "success"
|
|
59
63
|
: props.state === "dropped"
|
|
@@ -61,14 +65,15 @@ export function StateBadge(props) {
|
|
|
61
65
|
: props.state === "in_progress" || props.state === "in_review"
|
|
62
66
|
? "accent"
|
|
63
67
|
: "neutral";
|
|
64
|
-
return _jsx(Badge, { tone: tone, children:
|
|
68
|
+
return _jsx(Badge, { tone: tone, children: words.vocabulary.state[props.state] });
|
|
65
69
|
}
|
|
66
70
|
export function PriorityBadge(props) {
|
|
71
|
+
const words = useWords();
|
|
67
72
|
if (props.priority === "normal") {
|
|
68
73
|
return null;
|
|
69
74
|
}
|
|
70
75
|
const tone = props.priority === "urgent" ? "danger" : props.priority === "high" ? "point" : "neutral";
|
|
71
|
-
return _jsx(Badge, { tone: tone, children:
|
|
76
|
+
return _jsx(Badge, { tone: tone, children: words.vocabulary.priority[props.priority] });
|
|
72
77
|
}
|
|
73
78
|
export function Spinner(props) {
|
|
74
79
|
return (_jsxs("span", { className: "sc-spinner", role: "status", children: [_jsx("span", { className: "sc-spinner-ring", "aria-hidden": "true" }), _jsx("span", { className: "sc-visually-hidden", children: props.label })] }));
|
|
@@ -77,13 +82,13 @@ export function Spinner(props) {
|
|
|
77
82
|
export function EmptyState(props) {
|
|
78
83
|
return (_jsxs("div", { className: "sc-empty", children: [_jsx("p", { className: "sc-empty-title", children: props.title }), props.body !== undefined && _jsx("p", { className: "sc-empty-body", children: props.body }), props.action !== undefined && _jsx("div", { className: "sc-empty-action", children: props.action })] }));
|
|
79
84
|
}
|
|
80
|
-
/** An instant as people read one: the date, and the time of day. */
|
|
81
|
-
export function formatInstant(iso) {
|
|
85
|
+
/** An instant as people read one in a language: the date, and the time of day. */
|
|
86
|
+
export function formatInstant(iso, language) {
|
|
82
87
|
const date = new Date(iso);
|
|
83
88
|
if (Number.isNaN(date.getTime())) {
|
|
84
89
|
return iso;
|
|
85
90
|
}
|
|
86
|
-
return date.toLocaleString(
|
|
91
|
+
return date.toLocaleString(language, {
|
|
87
92
|
year: "numeric",
|
|
88
93
|
month: "short",
|
|
89
94
|
day: "numeric",
|
|
@@ -104,6 +109,7 @@ export function formatBytes(size) {
|
|
|
104
109
|
return `${mb < 10 ? mb.toFixed(1) : Math.round(mb)} MB`;
|
|
105
110
|
}
|
|
106
111
|
export function Time(props) {
|
|
107
|
-
|
|
112
|
+
const { tag } = useLanguage();
|
|
113
|
+
return (_jsx("time", { className: "sc-time", dateTime: props.iso, children: formatInstant(props.iso, tag) }));
|
|
108
114
|
}
|
|
109
115
|
//# sourceMappingURL=ui.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/components/ui.tsx"],"names":[],"mappings":";
|
|
1
|
+
{"version":3,"file":"ui.js","sourceRoot":"","sources":["../../src/components/ui.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAEzD,6FAA6F;AAC7F,8FAA8F;AAC9F,oDAAoD;AAEpD,MAAM,UAAU,EAAE,CAAC,GAAG,KAAqC;IACzD,OAAO,KAAK,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,UAAU,MAAM,CACpB,KAGC;IAED,MAAM,EAAE,OAAO,GAAG,WAAW,EAAE,IAAI,GAAG,IAAI,EAAE,SAAS,EAAE,IAAI,GAAG,QAAQ,EAAE,GAAG,IAAI,EAAE,GAAG,KAAK,CAAC;IAC1F,OAAO,CACL,oBACM,IAAI,EACR,IAAI,EAAE,IAAI,EACV,SAAS,EAAE,EAAE,CACX,WAAW,EACX,aAAa,OAAO,EAAE,EACtB,IAAI,KAAK,IAAI,IAAI,cAAc,EAC/B,SAAS,CACV,GACD,CACH,CAAC;AACJ,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AE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;IAC1D,CAAC;IACD,MAAM,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;IACrB,OAAO,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC;AAC1D,CAAC;AAED,MAAM,UAAU,IAAI,CAAC,KAA+B;IAClD,MAAM,EAAE,GAAG,EAAE,GAAG,WAAW,EAAE,CAAC;IAC9B,OAAO,CACL,eAAM,SAAS,EAAC,SAAS,EAAC,QAAQ,EAAE,KAAK,CAAC,GAAG,YAC1C,aAAa,CAAC,KAAK,CAAC,GAAG,EAAE,GAAG,CAAC,GACzB,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { ConsoleData } from "./data.js";
|
|
2
|
+
import { type Navigation } from "./router.js";
|
|
3
|
+
export interface ConnectPageProps {
|
|
4
|
+
/** The code in the address, as typed or followed, or nothing. */
|
|
5
|
+
readonly code: string | undefined;
|
|
6
|
+
readonly data: ConsoleData;
|
|
7
|
+
readonly navigation: Navigation;
|
|
8
|
+
}
|
|
9
|
+
export declare function ConnectPage(props: ConnectPageProps): import("react").JSX.Element;
|
|
10
|
+
//# sourceMappingURL=connect-page.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"connect-page.d.ts","sourceRoot":"","sources":["../src/connect-page.tsx"],"names":[],"mappings":"AASA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAE7C,OAAO,EAAe,KAAK,UAAU,EAAS,MAAM,aAAa,CAAC;AAOlE,MAAM,WAAW,gBAAgB;IAC/B,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAC3B,QAAQ,CAAC,UAAU,EAAE,UAAU,CAAC;CACjC;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,gBAAgB,+BA0HlD"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useEffect, useState } from "react";
|
|
3
|
+
import { ApiError, normalizeConnectCode, } from "./api.js";
|
|
4
|
+
import { ConnectApproval, ConnectCodeForm } from "./components/connect.js";
|
|
5
|
+
import { Callout, Spinner } from "./components/ui.js";
|
|
6
|
+
import { useWords } from "./i18n/index.js";
|
|
7
|
+
import { connectHref, PATHS } from "./router.js";
|
|
8
|
+
import { useAction } from "./use-action.js";
|
|
9
|
+
export function ConnectPage(props) {
|
|
10
|
+
const words = useWords().connect;
|
|
11
|
+
const { data, navigation } = props;
|
|
12
|
+
const code = props.code === undefined ? undefined : normalizeConnectCode(props.code);
|
|
13
|
+
const [request, setRequest] = useState(undefined);
|
|
14
|
+
const [problem, setProblem] = useState(undefined);
|
|
15
|
+
const [outcome, setOutcome] = useState(undefined);
|
|
16
|
+
const { busy, error, act } = useAction();
|
|
17
|
+
const { connectRequest } = data.actions;
|
|
18
|
+
// What asks under the code, read once the page is on one.
|
|
19
|
+
useEffect(() => {
|
|
20
|
+
setRequest(undefined);
|
|
21
|
+
setProblem(undefined);
|
|
22
|
+
setOutcome(undefined);
|
|
23
|
+
if (code === undefined) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
const controller = new AbortController();
|
|
27
|
+
connectRequest(code, controller.signal)
|
|
28
|
+
.then((found) => {
|
|
29
|
+
if (!controller.signal.aborted) {
|
|
30
|
+
setRequest(found);
|
|
31
|
+
}
|
|
32
|
+
})
|
|
33
|
+
.catch((failure) => {
|
|
34
|
+
if (controller.signal.aborted) {
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
setProblem(failure instanceof ApiError && failure.code === "connect.not_found"
|
|
38
|
+
? words.noSuchCode
|
|
39
|
+
: failure instanceof ApiError
|
|
40
|
+
? failure.message
|
|
41
|
+
: words.couldNotAsk);
|
|
42
|
+
});
|
|
43
|
+
return () => controller.abort();
|
|
44
|
+
}, [code, connectRequest, words]);
|
|
45
|
+
const head = (_jsx("div", { className: "sc-page-head", children: _jsx("h1", { className: "sc-page-title", children: words.title }) }));
|
|
46
|
+
const ask = (_jsxs(_Fragment, { children: [_jsx("p", { className: "sc-lead", children: words.lead }), _jsx("section", { className: "sc-panel", "aria-label": words.aria, children: _jsx(ConnectCodeForm, { busy: busy, onSubmit: (typed) => navigation.go(connectHref(typed)) }) })] }));
|
|
47
|
+
if (outcome === "approved" && request !== undefined) {
|
|
48
|
+
return (_jsxs(_Fragment, { children: [head, _jsx(Callout, { tone: "info", title: words.approved.title(request.agent), children: _jsxs("p", { children: [words.approved.body, " ", _jsx("a", { href: PATHS.agents, children: words.approved.agentsPage })] }) })] }));
|
|
49
|
+
}
|
|
50
|
+
if (outcome === "denied") {
|
|
51
|
+
return (_jsxs(_Fragment, { children: [head, _jsx(Callout, { tone: "info", title: words.denied.title, children: _jsx("p", { children: words.denied.body }) }), ask] }));
|
|
52
|
+
}
|
|
53
|
+
if (code === undefined || problem !== undefined) {
|
|
54
|
+
return (_jsxs(_Fragment, { children: [head, props.code !== undefined && code === undefined && (_jsx(Callout, { tone: "warning", children: words.notACode })), problem !== undefined && _jsx(Callout, { tone: "warning", children: problem }), ask] }));
|
|
55
|
+
}
|
|
56
|
+
if (request === undefined) {
|
|
57
|
+
return (_jsxs(_Fragment, { children: [head, _jsx("div", { className: "sc-loading", children: _jsx(Spinner, { label: words.lookingUp }) })] }));
|
|
58
|
+
}
|
|
59
|
+
return (_jsxs(_Fragment, { children: [head, _jsx(ConnectApproval, { request: request, daysAtMost: data.me?.workspace.tokenDaysAtMost, busy: busy, error: error, onApprove: (input) => void act(async () => {
|
|
60
|
+
await data.actions.approveConnection(code, input);
|
|
61
|
+
setOutcome("approved");
|
|
62
|
+
}), onDeny: () => void act(async () => {
|
|
63
|
+
await data.actions.denyConnection(code);
|
|
64
|
+
setOutcome("denied");
|
|
65
|
+
}) })] }));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=connect-page.js.map
|