@skillcdn/console 0.5.0 → 0.5.2
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 +87 -12
- package/SKILLCDN.md +3 -3
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +7 -6
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +9 -7
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +8 -6
- package/dist/api.js.map +1 -1
- package/dist/charts.d.ts +103 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +182 -0
- package/dist/charts.js.map +1 -0
- package/dist/cli/cli.d.ts +58 -2
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +1742 -472
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command-words.d.ts +20 -0
- package/dist/cli/command-words.d.ts.map +1 -0
- package/dist/cli/command-words.js +51 -0
- package/dist/cli/command-words.js.map +1 -0
- package/dist/cli/credentials.d.ts +54 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +126 -20
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/directory.d.ts +19 -4
- package/dist/cli/directory.d.ts.map +1 -1
- package/dist/cli/directory.js +16 -8
- package/dist/cli/directory.js.map +1 -1
- package/dist/cli/format.d.ts +70 -9
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +267 -40
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +13 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +101 -58
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/machine-check.d.ts +36 -0
- package/dist/cli/machine-check.d.ts.map +1 -0
- package/dist/cli/machine-check.js +151 -0
- package/dist/cli/machine-check.js.map +1 -0
- package/dist/cli/main.js +76 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -60
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -270
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-check.d.ts +42 -0
- package/dist/cli/plugin-check.d.ts.map +1 -1
- package/dist/cli/plugin-check.js +221 -36
- package/dist/cli/plugin-check.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts +6 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +21 -4
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/plugin-main.js +1 -0
- package/dist/cli/plugin-main.js.map +1 -1
- package/dist/cli/runner-host.d.ts +7 -0
- package/dist/cli/runner-host.d.ts.map +1 -1
- package/dist/cli/runner-host.js +2 -0
- package/dist/cli/runner-host.js.map +1 -1
- package/dist/cli/secret-notes.d.ts +8 -0
- package/dist/cli/secret-notes.d.ts.map +1 -0
- package/dist/cli/secret-notes.js +48 -0
- package/dist/cli/secret-notes.js.map +1 -0
- package/dist/cli/serve.d.ts +33 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +252 -3
- package/dist/cli/serve.js.map +1 -1
- package/dist/client.d.ts +54 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +77 -80
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +164 -8
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +588 -151
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/agents.d.ts.map +1 -1
- package/dist/components/agents.js +1 -1
- package/dist/components/agents.js.map +1 -1
- package/dist/components/board.d.ts.map +1 -1
- package/dist/components/board.js +3 -2
- package/dist/components/board.js.map +1 -1
- package/dist/components/categories.js +1 -1
- package/dist/components/categories.js.map +1 -1
- package/dist/components/charts.d.ts +157 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +182 -0
- package/dist/components/charts.js.map +1 -0
- package/dist/components/decision-list.d.ts.map +1 -1
- package/dist/components/decision-list.js +1 -1
- package/dist/components/decision-list.js.map +1 -1
- package/dist/components/desk-records.d.ts +102 -0
- package/dist/components/desk-records.d.ts.map +1 -0
- package/dist/components/desk-records.js +221 -0
- package/dist/components/desk-records.js.map +1 -0
- package/dist/components/desk.d.ts +85 -0
- package/dist/components/desk.d.ts.map +1 -0
- package/dist/components/desk.js +135 -0
- package/dist/components/desk.js.map +1 -0
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +7 -3
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/goals.d.ts +2 -0
- package/dist/components/goals.d.ts.map +1 -1
- package/dist/components/goals.js +1 -1
- package/dist/components/goals.js.map +1 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +14 -6
- package/dist/components/home.js.map +1 -1
- package/dist/components/icon.d.ts +31 -0
- package/dist/components/icon.d.ts.map +1 -0
- package/dist/components/icon.js +169 -0
- package/dist/components/icon.js.map +1 -0
- package/dist/components/markdown.d.ts +6 -0
- package/dist/components/markdown.d.ts.map +1 -1
- package/dist/components/markdown.js +10 -2
- package/dist/components/markdown.js.map +1 -1
- package/dist/components/people.js +1 -1
- package/dist/components/people.js.map +1 -1
- package/dist/components/plugin-frame.d.ts.map +1 -1
- package/dist/components/plugin-frame.js +7 -0
- package/dist/components/plugin-frame.js.map +1 -1
- package/dist/components/plugin-settings.d.ts.map +1 -1
- package/dist/components/plugin-settings.js +54 -3
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts +17 -4
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +51 -12
- package/dist/components/projects.js.map +1 -1
- package/dist/components/rules.d.ts +8 -10
- package/dist/components/rules.d.ts.map +1 -1
- package/dist/components/rules.js +35 -13
- package/dist/components/rules.js.map +1 -1
- package/dist/components/sessions.d.ts.map +1 -1
- package/dist/components/sessions.js +3 -2
- package/dist/components/sessions.js.map +1 -1
- package/dist/components/setup.d.ts +9 -3
- package/dist/components/setup.d.ts.map +1 -1
- package/dist/components/setup.js +12 -6
- package/dist/components/setup.js.map +1 -1
- package/dist/components/shell.d.ts.map +1 -1
- package/dist/components/shell.js +3 -2
- package/dist/components/shell.js.map +1 -1
- package/dist/components/tokens.js +1 -1
- package/dist/components/tokens.js.map +1 -1
- package/dist/components/ui.d.ts +5 -2
- package/dist/components/ui.d.ts.map +1 -1
- package/dist/components/ui.js +10 -7
- package/dist/components/ui.js.map +1 -1
- package/dist/connect-page.js +1 -1
- package/dist/connect-page.js.map +1 -1
- package/dist/console.css +1172 -106
- package/dist/console.d.ts +5 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +52 -39
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +32 -33
- package/dist/data.js.map +1 -1
- package/dist/desk-page.d.ts +38 -0
- package/dist/desk-page.d.ts.map +1 -0
- package/dist/desk-page.js +184 -0
- package/dist/desk-page.js.map +1 -0
- package/dist/desk-records-page.d.ts +18 -0
- package/dist/desk-records-page.d.ts.map +1 -0
- package/dist/desk-records-page.js +130 -0
- package/dist/desk-records-page.js.map +1 -0
- package/dist/desk-records.d.ts +247 -0
- package/dist/desk-records.d.ts.map +1 -0
- package/dist/desk-records.js +543 -0
- package/dist/desk-records.js.map +1 -0
- package/dist/desk.d.ts +122 -0
- package/dist/desk.d.ts.map +1 -0
- package/dist/desk.js +211 -0
- package/dist/desk.js.map +1 -0
- package/dist/feed-stream.d.ts +39 -0
- package/dist/feed-stream.d.ts.map +1 -0
- package/dist/feed-stream.js +117 -0
- package/dist/feed-stream.js.map +1 -0
- package/dist/home-tiles.d.ts +19 -3
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +147 -42
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +228 -6
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +309 -9
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +366 -85
- package/dist/i18n/ko.js.map +1 -1
- package/dist/i18n/particles.d.ts +7 -0
- package/dist/i18n/particles.d.ts.map +1 -0
- package/dist/i18n/particles.js +72 -0
- package/dist/i18n/particles.js.map +1 -0
- package/dist/icons/glyphs.d.ts +605 -0
- package/dist/icons/glyphs.d.ts.map +1 -0
- package/dist/icons/glyphs.js +104 -0
- package/dist/icons/glyphs.js.map +1 -0
- package/dist/icons/index.d.ts +59 -0
- package/dist/icons/index.d.ts.map +1 -0
- package/dist/icons/index.js +157 -0
- package/dist/icons/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +20 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +20 -0
- package/dist/limits.js.map +1 -1
- package/dist/marks.d.ts +9 -0
- package/dist/marks.d.ts.map +1 -1
- package/dist/marks.js +9 -0
- package/dist/marks.js.map +1 -1
- package/dist/onboarding.d.ts +6 -0
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +5 -5
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/context.d.ts +42 -11
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +2 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +2 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/manifest.d.ts +13 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +30 -3
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +55 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +37 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/plugin/sandbox.d.ts.map +1 -1
- package/dist/plugin/sandbox.js +4 -1
- package/dist/plugin/sandbox.js.map +1 -1
- package/dist/plugin/testing.d.ts +6 -2
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +52 -10
- package/dist/plugin/testing.js.map +1 -1
- package/dist/plugin/web.d.ts +3 -0
- package/dist/plugin/web.d.ts.map +1 -1
- package/dist/plugin/web.js +5 -1
- package/dist/plugin/web.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/records.d.ts +283 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +543 -0
- package/dist/records.js.map +1 -0
- package/dist/routes.d.ts +3 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +3 -1
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +30 -11
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +98 -45
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +32 -21
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/awake.d.ts +35 -0
- package/dist/runner/awake.d.ts.map +1 -0
- package/dist/runner/awake.js +95 -0
- package/dist/runner/awake.js.map +1 -0
- package/dist/runner/claude.d.ts +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +100 -18
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +20 -17
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/config.d.ts +5 -0
- package/dist/runner/config.d.ts.map +1 -1
- package/dist/runner/config.js +9 -0
- package/dist/runner/config.js.map +1 -1
- package/dist/runner/desk.d.ts +43 -2
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +168 -13
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/process.d.ts.map +1 -1
- package/dist/runner/process.js +11 -4
- package/dist/runner/process.js.map +1 -1
- package/dist/runner/redact.d.ts +39 -4
- package/dist/runner/redact.d.ts.map +1 -1
- package/dist/runner/redact.js +81 -5
- package/dist/runner/redact.js.map +1 -1
- package/dist/runner/runner.d.ts +28 -3
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +371 -54
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/slack.d.ts.map +1 -1
- package/dist/runner/slack.js +10 -4
- package/dist/runner/slack.js.map +1 -1
- package/dist/runner/task-scheduler.d.ts +20 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -1
- package/dist/runner/task-scheduler.js +34 -4
- package/dist/runner/task-scheduler.js.map +1 -1
- package/dist/runner/types.d.ts +51 -1
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js +26 -0
- package/dist/runner/types.js.map +1 -1
- package/dist/runner.d.ts +6 -6
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +5 -5
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +603 -6
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +156 -20
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +22 -5
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +41 -17
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +17 -4
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +48 -41
- package/dist/setup-guide.js.map +1 -1
- package/dist/tokens.d.ts.map +1 -1
- package/dist/tokens.js +5 -1
- package/dist/tokens.js.map +1 -1
- package/dist/vocabulary.d.ts +21 -3
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +19 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +73 -44
- package/docs/specs/plugins.md +40 -22
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +30 -21
- package/docs/specs/runner.md +46 -22
- package/package.json +11 -2
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-plugin/SKILL.md +6 -6
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +41 -4
- package/skills/deploying-a-console/references/running-it-again.md +3 -2
- package/skills/keeping-a-desk/SKILL.md +133 -0
- package/skills/keeping-a-desk/collections.md +96 -0
- package/skills/planning-the-board/SKILL.md +14 -18
- package/skills/planning-the-board/references/a-task.md +2 -2
- package/skills/planning-the-board/references/project-rules.md +13 -14
- package/skills/planning-the-board/references/setting-up.md +15 -13
- package/skills/running-an-agent/SKILL.md +47 -56
- package/skills/working-the-board/SKILL.md +63 -44
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +12 -10
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +16 -2
- package/src/api.ts +109 -3
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +2226 -580
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +181 -20
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +332 -49
- package/src/cli/help.ts +113 -57
- package/src/cli/machine-check.ts +223 -0
- package/src/cli/main.ts +72 -2
- package/src/cli/pack.ts +333 -372
- package/src/cli/plugin-check.ts +275 -34
- package/src/cli/plugin-cli.ts +28 -4
- package/src/cli/plugin-main.ts +1 -0
- package/src/cli/runner-host.ts +8 -0
- package/src/cli/secret-notes.ts +63 -0
- package/src/cli/serve.ts +295 -2
- package/src/client.ts +215 -177
- package/src/components/agent-page.tsx +1044 -281
- package/src/components/agents.tsx +9 -5
- package/src/components/board.tsx +3 -15
- package/src/components/categories.tsx +2 -2
- package/src/components/charts.tsx +680 -0
- package/src/components/decision-list.tsx +11 -7
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +12 -3
- package/src/components/goals.tsx +33 -25
- package/src/components/home.tsx +42 -6
- package/src/components/icon.tsx +337 -0
- package/src/components/markdown.tsx +22 -2
- package/src/components/people.tsx +1 -1
- package/src/components/plugin-frame.tsx +7 -0
- package/src/components/plugin-settings.tsx +171 -12
- package/src/components/projects.tsx +68 -17
- package/src/components/rules.tsx +94 -34
- package/src/components/sessions.tsx +2 -13
- package/src/components/setup.tsx +20 -5
- package/src/components/shell.tsx +3 -20
- package/src/components/tokens.tsx +1 -1
- package/src/components/ui.tsx +16 -8
- package/src/connect-page.tsx +1 -1
- package/src/console.tsx +104 -62
- package/src/data.ts +37 -34
- package/src/desk-page.tsx +332 -0
- package/src/desk-records-page.tsx +256 -0
- package/src/desk-records.ts +808 -0
- package/src/desk.ts +329 -0
- package/src/feed-stream.ts +144 -0
- package/src/home-tiles.ts +170 -46
- package/src/i18n/en.ts +323 -11
- package/src/i18n/ko.ts +378 -87
- package/src/i18n/particles.ts +79 -0
- package/src/icons/glyphs.ts +112 -0
- package/src/icons/index.ts +195 -0
- package/src/index.ts +125 -0
- package/src/limits.ts +20 -0
- package/src/marks.ts +12 -0
- package/src/onboarding.ts +14 -6
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +38 -2
- package/src/plugin/rest-schemas.ts +41 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin/web.ts +9 -2
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/routes.ts +3 -1
- package/src/rules.ts +108 -47
- package/src/runner/acp.ts +49 -30
- package/src/runner/awake.ts +135 -0
- package/src/runner/claude.ts +131 -26
- package/src/runner/codex.ts +37 -26
- package/src/runner/config.ts +9 -0
- package/src/runner/desk.ts +200 -15
- package/src/runner/process.ts +11 -4
- package/src/runner/redact.ts +92 -6
- package/src/runner/runner.ts +457 -56
- package/src/runner/slack.ts +10 -4
- package/src/runner/task-scheduler.ts +36 -4
- package/src/runner/types.ts +67 -1
- package/src/runner.ts +27 -2
- package/src/schemas.ts +177 -18
- package/src/services.ts +55 -16
- package/src/setup-guide.ts +49 -40
- package/src/styles/README.md +16 -5
- package/src/styles/base.css +17 -0
- package/src/styles/console.css +10 -0
- package/src/styles/drawn-by-pages.json +1 -1
- package/src/styles/pages/agents.css +103 -1
- package/src/styles/pages/board.css +0 -10
- package/src/styles/pages/calendar.css +1 -1
- package/src/styles/pages/connect.css +0 -10
- package/src/styles/pages/decisions.css +3 -1
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +5 -0
- package/src/styles/pages/feed.css +5 -2
- package/src/styles/pages/home.css +5 -0
- package/src/styles/pages/roadmap.css +2 -2
- package/src/styles/pages/settings.css +11 -0
- package/src/styles/pages/task.css +0 -20
- package/src/styles/pages/thread.css +1 -1
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/calendar.css +1 -1
- package/src/styles/parts/callout.css +1 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/detail.css +22 -0
- package/src/styles/parts/empty.css +2 -0
- package/src/styles/parts/eyebrow.css +1 -1
- package/src/styles/parts/facts.css +1 -1
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/form.css +2 -1
- package/src/styles/parts/icon.css +191 -0
- package/src/styles/parts/input.css +14 -4
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/mark.css +36 -0
- package/src/styles/parts/menu.css +1 -7
- package/src/styles/parts/page.css +1 -1
- package/src/styles/parts/panel.css +10 -0
- package/src/styles/parts/person.css +5 -2
- package/src/styles/parts/progress.css +5 -2
- package/src/styles/parts/rows.css +1 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/settings.css +5 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/tokens.css +31 -10
- package/src/tokens.ts +5 -1
- package/src/vocabulary.ts +25 -3
- package/template/desk-web/README.md +8 -0
- package/template/desk-web/index.html +13 -0
- package/template/desk-web/package.json +25 -0
- package/template/desk-web/src/main.tsx +24 -0
- package/template/desk-web/src/page.tsx +51 -0
- package/template/desk-web/tsconfig.json +16 -0
- package/template/desk-web/vite.config.ts +15 -0
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
RestPluginEnableInput,
|
|
13
13
|
RestPluginGrant,
|
|
14
14
|
RestPluginGrantInput,
|
|
15
|
+
RestPluginJob,
|
|
15
16
|
RestPluginSetting,
|
|
16
17
|
RestProject,
|
|
17
18
|
RestTeam,
|
|
@@ -122,6 +123,10 @@ export function PluginSettingsList(props: PluginSettingsListProps) {
|
|
|
122
123
|
</span>
|
|
123
124
|
</a>
|
|
124
125
|
<span className="sc-task-row-meta">
|
|
126
|
+
{/* A plugin that runs with something wrong in it, a job that keeps failing say (ADR-0128). */}
|
|
127
|
+
{plugin.problems.length > 0 && plugin.state !== "failed" && (
|
|
128
|
+
<Badge tone="danger">{settings.hasProblems}</Badge>
|
|
129
|
+
)}
|
|
125
130
|
<Badge tone={STATE_TONES[plugin.state]}>
|
|
126
131
|
{words.vocabulary.pluginState[plugin.state] ?? plugin.state}
|
|
127
132
|
</Badge>
|
|
@@ -194,6 +199,32 @@ function TickRow(props: {
|
|
|
194
199
|
);
|
|
195
200
|
}
|
|
196
201
|
|
|
202
|
+
/**
|
|
203
|
+
* How a job stands, in a line (ADR-0128): when it last ran and how that went, since when it has
|
|
204
|
+
* failed where it failed more than once running, and when it runs next.
|
|
205
|
+
*/
|
|
206
|
+
function jobStanding(
|
|
207
|
+
settings: Messages["plugins"]["settings"],
|
|
208
|
+
job: RestPluginJob,
|
|
209
|
+
language: string,
|
|
210
|
+
): string {
|
|
211
|
+
const parts: string[] = [];
|
|
212
|
+
if (job.lastRunAt === null || job.lastOutcome === null) {
|
|
213
|
+
parts.push(settings.jobNotRun);
|
|
214
|
+
} else if (job.lastOutcome === "ok") {
|
|
215
|
+
parts.push(settings.jobRan(formatInstant(job.lastRunAt, language)));
|
|
216
|
+
} else {
|
|
217
|
+
parts.push(settings.jobFailed(formatInstant(job.lastRunAt, language)));
|
|
218
|
+
if (job.failedSince !== null && job.failedSince !== job.lastRunAt) {
|
|
219
|
+
parts.push(settings.jobFailingSince(formatInstant(job.failedSince, language)));
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
if (job.nextAt !== null) {
|
|
223
|
+
parts.push(settings.jobNext(formatInstant(job.nextAt, language)));
|
|
224
|
+
}
|
|
225
|
+
return parts.join(" \u00b7 ");
|
|
226
|
+
}
|
|
227
|
+
|
|
197
228
|
/** What the plugin is on and holds, a row each; nothing where there is nothing to say yet. */
|
|
198
229
|
function Overview(props: {
|
|
199
230
|
readonly detail: RestPluginDetail;
|
|
@@ -311,6 +342,26 @@ function Overview(props: {
|
|
|
311
342
|
),
|
|
312
343
|
});
|
|
313
344
|
}
|
|
345
|
+
// The jobs as the scheduler keeps them (ADR-0128); a console before 0.5.1 names none.
|
|
346
|
+
if (detail.jobs !== undefined && detail.jobs.length > 0) {
|
|
347
|
+
rows.push({
|
|
348
|
+
key: "jobs",
|
|
349
|
+
name: settings.jobs,
|
|
350
|
+
value: (
|
|
351
|
+
<ul className="sc-plugin-held">
|
|
352
|
+
{detail.jobs.map((job) => (
|
|
353
|
+
<li key={job.name}>
|
|
354
|
+
<span className="sc-plugin-tick-name">
|
|
355
|
+
<code>{job.name}</code>
|
|
356
|
+
{job.lastOutcome === "failed" && <Badge tone="danger">{settings.jobFailing}</Badge>}
|
|
357
|
+
</span>
|
|
358
|
+
<span className="sc-plugin-tick-under"> {jobStanding(settings, job, language)}</span>
|
|
359
|
+
</li>
|
|
360
|
+
))}
|
|
361
|
+
</ul>
|
|
362
|
+
),
|
|
363
|
+
});
|
|
364
|
+
}
|
|
314
365
|
if (detail.operations.length > 0) {
|
|
315
366
|
rows.push({
|
|
316
367
|
key: "operations",
|
|
@@ -790,7 +841,11 @@ function SettingsForm(props: {
|
|
|
790
841
|
*/
|
|
791
842
|
function secretStanding(
|
|
792
843
|
settings: Messages["plugins"]["settings"],
|
|
793
|
-
setting:
|
|
844
|
+
setting: {
|
|
845
|
+
readonly setAt: string | null;
|
|
846
|
+
readonly source?: string | null | undefined;
|
|
847
|
+
readonly expiresAt?: string | null | undefined;
|
|
848
|
+
},
|
|
794
849
|
language: string,
|
|
795
850
|
): string {
|
|
796
851
|
const when = formatInstant(setting.setAt ?? "", language);
|
|
@@ -879,6 +934,96 @@ function SecretRow(props: {
|
|
|
879
934
|
);
|
|
880
935
|
}
|
|
881
936
|
|
|
937
|
+
/**
|
|
938
|
+
* A secret kept per key (ADR-0111): how many keys hold a value of how many it may keep, each key
|
|
939
|
+
* on a line with how its value stands and the way to remove it, and a key and a value to set one
|
|
940
|
+
* by hand. The values are never shown; the keys are no secret.
|
|
941
|
+
*/
|
|
942
|
+
function KeyedSecretRow(props: {
|
|
943
|
+
readonly setting: RestPluginSetting;
|
|
944
|
+
readonly language: string;
|
|
945
|
+
readonly busy: boolean;
|
|
946
|
+
readonly onSet: (key: string, value: string) => void;
|
|
947
|
+
readonly onRemove: (key: string) => void;
|
|
948
|
+
}) {
|
|
949
|
+
const words = useWords();
|
|
950
|
+
const settings = words.plugins.settings;
|
|
951
|
+
const [key, setKey] = useState("");
|
|
952
|
+
const [value, setValue] = useState("");
|
|
953
|
+
const id = useId();
|
|
954
|
+
const { setting } = props;
|
|
955
|
+
const keys = setting.keys ?? [];
|
|
956
|
+
const max = setting.keyed?.max ?? keys.length;
|
|
957
|
+
return (
|
|
958
|
+
<div className="sc-settings-row">
|
|
959
|
+
<div>
|
|
960
|
+
<label className="sc-settings-label" htmlFor={id}>
|
|
961
|
+
{pluginWord(setting.name, props.language)}
|
|
962
|
+
</label>
|
|
963
|
+
<p className="sc-settings-hint">
|
|
964
|
+
{keys.length === 0 ? settings.secretKeysNone : settings.secretKeys(keys.length, max)}
|
|
965
|
+
</p>
|
|
966
|
+
{setting.hosts !== null && setting.hosts !== undefined && setting.hosts.length > 0 && (
|
|
967
|
+
<p className="sc-settings-hint">{settings.secretHosts(setting.hosts.join(", "))}</p>
|
|
968
|
+
)}
|
|
969
|
+
{setting.description !== null && (
|
|
970
|
+
<p className="sc-settings-hint">{pluginWord(setting.description, props.language)}</p>
|
|
971
|
+
)}
|
|
972
|
+
</div>
|
|
973
|
+
<div className="sc-settings-control">
|
|
974
|
+
{keys.map((kept) => (
|
|
975
|
+
<div key={kept.key} className="sc-plugin-line">
|
|
976
|
+
<div>
|
|
977
|
+
<code className="sc-project-key">{kept.key}</code>
|
|
978
|
+
<p className="sc-settings-hint">{secretStanding(settings, kept, props.language)}</p>
|
|
979
|
+
</div>
|
|
980
|
+
<Button
|
|
981
|
+
variant="ghost"
|
|
982
|
+
size="sm"
|
|
983
|
+
disabled={props.busy}
|
|
984
|
+
aria-label={settings.secretKeyRemove(kept.key)}
|
|
985
|
+
onClick={() => props.onRemove(kept.key)}
|
|
986
|
+
>
|
|
987
|
+
{words.common.remove}
|
|
988
|
+
</Button>
|
|
989
|
+
</div>
|
|
990
|
+
))}
|
|
991
|
+
<input
|
|
992
|
+
id={id}
|
|
993
|
+
className="sc-input"
|
|
994
|
+
autoComplete="off"
|
|
995
|
+
spellCheck={false}
|
|
996
|
+
placeholder={settings.secretKeyNew}
|
|
997
|
+
aria-label={settings.secretKeyNew}
|
|
998
|
+
value={key}
|
|
999
|
+
onChange={(event) => setKey(event.target.value)}
|
|
1000
|
+
/>
|
|
1001
|
+
<div className="sc-plugin-line">
|
|
1002
|
+
<input
|
|
1003
|
+
className="sc-input sc-plugin-line-input"
|
|
1004
|
+
type="password"
|
|
1005
|
+
autoComplete="off"
|
|
1006
|
+
placeholder={settings.secretNew}
|
|
1007
|
+
aria-label={settings.secretNew}
|
|
1008
|
+
value={value}
|
|
1009
|
+
onChange={(event) => setValue(event.target.value)}
|
|
1010
|
+
/>
|
|
1011
|
+
<Button
|
|
1012
|
+
disabled={props.busy || key.trim().length === 0 || value.length === 0}
|
|
1013
|
+
onClick={() => {
|
|
1014
|
+
props.onSet(key.trim(), value);
|
|
1015
|
+
setKey("");
|
|
1016
|
+
setValue("");
|
|
1017
|
+
}}
|
|
1018
|
+
>
|
|
1019
|
+
{words.common.save}
|
|
1020
|
+
</Button>
|
|
1021
|
+
</div>
|
|
1022
|
+
</div>
|
|
1023
|
+
</div>
|
|
1024
|
+
);
|
|
1025
|
+
}
|
|
1026
|
+
|
|
882
1027
|
/**
|
|
883
1028
|
* Enabling: the capabilities the plugin requires, on and not the administrator's to turn off, and
|
|
884
1029
|
* those it can go without, off until chosen, those consented to before on already (ADR-0060); the
|
|
@@ -1508,7 +1653,10 @@ export function PluginSettingsView(props: PluginSettingsViewProps) {
|
|
|
1508
1653
|
<p className="sc-lead">{pluginWord(detail.description, language)}</p>
|
|
1509
1654
|
{error !== undefined && <Callout tone="danger">{error}</Callout>}
|
|
1510
1655
|
{detail.problems.length > 0 && (
|
|
1511
|
-
<Callout
|
|
1656
|
+
<Callout
|
|
1657
|
+
tone="danger"
|
|
1658
|
+
title={detail.state === "failed" ? settings.problems : settings.problemsRunning}
|
|
1659
|
+
>
|
|
1512
1660
|
<ul className="sc-plugin-problems">
|
|
1513
1661
|
{detail.problems.map((problem) => (
|
|
1514
1662
|
<li key={problem}>{problem}</li>
|
|
@@ -1564,16 +1712,27 @@ export function PluginSettingsView(props: PluginSettingsViewProps) {
|
|
|
1564
1712
|
/>
|
|
1565
1713
|
{detail.settings
|
|
1566
1714
|
.filter((setting) => setting.type === "secret")
|
|
1567
|
-
.map((setting) =>
|
|
1568
|
-
|
|
1569
|
-
|
|
1570
|
-
|
|
1571
|
-
|
|
1572
|
-
|
|
1573
|
-
|
|
1574
|
-
|
|
1575
|
-
|
|
1576
|
-
|
|
1715
|
+
.map((setting) =>
|
|
1716
|
+
setting.keyed !== null && setting.keyed !== undefined ? (
|
|
1717
|
+
<KeyedSecretRow
|
|
1718
|
+
key={setting.key}
|
|
1719
|
+
setting={setting}
|
|
1720
|
+
language={language}
|
|
1721
|
+
busy={busy}
|
|
1722
|
+
onSet={(key, value) => change(() => plugin.setSecret(setting.key, value, key))}
|
|
1723
|
+
onRemove={(key) => change(() => plugin.removeSecret(setting.key, key))}
|
|
1724
|
+
/>
|
|
1725
|
+
) : (
|
|
1726
|
+
<SecretRow
|
|
1727
|
+
key={setting.key}
|
|
1728
|
+
setting={setting}
|
|
1729
|
+
language={language}
|
|
1730
|
+
busy={busy}
|
|
1731
|
+
onSet={(value) => change(() => plugin.setSecret(setting.key, value))}
|
|
1732
|
+
onRemove={() => change(() => plugin.removeSecret(setting.key))}
|
|
1733
|
+
/>
|
|
1734
|
+
),
|
|
1735
|
+
)}
|
|
1577
1736
|
</div>
|
|
1578
1737
|
</section>
|
|
1579
1738
|
)}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
|
-
import { type FormEvent, type ReactNode, useEffect,
|
|
1
|
+
import { type FormEvent, type ReactNode, useEffect, useState } from "react";
|
|
2
2
|
import {
|
|
3
3
|
COLOR_NAMES,
|
|
4
4
|
type ColorName,
|
|
5
|
+
type IconName,
|
|
5
6
|
MAX_PROJECT_DESCRIPTION_LENGTH,
|
|
7
|
+
MAX_PROJECT_ICON_BYTES,
|
|
6
8
|
MAX_PROJECT_KEY_LENGTH,
|
|
7
9
|
MAX_PROJECT_NAME_LENGTH,
|
|
8
10
|
MAX_PROJECT_SYMBOL_LENGTH,
|
|
@@ -13,6 +15,7 @@ import {
|
|
|
13
15
|
type ProjectRole,
|
|
14
16
|
type ProjectVisibility,
|
|
15
17
|
projectColorOf,
|
|
18
|
+
projectGlyphOf,
|
|
16
19
|
projectIconPath,
|
|
17
20
|
projectSymbolOf,
|
|
18
21
|
type RestMember,
|
|
@@ -23,13 +26,15 @@ import {
|
|
|
23
26
|
type RestProjectPatch,
|
|
24
27
|
} from "../api.js";
|
|
25
28
|
import { useWords } from "../i18n/index.js";
|
|
29
|
+
import { Icon, IconPicker } from "./icon.js";
|
|
26
30
|
import { Picker } from "./picker.js";
|
|
27
31
|
import { peopleSearch } from "./searches.js";
|
|
28
32
|
import { Badge, Button, cx, PersonChip, PersonOption, personName, Time } from "./ui.js";
|
|
29
33
|
|
|
30
34
|
/**
|
|
31
|
-
* A project's mark: its symbol on its colour, so that projects tell apart at a glance
|
|
32
|
-
*
|
|
35
|
+
* A project's mark: its symbol on its colour, so that projects tell apart at a glance, or an
|
|
36
|
+
* icon of the pack in the symbol's place where it names one (ADR-0142); its own image over
|
|
37
|
+
* either where it has one, so that the mark is never empty while the image loads.
|
|
33
38
|
*/
|
|
34
39
|
export function ProjectMark(props: {
|
|
35
40
|
readonly project: {
|
|
@@ -37,7 +42,9 @@ export function ProjectMark(props: {
|
|
|
37
42
|
readonly name: string;
|
|
38
43
|
readonly color: ColorName | null;
|
|
39
44
|
readonly symbol: string | null;
|
|
40
|
-
/** The
|
|
45
|
+
/** The icon of the pack shown in the symbol's place, by its name, where the project names one. */
|
|
46
|
+
readonly glyph?: string | null | undefined;
|
|
47
|
+
/** The project's own image, when it has one; the symbol or the icon on the colour otherwise. */
|
|
41
48
|
readonly icon?: { readonly sha256: string } | null | undefined;
|
|
42
49
|
};
|
|
43
50
|
readonly size?: "sm" | "md" | "lg";
|
|
@@ -53,6 +60,7 @@ export function ProjectMark(props: {
|
|
|
53
60
|
const [shown, setShown] = useState<string | undefined>(undefined);
|
|
54
61
|
const [failed, setFailed] = useState<string | undefined>(undefined);
|
|
55
62
|
const pictured = src !== undefined && failed !== src;
|
|
63
|
+
const glyph = projectGlyphOf(props.project);
|
|
56
64
|
return (
|
|
57
65
|
<span
|
|
58
66
|
className={cx(
|
|
@@ -63,7 +71,8 @@ export function ProjectMark(props: {
|
|
|
63
71
|
)}
|
|
64
72
|
aria-hidden="true"
|
|
65
73
|
>
|
|
66
|
-
{(!pictured || shown !== src) &&
|
|
74
|
+
{(!pictured || shown !== src) &&
|
|
75
|
+
(glyph === undefined ? projectSymbolOf(props.project) : <Icon name={glyph} />)}
|
|
67
76
|
{pictured && (
|
|
68
77
|
<img
|
|
69
78
|
className="sc-mark-image"
|
|
@@ -127,6 +136,20 @@ export function keyOf(name: string): string {
|
|
|
127
136
|
.slice(0, MAX_PROJECT_KEY_LENGTH);
|
|
128
137
|
}
|
|
129
138
|
|
|
139
|
+
/**
|
|
140
|
+
* What a save says of a project's icon: the one chosen where the form changed it, and nothing
|
|
141
|
+
* where it did not. A console older than the field refuses nothing it was not sent, a project
|
|
142
|
+
* that never had an icon is sent none, and an icon this page's pack does not have, one of a
|
|
143
|
+
* newer console's, which the form shows as none, stays the project's when something else is
|
|
144
|
+
* saved.
|
|
145
|
+
*/
|
|
146
|
+
export function glyphChange(
|
|
147
|
+
before: IconName | null,
|
|
148
|
+
chosen: IconName | null,
|
|
149
|
+
): { readonly glyph?: IconName | null } {
|
|
150
|
+
return chosen === before ? {} : { glyph: chosen };
|
|
151
|
+
}
|
|
152
|
+
|
|
130
153
|
export function ProjectForm(props: ProjectFormProps) {
|
|
131
154
|
const words = useWords();
|
|
132
155
|
const form = words.projects.form;
|
|
@@ -139,20 +162,40 @@ export function ProjectForm(props: ProjectFormProps) {
|
|
|
139
162
|
const [skillsAddress, setSkillsAddress] = useState(project?.skillsAddress ?? "");
|
|
140
163
|
const [color, setColor] = useState<ColorName | "">(project?.color ?? "");
|
|
141
164
|
const [symbol, setSymbol] = useState(project?.symbol ?? "");
|
|
165
|
+
/** The icon the project has, where this page's pack has it: what the form begins with, and what a save is held against. */
|
|
166
|
+
const glyphBefore: IconName | null =
|
|
167
|
+
project === undefined ? null : (projectGlyphOf(project) ?? null);
|
|
168
|
+
const [glyph, setGlyph] = useState<IconName | null>(glyphBefore);
|
|
142
169
|
/** The image for the mark: a file chosen, `null` for none any more, nothing to keep the project's. */
|
|
143
170
|
const [icon, setIcon] = useState<File | null | undefined>(undefined);
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
171
|
+
// The image chosen, as an address the mark can show before it is saved: the file's own bytes,
|
|
172
|
+
// read here. The pages' policy lets an image come from the console or from a `data:` address
|
|
173
|
+
// and from nowhere else, so an address of the browser's own for the file (`blob:`) is refused
|
|
174
|
+
// and the mark would stay its symbol. A file larger than an icon may be is not read: the
|
|
175
|
+
// console refuses it when the form is sent.
|
|
176
|
+
const [chosenSrc, setChosenSrc] = useState<string | undefined>(undefined);
|
|
177
|
+
useEffect(() => {
|
|
178
|
+
setChosenSrc(undefined);
|
|
179
|
+
if (
|
|
180
|
+
!(icon instanceof File) ||
|
|
181
|
+
icon.size > MAX_PROJECT_ICON_BYTES ||
|
|
182
|
+
typeof FileReader === "undefined"
|
|
183
|
+
) {
|
|
184
|
+
return;
|
|
185
|
+
}
|
|
186
|
+
const reader = new FileReader();
|
|
187
|
+
reader.onload = () => {
|
|
188
|
+
if (typeof reader.result === "string") {
|
|
189
|
+
setChosenSrc(reader.result);
|
|
152
190
|
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
|
|
191
|
+
};
|
|
192
|
+
reader.readAsDataURL(icon);
|
|
193
|
+
// Another file chosen, or the form gone, before this one was read: its answer is dropped.
|
|
194
|
+
return () => {
|
|
195
|
+
reader.onload = null;
|
|
196
|
+
reader.abort();
|
|
197
|
+
};
|
|
198
|
+
}, [icon]);
|
|
156
199
|
const kept = icon === undefined ? (project?.icon ?? null) : null;
|
|
157
200
|
/** The mark as it will be, from what is typed and chosen so far. */
|
|
158
201
|
const preview = {
|
|
@@ -160,6 +203,7 @@ export function ProjectForm(props: ProjectFormProps) {
|
|
|
160
203
|
name: name.trim() === "" ? "?" : name.trim(),
|
|
161
204
|
color: color === "" ? null : color,
|
|
162
205
|
symbol: symbol.trim() === "" ? null : symbol.trim(),
|
|
206
|
+
glyph,
|
|
163
207
|
icon: icon instanceof File ? { sha256: "chosen" } : kept,
|
|
164
208
|
};
|
|
165
209
|
|
|
@@ -172,6 +216,7 @@ export function ProjectForm(props: ProjectFormProps) {
|
|
|
172
216
|
skillsAddress: skillsAddress.trim() === "" ? null : skillsAddress.trim(),
|
|
173
217
|
color: preview.color,
|
|
174
218
|
symbol: preview.symbol,
|
|
219
|
+
...glyphChange(glyphBefore, glyph),
|
|
175
220
|
};
|
|
176
221
|
props.onSubmit(
|
|
177
222
|
project === undefined ? { key: key.trim(), ...settings, name: name.trim() } : settings,
|
|
@@ -261,6 +306,10 @@ export function ProjectForm(props: ProjectFormProps) {
|
|
|
261
306
|
</div>
|
|
262
307
|
<div className="sc-field-row sc-mark-row">
|
|
263
308
|
<ProjectMark project={preview} size="lg" iconSrc={chosenSrc} />
|
|
309
|
+
<div className="sc-field">
|
|
310
|
+
<span className="sc-field-label">{form.icon}</span>
|
|
311
|
+
<IconPicker value={glyph} label={form.icon} onChange={setGlyph} />
|
|
312
|
+
</div>
|
|
264
313
|
<label className="sc-field">
|
|
265
314
|
<span className="sc-field-label">{form.symbol}</span>
|
|
266
315
|
<input
|
|
@@ -400,7 +449,9 @@ export function MemberList(props: MemberListProps) {
|
|
|
400
449
|
{member.person.name ?? ""}
|
|
401
450
|
<span className="sc-muted">
|
|
402
451
|
{" "}
|
|
403
|
-
{members.since
|
|
452
|
+
{members.since.before}
|
|
453
|
+
<Time iso={member.addedAt} />
|
|
454
|
+
{members.since.after}
|
|
404
455
|
</span>
|
|
405
456
|
</span>
|
|
406
457
|
{props.onChangeRole === undefined || member.person.role === "admin" ? (
|
package/src/components/rules.tsx
CHANGED
|
@@ -1,23 +1,24 @@
|
|
|
1
1
|
import { type FormEvent, useState } from "react";
|
|
2
|
-
import { fillRules,
|
|
2
|
+
import { fillRules, MAX_RULES_LENGTH, type RestRules } from "../api.js";
|
|
3
3
|
import { useLanguage, useWords } from "../i18n/index.js";
|
|
4
4
|
import { Writer } from "./documents.js";
|
|
5
5
|
import { Markdown } from "./markdown.js";
|
|
6
6
|
import { Button, Callout, Time } from "./ui.js";
|
|
7
7
|
|
|
8
|
-
// The rules of the board (ADR-0023), as the settings pages show them
|
|
9
|
-
//
|
|
10
|
-
//
|
|
11
|
-
//
|
|
12
|
-
//
|
|
8
|
+
// The rules of the board (ADR-0023, ADR-0120), as the settings pages show them. At the
|
|
9
|
+
// workspace: the console's rules as they hold, read and never edited, and below them what the
|
|
10
|
+
// organization adds, with who wrote it and when, and the ways to change it for whoever may. At
|
|
11
|
+
// a project: what it adds, or that it adds none. Each takes its data as props and nothing from
|
|
12
|
+
// the network; the rules are Markdown rendered to elements, never HTML, with `{language}`
|
|
13
|
+
// filled with the language the pages speak, as the command fills it with the person's.
|
|
13
14
|
|
|
14
15
|
export interface RulesViewProps {
|
|
15
16
|
readonly rules: RestRules;
|
|
16
17
|
/** Whose rules: the workspace's, or a project's, which add to the workspace's. */
|
|
17
18
|
readonly scope: "workspace" | "project";
|
|
18
|
-
/** Where
|
|
19
|
+
/** Where what is added is written; left out, the rules are read here and not changed. */
|
|
19
20
|
readonly editHref?: string | undefined;
|
|
20
|
-
/** Called to put
|
|
21
|
+
/** Called to put what is added away; left out, it stays. */
|
|
21
22
|
readonly onArchive?: (() => void) | undefined;
|
|
22
23
|
readonly busy?: boolean | undefined;
|
|
23
24
|
/** Where a page of the project is read, by its path, for the links a project's rules make. */
|
|
@@ -30,6 +31,9 @@ export function RulesView(props: RulesViewProps) {
|
|
|
30
31
|
const words = useWords();
|
|
31
32
|
const language = useLanguage().tag;
|
|
32
33
|
const { rules, scope } = props;
|
|
34
|
+
if (scope === "workspace" && rules.own !== undefined && props.folded !== true) {
|
|
35
|
+
return <WorkspaceRules {...props} own={rules.own} />;
|
|
36
|
+
}
|
|
33
37
|
const page = rules.page;
|
|
34
38
|
if (rules.source === "none" || rules.body === null) {
|
|
35
39
|
return (
|
|
@@ -46,10 +50,13 @@ export function RulesView(props: RulesViewProps) {
|
|
|
46
50
|
);
|
|
47
51
|
}
|
|
48
52
|
const text = <Markdown source={fillRules(rules.body, language)} docHref={props.docHref} />;
|
|
53
|
+
// A project's own are changed here. The workspace's come this way folded, on a project's
|
|
54
|
+
// page, or whole from a console of before, which says no parts: read, and changed elsewhere.
|
|
55
|
+
const changed = scope === "project";
|
|
49
56
|
return (
|
|
50
57
|
<div>
|
|
51
58
|
{rules.source === "reference" ? (
|
|
52
|
-
<Callout tone="info">{words.rules.
|
|
59
|
+
<Callout tone="info">{words.rules.console}</Callout>
|
|
53
60
|
) : (
|
|
54
61
|
page !== null && (
|
|
55
62
|
<p className="sc-rules-facts">
|
|
@@ -66,16 +73,58 @@ export function RulesView(props: RulesViewProps) {
|
|
|
66
73
|
) : (
|
|
67
74
|
text
|
|
68
75
|
)}
|
|
69
|
-
{(props.editHref !== undefined || props.onArchive !== undefined) && (
|
|
76
|
+
{changed && (props.editHref !== undefined || props.onArchive !== undefined) && (
|
|
70
77
|
<div className="sc-rules-actions">
|
|
71
78
|
{props.editHref !== undefined && (
|
|
72
79
|
<a className="sc-button sc-button-secondary" href={props.editHref}>
|
|
73
|
-
{
|
|
80
|
+
{words.common.edit}
|
|
74
81
|
</a>
|
|
75
82
|
)}
|
|
76
|
-
{
|
|
83
|
+
{props.onArchive !== undefined && (
|
|
77
84
|
<Button variant="ghost" onClick={props.onArchive} disabled={props.busy === true}>
|
|
78
|
-
{
|
|
85
|
+
{words.common.remove}
|
|
86
|
+
</Button>
|
|
87
|
+
)}
|
|
88
|
+
</div>
|
|
89
|
+
)}
|
|
90
|
+
</div>
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
/** The workspace's rules where they are kept: the console's as they hold, then what the organization adds. */
|
|
95
|
+
function WorkspaceRules(props: RulesViewProps & { readonly own: string }) {
|
|
96
|
+
const words = useWords();
|
|
97
|
+
const language = useLanguage().tag;
|
|
98
|
+
const added = props.rules.added ?? null;
|
|
99
|
+
return (
|
|
100
|
+
<div>
|
|
101
|
+
<Callout tone="info">{words.rules.console}</Callout>
|
|
102
|
+
<Markdown source={fillRules(props.own, language)} docHref={props.docHref} />
|
|
103
|
+
<div className="sc-rules-added">
|
|
104
|
+
<h3 className="sc-section-title">{words.rules.added}</h3>
|
|
105
|
+
{added === null ? (
|
|
106
|
+
<p className="sc-muted">{words.rules.nothingAdded}</p>
|
|
107
|
+
) : (
|
|
108
|
+
<>
|
|
109
|
+
<p className="sc-rules-facts">
|
|
110
|
+
{words.docs.version(added.page.version)} · {words.docs.writtenBy}{" "}
|
|
111
|
+
<Writer by={added.page.updatedBy} agent={added.page.agent} />{" "}
|
|
112
|
+
<Time iso={added.page.updatedAt} />
|
|
113
|
+
</p>
|
|
114
|
+
<Markdown source={fillRules(added.body, language)} docHref={props.docHref} />
|
|
115
|
+
</>
|
|
116
|
+
)}
|
|
117
|
+
</div>
|
|
118
|
+
{(props.editHref !== undefined || (added !== null && props.onArchive !== undefined)) && (
|
|
119
|
+
<div className="sc-rules-actions">
|
|
120
|
+
{props.editHref !== undefined && (
|
|
121
|
+
<a className="sc-button sc-button-secondary" href={props.editHref}>
|
|
122
|
+
{added === null ? words.rules.add : words.common.edit}
|
|
123
|
+
</a>
|
|
124
|
+
)}
|
|
125
|
+
{added !== null && props.onArchive !== undefined && (
|
|
126
|
+
<Button variant="ghost" onClick={props.onArchive} disabled={props.busy === true}>
|
|
127
|
+
{words.common.remove}
|
|
79
128
|
</Button>
|
|
80
129
|
)}
|
|
81
130
|
</div>
|
|
@@ -85,10 +134,10 @@ export function RulesView(props: RulesViewProps) {
|
|
|
85
134
|
}
|
|
86
135
|
|
|
87
136
|
export interface RulesFormProps {
|
|
88
|
-
/** The rules as they hold now: what the form starts from
|
|
137
|
+
/** The rules as they hold now: what the form starts from where something is written. */
|
|
89
138
|
readonly rules: RestRules;
|
|
90
139
|
readonly scope: "workspace" | "project";
|
|
91
|
-
/** What the form starts from
|
|
140
|
+
/** What the form starts from where nothing is written yet: a project's headings; nothing at the workspace. */
|
|
92
141
|
readonly template: string;
|
|
93
142
|
readonly busy?: boolean | undefined;
|
|
94
143
|
readonly error?: string | undefined;
|
|
@@ -97,25 +146,29 @@ export interface RulesFormProps {
|
|
|
97
146
|
readonly baseVersion?: number | undefined;
|
|
98
147
|
}) => void;
|
|
99
148
|
readonly onCancel?: (() => void) | undefined;
|
|
100
|
-
/** Called to put the organization's page away, so that the console's own rules hold again; offered while one is written. */
|
|
101
|
-
readonly onReset?: (() => void) | undefined;
|
|
102
149
|
}
|
|
103
150
|
|
|
104
151
|
/**
|
|
105
|
-
* The form the rules
|
|
106
|
-
*
|
|
107
|
-
* is
|
|
108
|
-
*
|
|
152
|
+
* The form what is added to the rules is written on. At the workspace it holds what the
|
|
153
|
+
* organization adds and nothing of the console's rules, which are read above it: empty until
|
|
154
|
+
* something is added. At a project it starts from the project's page, or from the headings.
|
|
155
|
+
* It saves nothing that would change nothing.
|
|
109
156
|
*/
|
|
110
157
|
export function RulesForm(props: RulesFormProps) {
|
|
111
158
|
const words = useWords();
|
|
159
|
+
const language = useLanguage().tag;
|
|
112
160
|
const { rules, scope } = props;
|
|
113
|
-
|
|
114
|
-
const
|
|
161
|
+
// A console of before says the whole and no parts, and takes the whole back.
|
|
162
|
+
const parts = scope === "workspace" && rules.own !== undefined;
|
|
163
|
+
/** What is written now: what the organization adds, or the page as it holds; nothing where nothing is. */
|
|
164
|
+
const current = parts
|
|
165
|
+
? rules.added?.body
|
|
166
|
+
: rules.source === "none"
|
|
167
|
+
? undefined
|
|
168
|
+
: (rules.body ?? undefined);
|
|
169
|
+
const page = parts ? (rules.added?.page ?? null) : rules.page;
|
|
115
170
|
const [body, setBody] = useState(current ?? props.template);
|
|
116
|
-
const unchanged =
|
|
117
|
-
body.trim() === (current ?? "").trim() ||
|
|
118
|
-
(scope === "workspace" && rules.source === "reference" && isReferenceRules(body));
|
|
171
|
+
const unchanged = body.trim() === (current ?? "").trim();
|
|
119
172
|
const ready = !unchanged && body.trim().length > 0;
|
|
120
173
|
|
|
121
174
|
const submit = (event: FormEvent) => {
|
|
@@ -125,14 +178,22 @@ export function RulesForm(props: RulesFormProps) {
|
|
|
125
178
|
}
|
|
126
179
|
props.onSubmit({
|
|
127
180
|
body,
|
|
128
|
-
...(
|
|
181
|
+
...(page === null ? {} : { baseVersion: page.version }),
|
|
129
182
|
});
|
|
130
183
|
};
|
|
131
184
|
|
|
132
185
|
return (
|
|
133
186
|
<form className="sc-form" onSubmit={submit}>
|
|
187
|
+
{parts && rules.own !== undefined && (
|
|
188
|
+
<details className="sc-rules-fold">
|
|
189
|
+
<summary>{words.rules.readConsole}</summary>
|
|
190
|
+
<Markdown source={fillRules(rules.own, language)} />
|
|
191
|
+
</details>
|
|
192
|
+
)}
|
|
134
193
|
<label className="sc-field">
|
|
135
|
-
<span className="sc-field-label">
|
|
194
|
+
<span className="sc-field-label">
|
|
195
|
+
{scope === "workspace" ? words.rules.added : words.rules.form.body}
|
|
196
|
+
</span>
|
|
136
197
|
<textarea
|
|
137
198
|
className="sc-input sc-textarea sc-doc-editor"
|
|
138
199
|
value={body}
|
|
@@ -140,7 +201,11 @@ export function RulesForm(props: RulesFormProps) {
|
|
|
140
201
|
rows={20}
|
|
141
202
|
onChange={(event) => setBody(event.target.value)}
|
|
142
203
|
/>
|
|
143
|
-
<span className="sc-muted">
|
|
204
|
+
<span className="sc-muted">
|
|
205
|
+
{scope === "workspace"
|
|
206
|
+
? words.rules.form.hintAdded(MAX_RULES_LENGTH)
|
|
207
|
+
: words.rules.form.hint(MAX_RULES_LENGTH)}
|
|
208
|
+
</span>
|
|
144
209
|
</label>
|
|
145
210
|
{props.error !== undefined && (
|
|
146
211
|
<p className="sc-form-error" role="alert">
|
|
@@ -156,11 +221,6 @@ export function RulesForm(props: RulesFormProps) {
|
|
|
156
221
|
{words.common.cancel}
|
|
157
222
|
</Button>
|
|
158
223
|
)}
|
|
159
|
-
{props.onReset !== undefined && rules.source === "written" && (
|
|
160
|
-
<Button variant="ghost" onClick={props.onReset} disabled={props.busy === true}>
|
|
161
|
-
{words.rules.useReference}
|
|
162
|
-
</Button>
|
|
163
|
-
)}
|
|
164
224
|
</div>
|
|
165
225
|
</form>
|
|
166
226
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
2
|
import type { RestSession } from "../api.js";
|
|
3
3
|
import { useWords } from "../i18n/index.js";
|
|
4
|
+
import { Icon } from "./icon.js";
|
|
4
5
|
import { Badge, Button, cx, Time } from "./ui.js";
|
|
5
6
|
|
|
6
7
|
// The browsers a person is signed in on (board #309), on a page of the settings of their own: each
|
|
@@ -26,19 +27,7 @@ const HANDHELD: ReadonlySet<string> = new Set(["iOS", "Android"]);
|
|
|
26
27
|
function DeviceIcon(props: { readonly handheld: boolean }) {
|
|
27
28
|
return (
|
|
28
29
|
<span className="sc-session-icon">
|
|
29
|
-
<
|
|
30
|
-
{props.handheld ? (
|
|
31
|
-
<>
|
|
32
|
-
<rect x="5.5" y="2.5" width="9" height="15" rx="2" />
|
|
33
|
-
<path d="M9 14.75h2" />
|
|
34
|
-
</>
|
|
35
|
-
) : (
|
|
36
|
-
<>
|
|
37
|
-
<rect x="2.5" y="3.5" width="15" height="10" rx="1.5" />
|
|
38
|
-
<path d="M7 16.5h6M10 13.5v3" />
|
|
39
|
-
</>
|
|
40
|
-
)}
|
|
41
|
-
</svg>
|
|
30
|
+
<Icon name={props.handheld ? "handheld" : "desktop"} />
|
|
42
31
|
</span>
|
|
43
32
|
);
|
|
44
33
|
}
|