@hanzo/dev 4.0.1 → 4.2.0
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/LICENSE +21 -0
- package/dist/{BinaryViewer-qn8xfPZp.js → BinaryViewer-CmFUK4zZ.js} +2 -2
- package/dist/{ChatMarkdown-Cyujn3JJ.js → ChatMarkdown-nvEI7iCv.js} +4 -4
- package/dist/{DiffCommentAnnotation-BZu1TP6E.js → DiffCommentAnnotation-BPTN_2a6.js} +1 -1
- package/dist/{DiffFileTree-CcJ91zOM.js → DiffFileTree-B_br90vY.js} +2 -2
- package/dist/{DiffPanel-BXC88NMs.js → DiffPanel-V5R5TPuK.js} +5 -5
- package/dist/{ExpandedImageDialog-BZnGRBJR.js → ExpandedImageDialog-CAorLacL.js} +1 -1
- package/dist/{FileExplorerPane-vBJS6V75.js → FileExplorerPane-CeHulcPz.js} +1 -1
- package/dist/{FilePreviewPanel-jJHWsMzm.js → FilePreviewPanel-BVNLvWOc.js} +8 -8
- package/dist/{MermaidDiagram-paNwQY33.js → MermaidDiagram-CTolIzQD.js} +1 -1
- package/dist/{MermaidFilePreview-B9KxfnIN.js → MermaidFilePreview-CP2zP4FU.js} +1 -1
- package/dist/{MermaidViewer-CAEGpLyD.js → MermaidViewer-BDfYkS9E.js} +2 -2
- package/dist/{NotebookPreview-D01mMCpR.js → NotebookPreview-Cybs5uM0.js} +1 -1
- package/dist/{OfficeFilePreview-DWaRgfQU.js → OfficeFilePreview-7JsmSoKU.js} +1 -1
- package/dist/{OfficeViewer-BudrZbBA.js → OfficeViewer-CJoojlJK.js} +1 -1
- package/dist/{OpenInPicker-Dd3ifHa1.js → OpenInPicker-BIMWUxBP.js} +7 -7
- package/dist/{OpenXmlOfficeViewer-CXcKdq7k.js → OpenXmlOfficeViewer-C24Kj8DM.js} +1 -1
- package/dist/{PreviewImage-C4Ku4z7v.js → PreviewImage-oY5YnuTr.js} +1 -1
- package/dist/{PreviewImageContent-BwOB9Lyd.js → PreviewImageContent-n6eLzY99.js} +1 -1
- package/dist/{PullRequestCodeTab-BcwyMk7d.js → PullRequestCodeTab-Dv_0kVad.js} +7 -7
- package/dist/{PullRequestReviewAnnotation-BU5t_1fC.js → PullRequestReviewAnnotation-LeuwO-iH.js} +4 -4
- package/dist/builder/activity.d.ts +16 -0
- package/dist/builder/activity.js +51 -0
- package/dist/builder/address.d.ts +11 -0
- package/dist/builder/address.js +50 -0
- package/dist/builder/ago.d.ts +2 -0
- package/dist/builder/ago.js +18 -0
- package/dist/builder/api/agents.d.ts +139 -0
- package/dist/builder/api/agents.js +253 -0
- package/dist/builder/api/auto.d.ts +166 -0
- package/dist/builder/api/auto.js +300 -0
- package/dist/builder/api/billing.d.ts +263 -0
- package/dist/builder/api/billing.js +401 -0
- package/dist/builder/api/call.d.ts +53 -0
- package/dist/builder/api/call.js +123 -0
- package/dist/builder/api/capabilities.d.ts +14 -0
- package/dist/builder/api/capabilities.js +41 -0
- package/dist/builder/api/changes.d.ts +74 -0
- package/dist/builder/api/changes.js +75 -0
- package/dist/builder/api/chat.d.ts +12 -0
- package/dist/builder/api/chat.js +28 -0
- package/dist/builder/api/cli.d.ts +59 -0
- package/dist/builder/api/cli.js +133 -0
- package/dist/builder/api/codebases.d.ts +46 -0
- package/dist/builder/api/codebases.js +100 -0
- package/dist/builder/api/coding.d.ts +117 -0
- package/dist/builder/api/coding.js +222 -0
- package/dist/builder/api/connectors.d.ts +76 -0
- package/dist/builder/api/connectors.js +111 -0
- package/dist/builder/api/consent.d.ts +22 -0
- package/dist/builder/api/consent.js +28 -0
- package/dist/builder/api/conversations.d.ts +20 -0
- package/dist/builder/api/conversations.js +23 -0
- package/dist/builder/api/draft.d.ts +38 -0
- package/dist/builder/api/draft.js +87 -0
- package/dist/builder/api/environment.d.ts +55 -0
- package/dist/builder/api/environment.js +126 -0
- package/dist/builder/api/gallery.d.ts +32 -0
- package/dist/builder/api/gallery.js +85 -0
- package/dist/builder/api/git.d.ts +59 -0
- package/dist/builder/api/git.js +117 -0
- package/dist/builder/api/github.d.ts +230 -0
- package/dist/builder/api/github.js +373 -0
- package/dist/builder/api/keys.d.ts +35 -0
- package/dist/builder/api/keys.js +72 -0
- package/dist/builder/api/library.d.ts +116 -0
- package/dist/builder/api/library.js +214 -0
- package/dist/builder/api/limits.d.ts +69 -0
- package/dist/builder/api/limits.js +86 -0
- package/dist/builder/api/links.d.ts +51 -0
- package/dist/builder/api/links.js +75 -0
- package/dist/builder/api/machines.d.ts +122 -0
- package/dist/builder/api/machines.js +238 -0
- package/dist/builder/api/mcp.d.ts +10 -0
- package/dist/builder/api/mcp.js +47 -0
- package/dist/builder/api/members.d.ts +35 -0
- package/dist/builder/api/members.js +95 -0
- package/dist/builder/api/memory.d.ts +14 -0
- package/dist/builder/api/memory.js +35 -0
- package/dist/builder/api/models.d.ts +17 -0
- package/dist/builder/api/models.js +20 -0
- package/dist/builder/api/places.d.ts +32 -0
- package/dist/builder/api/places.js +29 -0
- package/dist/builder/api/platform.d.ts +68 -0
- package/dist/builder/api/platform.js +87 -0
- package/dist/builder/api/plugins.d.ts +42 -0
- package/dist/builder/api/plugins.js +175 -0
- package/dist/builder/api/pref.d.ts +77 -0
- package/dist/builder/api/pref.js +93 -0
- package/dist/builder/api/profile.d.ts +11 -0
- package/dist/builder/api/profile.js +41 -0
- package/dist/builder/api/projects.d.ts +99 -0
- package/dist/builder/api/projects.js +166 -0
- package/dist/builder/api/provider.d.ts +49 -0
- package/dist/builder/api/provider.js +96 -0
- package/dist/builder/api/sandbox.d.ts +90 -0
- package/dist/builder/api/sandbox.js +223 -0
- package/dist/builder/api/sessions.d.ts +123 -0
- package/dist/builder/api/sessions.js +255 -0
- package/dist/builder/api/skills.d.ts +82 -0
- package/dist/builder/api/skills.js +117 -0
- package/dist/builder/api/sse.d.ts +24 -0
- package/dist/builder/api/sse.js +68 -0
- package/dist/builder/api/studio.d.ts +59 -0
- package/dist/builder/api/studio.js +91 -0
- package/dist/builder/api/talk.d.ts +48 -0
- package/dist/builder/api/talk.js +81 -0
- package/dist/builder/api/tools.d.ts +34 -0
- package/dist/builder/api/tools.js +37 -0
- package/dist/builder/api/turn.d.ts +202 -0
- package/dist/builder/api/turn.js +772 -0
- package/dist/builder/api/verdict.d.ts +3 -0
- package/dist/builder/api/verdict.js +21 -0
- package/dist/builder/api/webhooks.d.ts +47 -0
- package/dist/builder/api/webhooks.js +82 -0
- package/dist/builder/api/work.d.ts +110 -0
- package/dist/builder/api/work.js +218 -0
- package/dist/builder/ask.d.ts +51 -0
- package/dist/builder/ask.js +147 -0
- package/dist/builder/automations.d.ts +33 -0
- package/dist/builder/automations.js +453 -0
- package/dist/builder/awake.d.ts +24 -0
- package/dist/builder/awake.js +68 -0
- package/dist/builder/back.d.ts +30 -0
- package/dist/builder/back.js +105 -0
- package/dist/builder/builder.d.ts +12 -0
- package/dist/builder/builder.js +162 -0
- package/dist/builder/carry.d.ts +48 -0
- package/dist/builder/carry.js +278 -0
- package/dist/builder/choice.d.ts +134 -0
- package/dist/builder/choice.js +152 -0
- package/dist/builder/claims.d.ts +13 -0
- package/dist/builder/claims.js +35 -0
- package/dist/builder/clipboard.d.ts +2 -0
- package/dist/builder/clipboard.js +10 -0
- package/dist/builder/customize/agents.d.ts +11 -0
- package/dist/builder/customize/agents.js +513 -0
- package/dist/builder/customize/connectors.d.ts +2 -0
- package/dist/builder/customize/connectors.js +319 -0
- package/dist/builder/customize/drafted.d.ts +4 -0
- package/dist/builder/customize/drafted.js +92 -0
- package/dist/builder/customize/index.d.ts +8 -0
- package/dist/builder/customize/index.js +127 -0
- package/dist/builder/customize/inventory.d.ts +14 -0
- package/dist/builder/customize/inventory.js +127 -0
- package/dist/builder/customize/load.d.ts +9 -0
- package/dist/builder/customize/load.js +22 -0
- package/dist/builder/customize/ocean.d.ts +41 -0
- package/dist/builder/customize/ocean.js +332 -0
- package/dist/builder/customize/plugins.d.ts +2 -0
- package/dist/builder/customize/plugins.js +136 -0
- package/dist/builder/customize/roles.d.ts +4 -0
- package/dist/builder/customize/roles.js +105 -0
- package/dist/builder/customize/say.d.ts +13 -0
- package/dist/builder/customize/say.js +32 -0
- package/dist/builder/customize/skills.d.ts +2 -0
- package/dist/builder/customize/skills.js +208 -0
- package/dist/builder/customize/ui.d.ts +152 -0
- package/dist/builder/customize/ui.js +208 -0
- package/dist/builder/data.d.ts +57 -0
- package/dist/builder/data.js +322 -0
- package/dist/builder/design.d.ts +140 -0
- package/dist/builder/design.js +175 -0
- package/dist/builder/desk.d.ts +48 -0
- package/dist/builder/desk.js +449 -0
- package/dist/builder/dev-mode.d.ts +43 -0
- package/dist/builder/dev-mode.js +120 -0
- package/dist/builder/door.d.ts +11 -0
- package/dist/builder/door.js +126 -0
- package/dist/builder/environment.d.ts +23 -0
- package/dist/builder/environment.js +193 -0
- package/dist/builder/files.d.ts +23 -0
- package/dist/builder/files.js +175 -0
- package/dist/builder/find.d.ts +7 -0
- package/dist/builder/find.js +80 -0
- package/dist/builder/foot.d.ts +30 -0
- package/dist/builder/foot.js +79 -0
- package/dist/builder/forge.d.ts +4 -0
- package/dist/builder/forge.js +639 -0
- package/dist/builder/gear.d.ts +60 -0
- package/dist/builder/gear.js +180 -0
- package/dist/builder/git.d.ts +21 -0
- package/dist/builder/git.js +118 -0
- package/dist/builder/github-sync.d.ts +70 -0
- package/dist/builder/github-sync.js +435 -0
- package/dist/builder/gutter.d.ts +17 -0
- package/dist/builder/gutter.js +25 -0
- package/dist/builder/handoff.d.ts +8 -0
- package/dist/builder/handoff.js +22 -0
- package/dist/builder/host.d.ts +189 -0
- package/dist/builder/host.js +46 -0
- package/dist/builder/index.d.ts +108 -0
- package/dist/builder/index.js +99 -0
- package/dist/builder/landing.d.ts +34 -0
- package/dist/builder/landing.js +725 -0
- package/dist/builder/library.d.ts +21 -0
- package/dist/builder/library.js +526 -0
- package/dist/builder/local.d.ts +80 -0
- package/dist/builder/local.js +124 -0
- package/dist/builder/make.d.ts +10 -0
- package/dist/builder/make.js +120 -0
- package/dist/builder/markdown.d.ts +49 -0
- package/dist/builder/markdown.js +125 -0
- package/dist/builder/marks.d.ts +15 -0
- package/dist/builder/marks.js +18 -0
- package/dist/builder/merge.d.ts +223 -0
- package/dist/builder/merge.js +380 -0
- package/dist/builder/meter.d.ts +31 -0
- package/dist/builder/meter.js +54 -0
- package/dist/builder/mind.d.ts +107 -0
- package/dist/builder/mind.js +335 -0
- package/dist/builder/names.d.ts +40 -0
- package/dist/builder/names.js +189 -0
- package/dist/builder/nav.d.ts +28 -0
- package/dist/builder/nav.js +218 -0
- package/dist/builder/out.d.ts +16 -0
- package/dist/builder/out.js +24 -0
- package/dist/builder/page.d.ts +55 -0
- package/dist/builder/page.js +217 -0
- package/dist/builder/pane.d.ts +30 -0
- package/dist/builder/pane.js +21 -0
- package/dist/builder/panel.d.ts +101 -0
- package/dist/builder/panel.js +408 -0
- package/dist/builder/pdf.d.ts +139 -0
- package/dist/builder/pdf.js +847 -0
- package/dist/builder/pick.d.ts +10 -0
- package/dist/builder/pick.js +38 -0
- package/dist/builder/plain.d.ts +59 -0
- package/dist/builder/plain.js +209 -0
- package/dist/builder/plan.d.ts +63 -0
- package/dist/builder/plan.js +155 -0
- package/dist/builder/plans.d.ts +1 -0
- package/dist/builder/plans.js +157 -0
- package/dist/builder/plugin.d.ts +60 -0
- package/dist/builder/plugin.js +1 -0
- package/dist/builder/plugins/design.d.ts +8 -0
- package/dist/builder/plugins/design.js +71 -0
- package/dist/builder/plugins/index.d.ts +46 -0
- package/dist/builder/plugins/index.js +117 -0
- package/dist/builder/plugins/pdf.d.ts +18 -0
- package/dist/builder/plugins/pdf.js +83 -0
- package/dist/builder/plugins/project.d.ts +5 -0
- package/dist/builder/plugins/project.js +68 -0
- package/dist/builder/plugins/research.d.ts +24 -0
- package/dist/builder/plugins/research.js +147 -0
- package/dist/builder/plugins/sketch.d.ts +9 -0
- package/dist/builder/plugins/sketch.js +101 -0
- package/dist/builder/plugins/slides.d.ts +14 -0
- package/dist/builder/plugins/slides.js +55 -0
- package/dist/builder/plugins/template.d.ts +13 -0
- package/dist/builder/plugins/template.js +95 -0
- package/dist/builder/prefs.d.ts +29 -0
- package/dist/builder/prefs.js +91 -0
- package/dist/builder/preview-url.d.ts +47 -0
- package/dist/builder/preview-url.js +107 -0
- package/dist/builder/project.d.ts +18 -0
- package/dist/builder/project.js +604 -0
- package/dist/builder/prose.d.ts +4 -0
- package/dist/builder/prose.js +57 -0
- package/dist/builder/publish.d.ts +18 -0
- package/dist/builder/publish.js +141 -0
- package/dist/builder/question.d.ts +33 -0
- package/dist/builder/question.js +64 -0
- package/dist/builder/redesign.d.ts +32 -0
- package/dist/builder/redesign.js +117 -0
- package/dist/builder/removal.d.ts +71 -0
- package/dist/builder/removal.js +73 -0
- package/dist/builder/reply.d.ts +50 -0
- package/dist/builder/reply.js +196 -0
- package/dist/builder/roles.d.ts +10 -0
- package/dist/builder/roles.js +28 -0
- package/dist/builder/route.d.ts +85 -0
- package/dist/builder/route.js +126 -0
- package/dist/builder/run.d.ts +4 -0
- package/dist/builder/run.js +804 -0
- package/dist/builder/runmeta.d.ts +16 -0
- package/dist/builder/runmeta.js +69 -0
- package/dist/builder/say.d.ts +2 -0
- package/dist/builder/say.js +7 -0
- package/dist/builder/scheduled.d.ts +3 -0
- package/dist/builder/scheduled.js +328 -0
- package/dist/builder/section.d.ts +27 -0
- package/dist/builder/section.js +60 -0
- package/dist/builder/settings/account.d.ts +1 -0
- package/dist/builder/settings/account.js +111 -0
- package/dist/builder/settings/billing.d.ts +1 -0
- package/dist/builder/settings/billing.js +210 -0
- package/dist/builder/settings/capabilities.d.ts +1 -0
- package/dist/builder/settings/capabilities.js +66 -0
- package/dist/builder/settings/card.d.ts +31 -0
- package/dist/builder/settings/card.js +140 -0
- package/dist/builder/settings/code.d.ts +1 -0
- package/dist/builder/settings/code.js +70 -0
- package/dist/builder/settings/credits.d.ts +10 -0
- package/dist/builder/settings/credits.js +123 -0
- package/dist/builder/settings/environments.d.ts +1 -0
- package/dist/builder/settings/environments.js +60 -0
- package/dist/builder/settings/general.d.ts +1 -0
- package/dist/builder/settings/general.js +58 -0
- package/dist/builder/settings/index.d.ts +4 -0
- package/dist/builder/settings/index.js +25 -0
- package/dist/builder/settings/integrations.d.ts +8 -0
- package/dist/builder/settings/integrations.js +138 -0
- package/dist/builder/settings/keys.d.ts +1 -0
- package/dist/builder/settings/keys.js +114 -0
- package/dist/builder/settings/list.d.ts +10 -0
- package/dist/builder/settings/list.js +28 -0
- package/dist/builder/settings/machines.d.ts +4 -0
- package/dist/builder/settings/machines.js +243 -0
- package/dist/builder/settings/members.d.ts +1 -0
- package/dist/builder/settings/members.js +77 -0
- package/dist/builder/settings/memory.d.ts +1 -0
- package/dist/builder/settings/memory.js +62 -0
- package/dist/builder/settings/notifications.d.ts +1 -0
- package/dist/builder/settings/notifications.js +111 -0
- package/dist/builder/settings/plan.d.ts +17 -0
- package/dist/builder/settings/plan.js +131 -0
- package/dist/builder/settings/privacy.d.ts +1 -0
- package/dist/builder/settings/privacy.js +76 -0
- package/dist/builder/settings/sections.d.ts +16 -0
- package/dist/builder/settings/sections.js +34 -0
- package/dist/builder/settings/shared.d.ts +6 -0
- package/dist/builder/settings/shared.js +58 -0
- package/dist/builder/settings/ui.d.ts +50 -0
- package/dist/builder/settings/ui.js +53 -0
- package/dist/builder/settings/usage.d.ts +1 -0
- package/dist/builder/settings/usage.js +24 -0
- package/dist/builder/shared.d.ts +26 -0
- package/dist/builder/shared.js +15 -0
- package/dist/builder/shelf.d.ts +16 -0
- package/dist/builder/shelf.js +219 -0
- package/dist/builder/side.d.ts +40 -0
- package/dist/builder/side.js +208 -0
- package/dist/builder/site.d.ts +75 -0
- package/dist/builder/site.js +138 -0
- package/dist/builder/spend.d.ts +21 -0
- package/dist/builder/spend.js +80 -0
- package/dist/builder/standing.d.ts +36 -0
- package/dist/builder/standing.js +66 -0
- package/dist/builder/suggest.d.ts +238 -0
- package/dist/builder/suggest.js +463 -0
- package/dist/builder/suggestions.d.ts +49 -0
- package/dist/builder/suggestions.js +260 -0
- package/dist/builder/summary.d.ts +60 -0
- package/dist/builder/summary.js +81 -0
- package/dist/builder/sync.d.ts +1 -0
- package/dist/builder/sync.js +187 -0
- package/dist/builder/tabs.d.ts +85 -0
- package/dist/builder/tabs.js +288 -0
- package/dist/builder/talk.d.ts +5 -0
- package/dist/builder/talk.js +108 -0
- package/dist/builder/thread.d.ts +60 -0
- package/dist/builder/thread.js +302 -0
- package/dist/builder/tools.d.ts +22 -0
- package/dist/builder/tools.js +52 -0
- package/dist/builder/transcript.d.ts +47 -0
- package/dist/builder/transcript.js +108 -0
- package/dist/builder/voice.d.ts +8 -0
- package/dist/builder/voice.js +24 -0
- package/dist/{changedFileKind-DqgCCDUs.js → changedFileKind-D6QYvIez.js} +1 -1
- package/dist/core.js +1 -0
- package/dist/{decodeImagePreview-CesVZYP4.js → decodeImagePreview-DnfFEjhw.js} +1 -1
- package/dist/{embed-DYP-OUlb.js → embed-c030vUqM.js} +11 -11
- package/dist/index.d.ts +2 -0
- package/dist/index.js +2 -1
- package/dist/{micromark-util-decode-string-NQjVkmZH.js → micromark-util-decode-string-C-5AXkOV.js} +5 -3
- package/dist/{readBinaryPreview-D2X4Uahu.js → readBinaryPreview-BAQ4fFjm.js} +1 -1
- package/dist/{useTextFieldSpeech-CyOZZPrV.js → useTextFieldSpeech-COa9XcRx.js} +1 -1
- package/package.json +101 -11
- /package/{index.d.ts → dist/core.d.ts} +0 -0
- /package/{keymap.d.ts → dist/keymap.d.ts} +0 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Code: where and how a new run starts — the mode and the place, saved to the
|
|
4
|
+
* person's own settings for anyone whose New has no choice of its own kept yet
|
|
5
|
+
* — and the model and effort, which are the one choice Chat and Dev share
|
|
6
|
+
* (mind.tsx): changed here, changed in both composers. Beside them, the
|
|
7
|
+
* codebases' environments and the organization's machines, each on its own page.
|
|
8
|
+
*
|
|
9
|
+
* Its words are the reader's language (@hanzo/i18n `t`); a model's and a
|
|
10
|
+
* machine's names are drawn as given.
|
|
11
|
+
*/
|
|
12
|
+
import { YStack } from '@hanzo/gui';
|
|
13
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
14
|
+
import { ChevronRight } from '@hanzogui/lucide-icons-2';
|
|
15
|
+
import { ChipSelect } from '@hanzo/ui/product';
|
|
16
|
+
import { ModelPicker } from '@hanzo/ui/models';
|
|
17
|
+
import { useState } from 'react';
|
|
18
|
+
import { told } from '../api/call.js';
|
|
19
|
+
import { unhonoured } from '../api/coding.js';
|
|
20
|
+
import { ENSO } from '../api/models.js';
|
|
21
|
+
import { SANDBOX } from '../api/places.js';
|
|
22
|
+
import { usePlaces } from '../data.js';
|
|
23
|
+
import { useHost, useTarget } from '../host.js';
|
|
24
|
+
import { MODES } from '../landing.js';
|
|
25
|
+
import { EFFORTS, useCatalog, useChoice } from '../mind.js';
|
|
26
|
+
import { usePrefs } from '../prefs.js';
|
|
27
|
+
import { path } from '../route.js';
|
|
28
|
+
import { said } from './machines.js';
|
|
29
|
+
import { Card, Group, Heading, Note, Row, Soft } from './ui.js';
|
|
30
|
+
export function Code() {
|
|
31
|
+
const { t } = useI18n();
|
|
32
|
+
const host = useHost();
|
|
33
|
+
const target = useTarget();
|
|
34
|
+
const signed = Boolean(host.person);
|
|
35
|
+
const { prefs, save } = usePrefs();
|
|
36
|
+
const catalog = useCatalog(target);
|
|
37
|
+
const [choice, choose] = useChoice();
|
|
38
|
+
const places = usePlaces(target, signed);
|
|
39
|
+
const [note, setNote] = useState('');
|
|
40
|
+
if (!signed) {
|
|
41
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Code') }), _jsx(Soft, { children: t('Sign in to set how your runs start.') })] }));
|
|
42
|
+
}
|
|
43
|
+
const now = { mode: 'build', place: '', ...prefs.code };
|
|
44
|
+
const keep = (change) => {
|
|
45
|
+
setNote('');
|
|
46
|
+
save({ code: { ...prefs.code, ...change } }).catch((e) => setNote(told(e, t)));
|
|
47
|
+
};
|
|
48
|
+
const where = (places.value.length ? places.value : [SANDBOX]).map((p) => ({
|
|
49
|
+
id: p.id || 'sandbox',
|
|
50
|
+
label: p.id ? p.label : t('Default'),
|
|
51
|
+
// A machine offline now can still be the default; its status shows beside it.
|
|
52
|
+
hint: p.id ? [said(p.status, t), p.capacity].filter(Boolean).join(' · ') : t('The platform’s own sandbox'),
|
|
53
|
+
place: p.id,
|
|
54
|
+
}));
|
|
55
|
+
// The sandbox is always listed, so a place not found is a machine that is not: it reads as its id.
|
|
56
|
+
const place = where.find((w) => w.place === now.place) ?? { id: now.place, label: now.place, place: now.place };
|
|
57
|
+
// A default is never premium: a premium model is picked for one run, in New.
|
|
58
|
+
const offered = catalog.models.filter((m) => m.class !== 'premium');
|
|
59
|
+
const go = (section) => host.go(path({ kind: 'settings', section }));
|
|
60
|
+
// The choices in the reader's words, kept by id.
|
|
61
|
+
const efforts = EFFORTS.map((e) => ({ ...e, label: t(e.label) }));
|
|
62
|
+
const modes = MODES.map((m) => ({ ...m, label: t(m.label), hint: t(m.hint) }));
|
|
63
|
+
const effort = efforts.find((e) => e.id === choice.effort) ?? efforts[0];
|
|
64
|
+
const mode = modes.find((m) => m.id === now.mode);
|
|
65
|
+
return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Code'), detail: t('How a new run starts. The model and effort are the ones Chat uses too.') }), _jsxs(Group, { title: t('Defaults'), children: [_jsxs(Card, { children: [_jsx(Row, { first: true, title: t('Model'), detail: t('Enso picks one for each step; any other model runs them all.'), trailing: _jsx(ModelPicker, { size: "sm", name: t('Default model'), models: offered, scope: "chat", value: choice.model || ENSO, onChange: (id) => choose({ model: id }), loading: catalog.loading, error: catalog.error }) }), _jsx(Row, { title: t('Effort'), detail: t('How long the agent thinks before it acts.'), trailing: _jsx(ChipSelect, { name: t('Default effort'), label: effort.label, chosen: effort, items: efforts, onChange: (e) => choose({ effort: e.id }), placement: "bottom-end", width: 180 }) }), _jsx(Row, { title: t('Mode'), detail: mode.hint, trailing: _jsx(ChipSelect, { name: t('Default mode'), label: mode.label, chosen: mode, items: modes, onChange: (m) => keep({ mode: m.id }), placement: "bottom-end", width: 260 }) }), _jsx(Row, { title: t('Where it runs'), detail: t('The Hanzo sandbox, or one of your organization’s machines.'), trailing: _jsx(ChipSelect, { name: t('Default place'), label: place.label, chosen: place, items: where, onChange: (w) => keep({ place: w.place }), placeholder: t('Search machines…'), placement: "bottom-end", loading: places.loading, error: places.error ? told(places.error, t) : null }) })] }), _jsx(Note, { children: unhonoured(now.mode, now.place, t) })] }), _jsx(Group, { title: t('Workspace'), children: _jsxs(Card, { children: [_jsx(Row, { first: true, title: t('Environments'), detail: t('What a run installs and starts in each codebase, and the secrets it exports.'), trailing: _jsx(Link, { label: t('Open Environments'), onPress: () => go('environments') }) }), _jsx(Row, { title: t('Machines'), detail: t('Your organization’s own computers that take runs.'), trailing: _jsx(Link, { label: t('Open Machines'), onPress: () => go('machines') }) })] }) }), _jsx(Note, { children: note })] }));
|
|
66
|
+
}
|
|
67
|
+
/** A row's way to its own page; `label` is what it opens, already said. */
|
|
68
|
+
function Link({ label, onPress }) {
|
|
69
|
+
return (_jsx(YStack, { render: "button", "aria-label": label, p: "$1", rounded: "$2", hoverStyle: { bg: '$hover' }, onPress: onPress, children: _jsx(ChevronRight, { size: 16, 'data-i18n-mirror': '' }) }));
|
|
70
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type Target } from '../api/call.ts';
|
|
2
|
+
/** What the credits section says first, on every surface: English, marked (`phrase`), drawn through `t`. */
|
|
3
|
+
export declare const SEPARATE: string;
|
|
4
|
+
export declare function Credits({ target, admin, add, onCard, cardsVersion }: {
|
|
5
|
+
target: Target;
|
|
6
|
+
admin: boolean;
|
|
7
|
+
add?: string;
|
|
8
|
+
onCard?: () => void;
|
|
9
|
+
cardsVersion?: number;
|
|
10
|
+
}): import("react").JSX.Element;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Credits, as the one view every Billing page draws: Dev's Settings, the
|
|
4
|
+
* rooms' Settings and hanzo.ai's organization settings.
|
|
5
|
+
*
|
|
6
|
+
* CREDITS ARE NOT THE PLAN. A plan includes usage, measured in shares on Usage;
|
|
7
|
+
* credits are money — the prepaid balance bought with a card and the credit
|
|
8
|
+
* Hanzo granted — and they pay for usage past the plan when the payer chose to
|
|
9
|
+
* continue with credits, and for everything when there is no plan. So the
|
|
10
|
+
* balance, the grants, top-ups, auto-reload, this month's spend and the monthly
|
|
11
|
+
* limit on it live here, and nowhere a plan is named.
|
|
12
|
+
*
|
|
13
|
+
* Money moves two ways, the host's choice: `add` names a page that takes it (the
|
|
14
|
+
* pay site); without one a saved card is charged here (POST /v1/billing/topup)
|
|
15
|
+
* and a person with no card is sent to add one (`onCard`).
|
|
16
|
+
*
|
|
17
|
+
* Its words are the reader's language (@hanzo/i18n `t`); a grant's, a limit's
|
|
18
|
+
* and a kind of spend's names are the ledger's, drawn as given.
|
|
19
|
+
*/
|
|
20
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
21
|
+
import { phrase } from '@hanzo/i18n';
|
|
22
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
23
|
+
import { Button, Input, Switch } from '@hanzo/ui';
|
|
24
|
+
import { useEffect, useState } from 'react';
|
|
25
|
+
import { arm, balance, caps, cents, chosen, credit, grants, label, lift, limit, methods, money, monthly, recharge, spend, topup, } from '../api/billing.js';
|
|
26
|
+
import { told } from '../api/call.js';
|
|
27
|
+
import { useRead } from '../data.js';
|
|
28
|
+
import { Card, day, Group, Note, Row, Soft } from './ui.js';
|
|
29
|
+
/** What the credits section says first, on every surface: English, marked (`phrase`), drawn through `t`. */
|
|
30
|
+
export const SEPARATE = phrase('Credits are separate from your plan’s usage allowance. They pay for usage past it when you choose to continue with credits, and for all usage when there is no plan.');
|
|
31
|
+
/** A money figure as read: the amount, or why there is none. */
|
|
32
|
+
function Figure({ read }) {
|
|
33
|
+
const { t } = useI18n();
|
|
34
|
+
return (_jsx(SizableText, { size: "$2", color: read.error ? '$soft' : '$ink', numberOfLines: 1, maxW: 200, children: read.error ? t('Unavailable') : read.loading ? '…' : money(read.value) }));
|
|
35
|
+
}
|
|
36
|
+
/** A thin bar of a whole, red once a limit is used up. */
|
|
37
|
+
function Bar({ part, whole, limit }) {
|
|
38
|
+
const pct = Math.min(100, Math.max(0, (part / whole) * 100));
|
|
39
|
+
return (_jsx(YStack, { height: 6, rounded: 999, bg: "$hover", overflow: "hidden", role: "progressbar", "aria-valuenow": Math.round(pct), "aria-valuemin": 0, "aria-valuemax": 100, children: _jsx(YStack, { height: 6, width: `${pct}%`, rounded: 999, bg: limit && pct >= 100 ? '$red10' : '$ink' }) }));
|
|
40
|
+
}
|
|
41
|
+
function Meter({ title, used, of, says, first, limit = true }) {
|
|
42
|
+
return (_jsxs(YStack, { gap: "$2", px: "$3", py: "$3", borderTopWidth: first ? 0 : 1, borderColor: "$borderColor", children: [_jsxs(XStack, { items: "baseline", justify: "space-between", flexWrap: "wrap", columnGap: "$3", rowGap: "$1", children: [_jsx(SizableText, { size: "$2", color: "$ink", children: title }), _jsx(SizableText, { size: "$1", color: "$soft", children: says })] }), _jsx(Bar, { part: used, whole: of, limit: limit })] }));
|
|
43
|
+
}
|
|
44
|
+
/** `Resets Oct 1, 2026`, or '' for none. */
|
|
45
|
+
const resets = (iso, t) => (day(iso) ? t('Resets {date}', { date: day(iso) }) : '');
|
|
46
|
+
export function Credits({ target, admin, add, onCard, cardsVersion = 0 }) {
|
|
47
|
+
const { t } = useI18n();
|
|
48
|
+
const left = useRead(() => balance(target), 0, [target]);
|
|
49
|
+
const granted = useRead(() => credit(target), 0, [target]);
|
|
50
|
+
const rows = useRead(() => grants(target), [], [target]);
|
|
51
|
+
const spent = useRead(() => spend(target), null, [target]);
|
|
52
|
+
const rule = useRead(() => recharge(target), null, [target]);
|
|
53
|
+
const ceilings = useRead(() => caps(target), [], [target]);
|
|
54
|
+
const cards = useRead(add ? null : () => methods(target), [], [target, add, cardsVersion]);
|
|
55
|
+
const [buying, setBuying] = useState(false);
|
|
56
|
+
const [amount, setAmount] = useState('25');
|
|
57
|
+
const [ceiling, setCeiling] = useState('');
|
|
58
|
+
const [below, setBelow] = useState('');
|
|
59
|
+
const [reload, setReload] = useState('');
|
|
60
|
+
const [working, setWorking] = useState(false);
|
|
61
|
+
const [note, setNote] = useState('');
|
|
62
|
+
// The rule's figures are what the form starts from, once read.
|
|
63
|
+
useEffect(() => {
|
|
64
|
+
if (!rule.value)
|
|
65
|
+
return;
|
|
66
|
+
setBelow(rule.value.threshold ? String(rule.value.threshold / 100) : '');
|
|
67
|
+
setReload(rule.value.amount ? String(rule.value.amount / 100) : '');
|
|
68
|
+
}, [rule.value]);
|
|
69
|
+
const act = async (what, done, after) => {
|
|
70
|
+
setWorking(true);
|
|
71
|
+
setNote('');
|
|
72
|
+
try {
|
|
73
|
+
await what();
|
|
74
|
+
after();
|
|
75
|
+
setNote(done);
|
|
76
|
+
}
|
|
77
|
+
catch (e) {
|
|
78
|
+
setNote(told(e, t));
|
|
79
|
+
}
|
|
80
|
+
finally {
|
|
81
|
+
setWorking(false);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const card = chosen(cards.value);
|
|
85
|
+
const adding = cents(amount);
|
|
86
|
+
const cap = monthly(ceilings.value);
|
|
87
|
+
const others = ceilings.value.filter((c) => c !== cap);
|
|
88
|
+
const s = spent.value;
|
|
89
|
+
const top = Math.max(0, ...(s?.categories ?? []).map((c) => c.cents));
|
|
90
|
+
const live = rows.value.filter((g) => g.active && g.remaining > 0);
|
|
91
|
+
const buy = () => {
|
|
92
|
+
if (!adding)
|
|
93
|
+
return setNote(t('Enter an amount in dollars'));
|
|
94
|
+
void act(() => topup(target, adding, card.id), t('{amount} is added to the balance', { amount: money(adding) }), () => {
|
|
95
|
+
setBuying(false);
|
|
96
|
+
left.reload();
|
|
97
|
+
});
|
|
98
|
+
};
|
|
99
|
+
const setLimit = () => {
|
|
100
|
+
const c = cents(ceiling);
|
|
101
|
+
if (!c)
|
|
102
|
+
return setNote(t('Enter a monthly limit in dollars'));
|
|
103
|
+
void act(() => limit(target, ceilings.value, c), t('Spend stops at {amount} a month', { amount: money(c) }), () => {
|
|
104
|
+
setCeiling('');
|
|
105
|
+
ceilings.reload();
|
|
106
|
+
});
|
|
107
|
+
};
|
|
108
|
+
const saveRule = (enabled) => {
|
|
109
|
+
const threshold = below.trim() === '' || below.trim() === '0' ? 0 : cents(below);
|
|
110
|
+
const each = cents(reload);
|
|
111
|
+
if (enabled && (threshold === null || !each))
|
|
112
|
+
return setNote(t('Enter the balance to reload below and the amount to add, in dollars'));
|
|
113
|
+
void act(() => arm(target, { enabled, threshold: threshold ?? 0, amount: each ?? rule.value?.amount ?? 0 }), enabled ? t('Adds {amount} whenever the balance falls below {floor}', { amount: money(each ?? 0), floor: money(threshold ?? 0) }) : t('Auto-reload is off'), rule.reload);
|
|
114
|
+
};
|
|
115
|
+
return (_jsxs(YStack, { gap: "$6", "data-slot": "credits", children: [_jsxs(Group, { title: t('Credits'), detail: t(SEPARATE), action: add ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => window.open(add, '_blank', 'noopener'), children: t('Add funds') })) : buying || !admin ? undefined : (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setBuying(true), children: t('Buy more') })), children: [_jsxs(Card, { children: [_jsx(Row, { first: true, title: t('Prepaid balance'), detail: t('Available for all models and usage'), trailing: _jsx(Figure, { read: left }) }), _jsx(Row, { title: t('Granted credit'), detail: t('Given by Hanzo; some models take only prepaid'), trailing: _jsx(Figure, { read: granted }) }), _jsx(Row, { title: t('Spent this month'), detail: s && !s.known ? t('The ledger did not answer, so this is not a measurement') : undefined, trailing: _jsx(Figure, { read: { ...spent, value: s?.total ?? 0 } }) }), buying ? (_jsx(YStack, { gap: "$2", px: "$3", py: "$3", borderTopWidth: 1, borderColor: "$borderColor", children: card ? (_jsxs(_Fragment, { children: [_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsx(YStack, { width: 140, children: _jsx(Input, { value: amount, onChangeText: setAmount, "aria-label": t('Amount in dollars'), placeholder: "25", inputMode: "decimal" }) }), _jsx(SizableText, { flex: 1, minW: 160, size: "$1", color: "$soft", children: t('Charged to {card}', { card: label(card) }) })] }), _jsxs(XStack, { gap: "$2", justify: "flex-end", children: [_jsx(Button, { size: "sm", variant: "ghost", onPress: () => setBuying(false), children: t('Cancel') }), _jsx(Button, { size: "sm", disabled: working, onPress: buy, children: adding ? t('Add {amount}', { amount: money(adding) }) : t('Add funds') })] })] })) : (_jsxs(XStack, { gap: "$2", items: "center", flexWrap: "wrap", children: [_jsx(SizableText, { flex: 1, minW: 160, size: "$2", color: "$soft", children: cards.loading ? t('Reading cards…') : t('Add a card to buy more.') }), onCard ? (_jsx(Button, { size: "sm", variant: "outline", onPress: onCard, children: t('Add card') })) : null] })) })) : null] }), live.length ? (_jsx(Card, { children: live.map((g, i) => (_jsx(Row, { first: i === 0, title: g.name || t('Credit grant'), detail: [
|
|
116
|
+
t('{left} left of {amount}', { left: money(g.remaining, g.currency), amount: money(g.amount, g.currency) }),
|
|
117
|
+
g.expires ? t('expires {date}', { date: day(g.expires) }) : '',
|
|
118
|
+
]
|
|
119
|
+
.filter(Boolean)
|
|
120
|
+
.join(' · ') }, g.id))) })) : null] }), _jsx(Group, { title: t('Auto-reload'), detail: t('Tops the balance up from the card on file whenever it falls below a floor.'), children: rule.error ? (_jsx(Soft, { children: told(rule.error, t) })) : !rule.value ? (_jsx(Soft, { children: t('Reading auto-reload…') })) : (_jsxs(Card, { children: [_jsx(Row, { first: true, title: rule.value.enabled ? t('Adds {amount} below {floor}', { amount: money(rule.value.amount), floor: money(rule.value.threshold) }) : t('Off'), detail: rule.value.last ? t('Last reloaded {date}', { date: day(rule.value.last) }) : admin ? undefined : t('An org admin sets auto-reload.'), trailing: admin ? (_jsx(Switch, { "aria-label": t('Auto-reload'), checked: rule.value.enabled, disabled: working, onCheckedChange: (on) => saveRule(on) })) : undefined }), admin ? (_jsxs(XStack, { gap: "$2", items: "center", px: "$3", py: "$3", borderTopWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", children: [_jsx(YStack, { width: 150, children: _jsx(Input, { value: below, onChangeText: setBelow, "aria-label": t('Reload below, in dollars'), placeholder: t('Below {amount}', { amount: '$5' }), inputMode: "decimal" }) }), _jsx(YStack, { width: 150, children: _jsx(Input, { value: reload, onChangeText: setReload, "aria-label": t('Amount to add, in dollars'), placeholder: t('Add {amount}', { amount: '$25' }), inputMode: "decimal" }) }), _jsx(XStack, { flex: 1, justify: "flex-end", children: _jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => saveRule(true), children: rule.value.enabled ? t('Save') : t('Turn on') }) })] })) : null] })) }), _jsx(Group, { title: t('Spend this month'), detail: t('What credits paid for, by kind.'), children: spent.error ? (_jsx(Soft, { children: told(spent.error, t) })) : !s ? (_jsx(Soft, { children: t('Reading spend…') })) : s.categories.length === 0 ? (_jsx(Card, { children: _jsx(Soft, { children: t('Nothing spent this month.') }) })) : (_jsx(Card, { children: s.categories.map((c, i) => (_jsx(Meter, { first: i === 0, title: c.name, used: c.cents, of: top, says: money(c.cents), limit: false }, c.name))) })) }), _jsxs(Group, { title: t('Monthly limit'), detail: t('Spend from credits past it is refused until the month starts over.'), children: [ceilings.error ? (_jsx(Soft, { children: told(ceilings.error, t) })) : (_jsxs(Card, { children: [cap ? (_jsx(Meter, { first: true, title: t('{amount} a month', { amount: money(cap.threshold) }), used: cap.spent ?? 0, of: cap.threshold, says: [cap.spent === null ? t('Spend unknown') : t('{amount} spent', { amount: money(cap.spent) }), resets(cap.resets, t)].filter(Boolean).join(' · ') })) : (_jsx(Row, { first: true, title: t('No monthly limit'), detail: t('Spend is bounded by the balance alone.') })), others.map((c) => (_jsx(Row, { title: c.title || t('Limit'), detail: [c.project && t('project {name}', { name: c.project }), c.service && t('service {name}', { name: c.service }), c.enforce ? t('refuses spend past it') : t('warns only')]
|
|
121
|
+
.filter(Boolean)
|
|
122
|
+
.join(' · '), trailing: _jsx(SizableText, { size: "$2", color: "$ink", children: c.threshold ? money(c.threshold) : '—' }) }, c.id))), admin ? (_jsxs(XStack, { gap: "$2", items: "center", px: "$3", py: "$3", borderTopWidth: 1, borderColor: "$borderColor", flexWrap: "wrap", children: [_jsx(YStack, { width: 160, children: _jsx(Input, { value: ceiling, onChangeText: setCeiling, "aria-label": t('Monthly limit in dollars'), placeholder: cap ? String(cap.threshold / 100) : '500', inputMode: "decimal" }) }), _jsxs(XStack, { flex: 1, gap: "$2", justify: "flex-end", children: [cap ? (_jsx(Button, { size: "sm", variant: "ghost", disabled: working, onPress: () => void act(() => lift(target, cap.id), t('The monthly limit is lifted'), ceilings.reload), children: t('Remove') })) : null, _jsx(Button, { size: "sm", variant: "outline", disabled: working || !ceiling.trim(), onPress: setLimit, children: cap ? t('Change limit') : t('Set limit') })] })] })) : null] })), !admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin sets the monthly limit.') })) : null] }), _jsx(Note, { children: note })] }));
|
|
123
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Environments(): import("react").JSX.Element;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Environments: every codebase in the organization that has one — what a sandbox
|
|
4
|
+
* run does to its checkout before the agent starts, and the secrets it exports.
|
|
5
|
+
* One opens in the same editor a run shows beside it. A member reads; an org
|
|
6
|
+
* admin saves, sets secrets and forgets an environment, which is the platform's
|
|
7
|
+
* rule and not a choice made here.
|
|
8
|
+
*
|
|
9
|
+
* Its words are the reader's language (@hanzo/i18n `t`); a codebase's name is
|
|
10
|
+
* its own, drawn as given.
|
|
11
|
+
*/
|
|
12
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
13
|
+
import { ChevronLeft, ChevronRight } from '@hanzogui/lucide-icons-2';
|
|
14
|
+
import { phrase } from '@hanzo/i18n';
|
|
15
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
16
|
+
import { Button } from '@hanzo/ui';
|
|
17
|
+
import { useState } from 'react';
|
|
18
|
+
import { told } from '../api/call.js';
|
|
19
|
+
import { environments, forget } from '../api/environment.js';
|
|
20
|
+
import { Confirm } from '../ask.js';
|
|
21
|
+
import { useRead } from '../data.js';
|
|
22
|
+
import { Environment } from '../environment.js';
|
|
23
|
+
import { useHost, useTarget } from '../host.js';
|
|
24
|
+
import { Card, Heading, Note, Row, Soft } from './ui.js';
|
|
25
|
+
const STATE = { none: phrase('Not set up'), proposed: phrase('Proposed, waiting for review'), ready: phrase('Ready') };
|
|
26
|
+
/** The line under a codebase: where it stands, its secrets, when it was saved, each fact in the reader's words. */
|
|
27
|
+
function about(e, t) {
|
|
28
|
+
const parts = [t(STATE[e.state])];
|
|
29
|
+
if (e.secrets.length)
|
|
30
|
+
parts.push(e.secrets.length === 1 ? t('1 secret') : t('{n} secrets', { n: e.secrets.length }));
|
|
31
|
+
const when = e.updated ? new Date(e.updated) : null;
|
|
32
|
+
if (when && !Number.isNaN(when.getTime()))
|
|
33
|
+
parts.push(t('Updated {date}', { date: when.toLocaleDateString(undefined, { month: 'short', day: 'numeric', year: 'numeric' }) }));
|
|
34
|
+
return parts.join(' · ');
|
|
35
|
+
}
|
|
36
|
+
export function Environments() {
|
|
37
|
+
const { t } = useI18n();
|
|
38
|
+
const host = useHost();
|
|
39
|
+
const target = useTarget();
|
|
40
|
+
const signed = Boolean(host.person);
|
|
41
|
+
const list = useRead(signed ? () => environments(target) : null, [], [target, signed]);
|
|
42
|
+
const [open, setOpen] = useState('');
|
|
43
|
+
const [forgetting, setForgetting] = useState(false);
|
|
44
|
+
const [note, setNote] = useState('');
|
|
45
|
+
if (!signed) {
|
|
46
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Environments') }), _jsx(Soft, { children: t('Sign in to see your organization’s environments.') })] }));
|
|
47
|
+
}
|
|
48
|
+
if (open) {
|
|
49
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsxs(XStack, { items: "center", gap: "$2", children: [_jsxs(Button, { size: "sm", variant: "ghost", onPress: () => setOpen(''), children: [_jsx(ChevronLeft, { size: 14, 'data-i18n-mirror': '' }), " ", t('All environments')] }), _jsx(XStack, { flex: 1 }), host.admin ? (_jsx(Button, { size: "sm", variant: "outline", onPress: () => setForgetting(true), children: t('Forget') })) : null] }), _jsx(Environment, { repo: open, busy: false }), _jsx(Confirm, { open: forgetting, onOpenChange: setForgetting, title: t('Forget {repo}’s environment?', { repo: open }), says: t('Later runs on this codebase start bare: its scripts are dropped and every secret it holds is removed from KMS. This cannot be undone.'), act: t('Forget'), run: async () => {
|
|
50
|
+
await forget(target, open);
|
|
51
|
+
setNote(t('{repo}’s environment is forgotten', { repo: open }));
|
|
52
|
+
setOpen('');
|
|
53
|
+
list.reload();
|
|
54
|
+
} })] }));
|
|
55
|
+
}
|
|
56
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Environments'), detail: t('What a sandbox run does to a codebase before its agent starts: the install script, the start command, and the secrets it exports.') }), list.error ? (_jsx(Soft, { children: told(list.error, t) })) : list.loading && list.value.length === 0 ? (_jsx(Soft, { children: t('Reading environments…') })) : list.value.length === 0 ? (_jsx(Soft, { children: t('No codebase has an environment yet. Set one up from New, or from a run’s Environment tab.') })) : (_jsx(Card, { children: list.value.map((e, i) => (_jsx(YStack, { render: "button", "aria-label": t('Open {repo}', { repo: e.repo }), onPress: () => {
|
|
57
|
+
setNote('');
|
|
58
|
+
setOpen(e.repo);
|
|
59
|
+
}, cursor: "pointer", hoverStyle: { bg: '$hover' }, "$platform-web": { textAlign: 'start' }, children: _jsx(Row, { first: i === 0, title: e.repo, detail: about(e, t), trailing: _jsx(ChevronRight, { size: 16, opacity: 0.6, 'data-i18n-mirror': '' }) }) }, e.repo))) })), !host.admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin saves an environment and sets its secrets.') })) : null, _jsx(Note, { children: note })] }));
|
|
60
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function General(): import("react").JSX.Element;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* General: how the builder looks and listens — the theme, the text size, the
|
|
4
|
+
* motion, and the language dictation hears. Each choice is saved to the
|
|
5
|
+
* person's own settings as it is made, so it follows them to every device.
|
|
6
|
+
*
|
|
7
|
+
* Its words are the reader's language (@hanzo/i18n `t`); a language is named
|
|
8
|
+
* in its own words, as given.
|
|
9
|
+
*/
|
|
10
|
+
import { YStack } from '@hanzo/gui';
|
|
11
|
+
import { phrase } from '@hanzo/i18n';
|
|
12
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
13
|
+
import { ChipSelect } from '@hanzo/ui/product';
|
|
14
|
+
import { useState } from 'react';
|
|
15
|
+
import { told } from '../api/call.js';
|
|
16
|
+
import { useHost } from '../host.js';
|
|
17
|
+
import { usePrefs } from '../prefs.js';
|
|
18
|
+
import { LANGUAGES } from '@hanzo/ui/chat/pure';
|
|
19
|
+
import { spoken } from '../voice.js';
|
|
20
|
+
import { Card, Group, Heading, Note, Row, Soft } from './ui.js';
|
|
21
|
+
/** The choices, each word English and marked (`phrase`): drawn through `t`. */
|
|
22
|
+
const THEMES = [
|
|
23
|
+
{ id: 'system', label: phrase('System') },
|
|
24
|
+
{ id: 'light', label: phrase('Light') },
|
|
25
|
+
{ id: 'dark', label: phrase('Dark') },
|
|
26
|
+
];
|
|
27
|
+
const TEXTS = [
|
|
28
|
+
{ id: 'small', label: phrase('Small') },
|
|
29
|
+
{ id: 'medium', label: phrase('Medium') },
|
|
30
|
+
{ id: 'large', label: phrase('Large') },
|
|
31
|
+
];
|
|
32
|
+
const MOTIONS = [
|
|
33
|
+
{ id: 'system', label: phrase('System'), hint: phrase('As this device is set') },
|
|
34
|
+
{ id: 'reduced', label: phrase('Reduced'), hint: phrase('No animation anywhere') },
|
|
35
|
+
];
|
|
36
|
+
export function General() {
|
|
37
|
+
const { t } = useI18n();
|
|
38
|
+
const host = useHost();
|
|
39
|
+
const { prefs, save } = usePrefs();
|
|
40
|
+
const [note, setNote] = useState('');
|
|
41
|
+
if (!host.person) {
|
|
42
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('General') }), _jsx(Soft, { children: t('Sign in to see your settings.') })] }));
|
|
43
|
+
}
|
|
44
|
+
const keep = (patch) => {
|
|
45
|
+
setNote('');
|
|
46
|
+
save(patch).catch((e) => setNote(told(e, t)));
|
|
47
|
+
};
|
|
48
|
+
// The choices in the reader's words, kept by id.
|
|
49
|
+
const themes = THEMES.map((x) => ({ ...x, label: t(x.label) }));
|
|
50
|
+
const texts = TEXTS.map((x) => ({ ...x, label: t(x.label) }));
|
|
51
|
+
const motions = MOTIONS.map((x) => ({ ...x, label: t(x.label), hint: t(x.hint) }));
|
|
52
|
+
// Each choice is one of its list: a saved one was read against it, and a host's theme is one of THEMES.
|
|
53
|
+
const theme = themes.find((x) => x.id === (prefs.theme ?? host.theme ?? 'dark'));
|
|
54
|
+
const text = texts.find((x) => x.id === (prefs.text ?? 'medium'));
|
|
55
|
+
const motion = motions.find((x) => x.id === (prefs.motion ?? 'system'));
|
|
56
|
+
const language = LANGUAGES.find((l) => l.id === prefs.language) ?? LANGUAGES.find((l) => l.id === spoken());
|
|
57
|
+
return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('General'), detail: t('How Hanzo looks and listens. Saved to your account, so it follows you.') }), _jsx(Group, { title: t('Appearance'), children: _jsxs(Card, { children: [host.chooseTheme ? (_jsx(Row, { first: true, title: t('Theme'), detail: t('System follows this device’s light or dark setting.'), trailing: _jsx(ChipSelect, { name: t('Theme'), label: theme.label, chosen: theme, items: themes, onChange: (x) => keep({ theme: x.id }), placement: "bottom-end", width: 200 }) })) : null, _jsx(Row, { first: !host.chooseTheme, title: t('Text size'), detail: t('The transcript, the composer and every screen.'), trailing: _jsx(ChipSelect, { name: t('Text size'), label: text.label, chosen: text, items: texts, onChange: (x) => keep({ text: x.id === 'medium' ? null : x.id }), placement: "bottom-end", width: 200 }) }), _jsx(Row, { title: t('Motion'), detail: t('Reduced stops animations and transitions on this page.'), trailing: _jsx(ChipSelect, { name: t('Motion'), label: motion.label, chosen: motion, items: motions, onChange: (x) => keep({ motion: x.id === 'system' ? null : x.id }), placement: "bottom-end", width: 220 }) })] }) }), _jsx(Group, { title: t('Voice'), children: _jsx(Card, { children: _jsx(Row, { first: true, title: t('Dictation language'), detail: t('What the microphone in the composer listens for.'), trailing: _jsx(ChipSelect, { name: t('Dictation language'), label: language.label, chosen: language, items: LANGUAGES, onChange: (l) => keep({ language: l.id }), placeholder: t('Search languages…'), placement: "bottom-end", width: 220 }) }) }) }), _jsx(Note, { children: note })] }));
|
|
58
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Settings: every setting the builder has, on this page — the account, the
|
|
4
|
+
* workspace's environments, machines and keys, what the agent brings to a run,
|
|
5
|
+
* and the organization's integrations, members, usage and notifications. A
|
|
6
|
+
* section is its own address, so it can be linked to and comes back on reload.
|
|
7
|
+
* Its words are the reader's language (@hanzo/i18n `t`).
|
|
8
|
+
*/
|
|
9
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
10
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
11
|
+
import { useHost } from '../host.js';
|
|
12
|
+
import { path } from '../route.js';
|
|
13
|
+
import { heading } from './list.js';
|
|
14
|
+
import { ENTRIES, GROUPS } from './sections.js';
|
|
15
|
+
export function Settings({ section }) {
|
|
16
|
+
const { t } = useI18n();
|
|
17
|
+
const host = useHost();
|
|
18
|
+
// Every section the route grammar names has an entry.
|
|
19
|
+
const entry = ENTRIES.find((e) => e.id === section);
|
|
20
|
+
const go = (id) => host.go(path({ kind: 'settings', section: id }));
|
|
21
|
+
return (_jsxs(XStack, { flex: 1, minH: 0, minW: 0, children: [host.sections ? null : (_jsxs(YStack, { role: "navigation", "aria-label": t('Settings'), width: 220, shrink: 0, borderInlineEndWidth: 1, borderColor: "$borderColor", px: "$2", py: "$4", gap: "$4", overflow: "scroll", "$max-md": { display: 'none' }, children: [_jsx(SizableText, { size: "$4", color: "$ink", px: "$2", children: t('Settings') }), GROUPS.map((g) => {
|
|
22
|
+
const list = ENTRIES.filter((e) => e.group === g);
|
|
23
|
+
return (_jsxs(YStack, { gap: "$0.5", children: [heading(g) ? (_jsx(SizableText, { size: "$1", color: "$soft", px: "$2", pb: "$1", children: t(heading(g)) })) : null, list.map((e) => (_jsx(XStack, { render: "button", "aria-label": t(e.label), "aria-current": e.id === entry.id ? 'page' : undefined, onPress: () => go(e.id), px: "$2", py: "$1.5", rounded: "$2", bg: e.id === entry.id ? '$hover' : 'transparent', hoverStyle: { bg: '$hover' }, children: _jsx(SizableText, { size: "$2", color: e.id === entry.id ? '$ink' : '$soft', children: t(e.label) }) }, e.id)))] }, g));
|
|
24
|
+
})] })), _jsxs(YStack, { flex: 1, minW: 0, minH: 0, overflow: "scroll", children: [_jsx(XStack, { flexWrap: "wrap", gap: "$1.5", px: "$4", pt: "$3", $md: { display: 'none' }, children: ENTRIES.map((e) => (_jsx(XStack, { render: "button", "aria-label": t(e.label), onPress: () => go(e.id), px: "$2.5", py: "$1", rounded: "$10", borderWidth: 1, borderColor: e.id === entry.id ? '$ink' : '$borderColor', children: _jsx(SizableText, { size: "$1", color: e.id === entry.id ? '$ink' : '$soft', children: t(e.label) }) }, e.id))) }), _jsx(YStack, { width: "100%", maxW: 760, self: "center", px: "$5", py: "$6", children: entry.body() })] })] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type Connector } from '../api/provider.ts';
|
|
2
|
+
export declare function Integrations(): import("react").JSX.Element;
|
|
3
|
+
/**
|
|
4
|
+
* The named social connectors, by id: whether each can be connected here and
|
|
5
|
+
* whether it is. One that could not be read is left out, and its row reads on
|
|
6
|
+
* as "Reading…" rather than taking the others with it.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useSocial(signed: boolean, ids: readonly string[]): import("../data.ts").Read<Record<string, Connector>>;
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* Integrations: your own GitHub connection, the GitHub accounts the
|
|
4
|
+
* organization has installed the platform's App on, its Slack workspace, and
|
|
5
|
+
* the social accounts its automations post to.
|
|
6
|
+
*
|
|
7
|
+
* Connecting leaves this page once, for GitHub's or Slack's own consent screen,
|
|
8
|
+
* and the platform's callback brings the person back here with the answer
|
|
9
|
+
* (../back.ts), which this page finishes and reports. Anyone connects their own
|
|
10
|
+
* GitHub; installing the App and connecting Slack are an org admin's, which is
|
|
11
|
+
* the platform's rule. A GitHub change made here, on Projects or in the Hanzo
|
|
12
|
+
* app's Quick setup is said on the window (../api/github.ts `changed`), and
|
|
13
|
+
* this page reads GitHub again.
|
|
14
|
+
*
|
|
15
|
+
* Its words are the reader's language (@hanzo/i18n `t`); an account's,
|
|
16
|
+
* a channel's and a provider's names, and the platform's own notes, are drawn
|
|
17
|
+
* as given.
|
|
18
|
+
*/
|
|
19
|
+
import { SizableText, XStack, YStack } from '@hanzo/gui';
|
|
20
|
+
import { useI18n } from '@hanzo/i18n/react';
|
|
21
|
+
import { Github, Hash, Lock, Megaphone, Slack } from '@hanzogui/lucide-icons-2';
|
|
22
|
+
import { Button } from '@hanzo/ui';
|
|
23
|
+
import { useEffect, useState } from 'react';
|
|
24
|
+
import { told } from '../api/call.js';
|
|
25
|
+
import { changed, connect, connection, disconnect as unlinkGithub, heard, installations } from '../api/github.js';
|
|
26
|
+
import { authorize, channels, disconnect, read, SOCIAL } from '../api/provider.js';
|
|
27
|
+
import { here, useBack } from '../back.js';
|
|
28
|
+
import { useRead } from '../data.js';
|
|
29
|
+
import { useHost, useTarget } from '../host.js';
|
|
30
|
+
import { Card, day, Group, Heading, Note, Row, Soft } from './ui.js';
|
|
31
|
+
export function Integrations() {
|
|
32
|
+
const { t } = useI18n();
|
|
33
|
+
const host = useHost();
|
|
34
|
+
const target = useTarget();
|
|
35
|
+
const signed = Boolean(host.person);
|
|
36
|
+
const mine = useRead(signed ? () => connection(target) : null, null, [target, signed]);
|
|
37
|
+
const installed = useRead(signed ? () => installations(target) : null, [], [target, signed]);
|
|
38
|
+
const slack = useRead(signed ? () => read(target, 'slack') : null, null, [target, signed]);
|
|
39
|
+
const joined = slack.value?.connected ?? false;
|
|
40
|
+
const rooms = useRead(signed && joined ? () => channels(target) : null, { channels: [], next: '' }, [target, signed, joined]);
|
|
41
|
+
const social = useSocial(signed, SOCIAL.map((p) => p.id));
|
|
42
|
+
const [working, setWorking] = useState(false);
|
|
43
|
+
const [note, setNote] = useState('');
|
|
44
|
+
const { reload: readMine } = mine;
|
|
45
|
+
const { reload: readInstalled } = installed;
|
|
46
|
+
useEffect(() => heard(() => {
|
|
47
|
+
readMine();
|
|
48
|
+
readInstalled();
|
|
49
|
+
}), [readMine, readInstalled]);
|
|
50
|
+
useBack(target, signed, setNote, () => {
|
|
51
|
+
slack.reload();
|
|
52
|
+
social.reload();
|
|
53
|
+
});
|
|
54
|
+
if (!signed) {
|
|
55
|
+
return (_jsxs(YStack, { gap: "$5", children: [_jsx(Heading, { title: t('Integrations') }), _jsx(Soft, { children: t('Sign in to see this organization’s integrations.') })] }));
|
|
56
|
+
}
|
|
57
|
+
const act = async (what, done, after) => {
|
|
58
|
+
setWorking(true);
|
|
59
|
+
setNote('');
|
|
60
|
+
try {
|
|
61
|
+
await what();
|
|
62
|
+
after();
|
|
63
|
+
setNote(done);
|
|
64
|
+
}
|
|
65
|
+
catch (e) {
|
|
66
|
+
setNote(told(e, t));
|
|
67
|
+
}
|
|
68
|
+
finally {
|
|
69
|
+
setWorking(false);
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/** Off to the provider's consent page; it is the one hop away from this page. */
|
|
73
|
+
const away = async (where) => {
|
|
74
|
+
setWorking(true);
|
|
75
|
+
setNote('');
|
|
76
|
+
try {
|
|
77
|
+
host.open(await where());
|
|
78
|
+
}
|
|
79
|
+
catch (e) {
|
|
80
|
+
setNote(told(e, t));
|
|
81
|
+
setWorking(false);
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const me = mine.value;
|
|
85
|
+
const s = slack.value;
|
|
86
|
+
return (_jsxs(YStack, { gap: "$6", children: [_jsx(Heading, { title: t('Integrations'), detail: host.org ? t('What {org} and you have connected.', { org: host.org }) : t('What this organization and you have connected.') }), _jsxs(Group, { title: "GitHub", detail: t('Your connection brings your repositories; the App brings an account’s to the organization.'), children: [_jsxs(Card, { children: [_jsx(Row, { first: true, leading: _jsx(Github, { size: 16 }), title: t('Your GitHub'), detail: mine.error
|
|
87
|
+
? told(mine.error, t)
|
|
88
|
+
: !me
|
|
89
|
+
? t('Reading…')
|
|
90
|
+
: !me.configured
|
|
91
|
+
? t('This deployment cannot connect GitHub yet.')
|
|
92
|
+
: me.connected
|
|
93
|
+
? t('Connected as @{login}', { login: me.login })
|
|
94
|
+
: t('Not connected'), trailing: me?.configured ? (me.connected ? (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void act(() => unlinkGithub(target), t('Your GitHub is disconnected'), changed), children: t('Disconnect') })) : (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void away(() => connect(target, here())), children: t('Connect') }))) : null }), installed.error ? (_jsx(Row, { title: t('App installations'), detail: told(installed.error, t) })) : (installed.value.map((i) => (_jsx(Row, { leading: _jsx(Github, { size: 16 }), title: i.login, detail: [i.type, i.grant === 'all' ? t('every repository') : i.grant === 'selected' ? t('selected repositories') : ''].filter(Boolean).join(' · '), trailing: _jsxs(XStack, { gap: "$2", items: "center", children: [_jsx(SizableText, { size: "$1", color: i.connected ? '$ink' : '$soft', children: i.connected ? t('Installed') : t('Removed on GitHub') }), host.admin ? (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void act(() => disconnect(target, 'github', i.login), t('@{login} is disconnected', { login: i.login }), changed), children: t('Disconnect') })) : null] }) }, i.login)))), !installed.error && !installed.loading && installed.value.length === 0 ? (_jsx(Row, { title: t('No GitHub accounts installed'), detail: t('Install the App on a GitHub account to bring its repositories here.') })) : null] }), host.admin ? (_jsx(XStack, { children: _jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void away(() => authorize(target, 'github', here())), children: t('Install on a GitHub account') }) })) : (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin installs the App on a GitHub account.') }))] }), _jsxs(Group, { title: "Slack", detail: t('Talk to Hanzo from your workspace’s channels.'), children: [_jsxs(Card, { children: [_jsx(Row, { first: true, leading: _jsx(Slack, { size: 16 }), title: s?.connected && s.account ? s.account : 'Slack', detail: slack.error
|
|
95
|
+
? told(slack.error, t)
|
|
96
|
+
: !s
|
|
97
|
+
? t('Reading…')
|
|
98
|
+
: s.connected
|
|
99
|
+
? s.since
|
|
100
|
+
? t('Connected since {day}', { day: day(s.since) })
|
|
101
|
+
: t('Connected')
|
|
102
|
+
: s.available
|
|
103
|
+
? t('Not connected')
|
|
104
|
+
: s.note || t('This deployment cannot connect Slack yet.'), trailing: host.admin && s && (s.connected || s.available) ? (s.connected ? (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void act(() => disconnect(target, 'slack'), t('{name} is disconnected', { name: 'Slack' }), slack.reload), children: t('Disconnect') })) : (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void away(() => authorize(target, 'slack', here())), children: t('Connect') }))) : null }), joined && rooms.error ? _jsx(Row, { title: t('Channels'), detail: told(rooms.error, t) }) : null, joined
|
|
105
|
+
? rooms.value.channels.map((c) => (_jsx(Row, { leading: c.private ? _jsx(Lock, { size: 14 }) : _jsx(Hash, { size: 14 }), title: c.name || c.id, trailing: _jsx(SizableText, { size: "$1", color: c.member ? '$ink' : '$soft', children: c.member ? t('Joined') : t('Not joined') }) }, c.id)))
|
|
106
|
+
: null] }), !host.admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin connects the Slack workspace.') })) : null] }), _jsxs(Group, { title: t('Social accounts'), detail: t('Where automations post what their agent writes.'), children: [_jsx(Card, { children: SOCIAL.map((p, i) => {
|
|
107
|
+
const c = social.value[p.id];
|
|
108
|
+
return (_jsx(Row, { first: i === 0, leading: _jsx(Megaphone, { size: 16 }), title: c?.connected && c.account ? `${p.name} · ${c.account}` : p.name, detail: social.error
|
|
109
|
+
? told(social.error, t)
|
|
110
|
+
: !c
|
|
111
|
+
? t('Reading…')
|
|
112
|
+
: c.connected
|
|
113
|
+
? // Connected, then what the account takes, as two sentences.
|
|
114
|
+
p.takes
|
|
115
|
+
? `${c.since ? t('Connected since {day}.', { day: day(c.since) }) : t('Connected.')} ${t(p.takes)}`
|
|
116
|
+
: c.since
|
|
117
|
+
? t('Connected since {day}', { day: day(c.since) })
|
|
118
|
+
: t('Connected')
|
|
119
|
+
: c.available
|
|
120
|
+
? p.takes ? t(p.takes) : t('Not connected')
|
|
121
|
+
: p.takes ? `${t(p.takes)} ${t(p.needs)}` : t(p.needs), trailing: host.admin && c && (c.connected || c.available) ? (c.connected ? (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void act(() => disconnect(target, p.id), t('{name} is disconnected', { name: p.name }), social.reload), children: t('Disconnect') })) : (_jsx(Button, { size: "sm", variant: "outline", disabled: working, onPress: () => void away(() => authorize(target, p.id, here())), "aria-label": t('Connect {name}', { name: p.name }), children: t('Connect') }))) : null }, p.id));
|
|
122
|
+
}) }), !host.admin ? (_jsx(SizableText, { size: "$1", color: "$soft", children: t('An org admin connects the organization’s social accounts.') })) : null] }), _jsx(Note, { children: note })] }));
|
|
123
|
+
}
|
|
124
|
+
/**
|
|
125
|
+
* The named social connectors, by id: whether each can be connected here and
|
|
126
|
+
* whether it is. One that could not be read is left out, and its row reads on
|
|
127
|
+
* as "Reading…" rather than taking the others with it.
|
|
128
|
+
*/
|
|
129
|
+
export function useSocial(signed, ids) {
|
|
130
|
+
const t = useTarget();
|
|
131
|
+
const key = ids.join(',');
|
|
132
|
+
return useRead(signed
|
|
133
|
+
? async () => {
|
|
134
|
+
const got = await Promise.allSettled(ids.map((id) => read(t, id)));
|
|
135
|
+
return Object.fromEntries(got.flatMap((r, i) => (r.status === 'fulfilled' ? [[ids[i], r.value]] : [])));
|
|
136
|
+
}
|
|
137
|
+
: null, {}, [t, signed, key]);
|
|
138
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function Keys(): import("react").JSX.Element;
|