@dexhq/canvas 0.15.0 → 0.16.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/CHANGELOG.md +34 -0
- package/app/canvas/activity-parts.tsx +50 -6
- package/app/canvas/activity.tsx +2 -3
- package/app/canvas/agent-changes.ts +18 -8
- package/app/canvas/anchoring.ts +13 -3
- package/app/canvas/canvas-context.tsx +6 -2
- package/app/canvas/canvas-input.ts +35 -0
- package/app/canvas/canvas-model.ts +2 -2
- package/app/canvas/canvas-scene.ts +243 -24
- package/app/canvas/canvas-ui.ts +11 -2
- package/app/canvas/canvas.css +86 -3
- package/app/canvas/comments.tsx +66 -29
- package/app/canvas/element-link.ts +135 -0
- package/app/canvas/element-picker.ts +23 -0
- package/app/canvas/export-dialog.tsx +265 -0
- package/app/canvas/flow-canvas.tsx +65 -14
- package/app/canvas/frame-context-menu.tsx +61 -7
- package/app/canvas/frame-node.tsx +10 -11
- package/app/canvas/layout.ts +41 -22
- package/app/canvas/linked-element.tsx +196 -0
- package/app/canvas/live-page.ts +14 -0
- package/app/canvas/mentions.tsx +209 -0
- package/app/canvas/picked-box.tsx +21 -0
- package/app/canvas/removed-views-panel.tsx +4 -4
- package/app/canvas/request-node.tsx +151 -0
- package/app/canvas/review-panel.tsx +8 -3
- package/app/canvas/section-node.tsx +4 -133
- package/app/canvas/spec-margin.tsx +4 -1
- package/app/canvas/teammates-layer.tsx +205 -0
- package/app/canvas/text-layer.tsx +103 -17
- package/app/canvas/tool-cursors.ts +7 -6
- package/app/canvas/tool-icons.tsx +24 -56
- package/app/canvas/typing.ts +12 -0
- package/app/canvas/use-agent-changes.tsx +6 -2
- package/app/canvas/use-canvas-editor.ts +4 -2
- package/app/export/player-model.ts +159 -0
- package/app/export/player.tsx +198 -0
- package/app/export.html +31 -0
- package/app/export.tsx +9 -0
- package/app/frame/announce-refreshes.ts +21 -0
- package/app/frame/start-frame.tsx +50 -0
- package/app/frame/view-loads.ts +161 -0
- package/app/frame/views.ts +13 -49
- package/app/frame.tsx +2 -38
- package/app/i18n/locales/en/messages.po +145 -6
- package/app/i18n/locales/en/messages.ts +1 -1
- package/app/i18n/locales/pseudo/messages.po +144 -5
- package/app/i18n/locales/pseudo/messages.ts +1 -1
- package/app/icons/dex-glyphs.tsx +219 -0
- package/app/icons/glyphs.tsx +76 -80
- package/app/kit/use-flow.ts +2 -1
- package/app/live/canvas-teammates.ts +90 -0
- package/app/live/studio-api.ts +30 -20
- package/app/pages/canvas.tsx +18 -6
- package/app/pages/commands-settings.tsx +1 -1
- package/app/pages/render.tsx +39 -11
- package/app/shell/bell.tsx +15 -5
- package/app/shell/presence.tsx +123 -26
- package/app/shell/thread-list.tsx +25 -8
- package/app/shell/working-on.tsx +35 -3
- package/app/ui/prompt-editor.tsx +39 -11
- package/app/ui/reference.tsx +21 -8
- package/bin/sudio.mjs +1 -1
- package/dist/cli/commands/create.d.mts +5 -5
- package/dist/cli/commands/create.mjs +4 -4
- package/dist/cli/commands/export.d.mts +40 -0
- package/dist/cli/commands/export.mjs +66 -0
- package/dist/cli/commands/init.d.mts +2 -2
- package/dist/cli/commands/upgrade.mjs +1 -1
- package/dist/cli/help.d.mts +1 -1
- package/dist/cli/help.mjs +13 -7
- package/dist/cli/main.d.mts +42 -5
- package/dist/cli/main.mjs +1 -0
- package/dist/config/load.mjs +14 -2
- package/dist/config/project-files.d.mts +5 -0
- package/dist/config/project-files.mjs +10 -1
- package/dist/config/renamed.d.mts +7 -0
- package/dist/config/renamed.mjs +13 -1
- package/dist/content/commands.d.mts +11 -9
- package/dist/content/commands.mjs +22 -16
- package/dist/content/comments-log.mjs +2 -1
- package/dist/content/content.d.mts +11 -3
- package/dist/content/content.mjs +49 -15
- package/dist/content/element-words.d.mts +42 -0
- package/dist/content/element-words.mjs +112 -0
- package/dist/content/hosted-person.d.mts +31 -0
- package/dist/content/hosted-person.mjs +68 -0
- package/dist/content/merge-rules.d.mts +5 -0
- package/dist/content/merge-rules.mjs +17 -1
- package/dist/content/screenshot.mjs +9 -0
- package/dist/content/text-edit.d.mts +24 -14
- package/dist/content/text-edit.mjs +92 -81
- package/dist/content/text-replace.mjs +2 -26
- package/dist/content/thread-module.d.mts +2 -4
- package/dist/content/thread-module.mjs +4 -5
- package/dist/server/agents.d.mts +10 -0
- package/dist/server/agents.mjs +21 -6
- package/dist/server/canvas-presence.d.mts +22 -0
- package/dist/server/canvas-presence.mjs +160 -0
- package/dist/server/command-settings.mjs +1 -1
- package/dist/server/comments/actions.d.mts +0 -8
- package/dist/server/comments/actions.mjs +1 -9
- package/dist/server/comments/routes.mjs +10 -31
- package/dist/server/dev-server.mjs +35 -13
- package/dist/server/export/build.d.mts +15 -0
- package/dist/server/export/build.mjs +220 -0
- package/dist/server/export/page.d.mts +25 -0
- package/dist/server/export/page.mjs +40 -0
- package/dist/server/export/plugin.d.mts +31 -0
- package/dist/server/export/plugin.mjs +69 -0
- package/dist/server/export/run.d.mts +9 -0
- package/dist/server/export/run.mjs +61 -0
- package/dist/server/export/save.d.mts +7 -0
- package/dist/server/export/save.mjs +29 -0
- package/dist/server/hosted.d.mts +8 -0
- package/dist/server/hosted.mjs +78 -0
- package/dist/server/live-mirror.mjs +66 -10
- package/dist/server/live.mjs +28 -1
- package/dist/server/mcp.mjs +2 -0
- package/dist/server/me.d.mts +2 -0
- package/dist/server/me.mjs +8 -2
- package/dist/server/notices.d.mts +1 -1
- package/dist/server/notices.mjs +1 -1
- package/dist/server/own-copies.mjs +1 -1
- package/dist/server/people.d.mts +7 -2
- package/dist/server/people.mjs +6 -2
- package/dist/server/pictures.d.mts +1 -1
- package/dist/server/pictures.mjs +2 -2
- package/dist/server/prebundle.d.mts +32 -0
- package/dist/server/prebundle.mjs +115 -0
- package/dist/server/problems.d.mts +8 -0
- package/dist/server/problems.mjs +13 -0
- package/dist/server/requests.mjs +43 -30
- package/dist/server/source-stamp.d.mts +4 -3
- package/dist/server/source-stamp.mjs +60 -31
- package/dist/server/state.d.mts +19 -10
- package/dist/server/state.mjs +27 -18
- package/dist/server/thread-source.d.mts +8 -0
- package/dist/server/thread-source.mjs +24 -5
- package/dist/server/tools/export.d.mts +5 -0
- package/dist/server/tools/export.mjs +35 -0
- package/dist/server/tools/place-frame.mjs +16 -16
- package/dist/server/tools/thread-list.mjs +1 -1
- package/dist/server/vite.d.mts +9 -4
- package/dist/server/vite.mjs +63 -61
- package/dist/server/welcome.mjs +2 -1
- package/dist/setup/apply.d.mts +4 -0
- package/dist/setup/apply.mjs +5 -4
- package/dist/setup/create.mjs +5 -5
- package/dist/setup/design-system-checks.mjs +1 -6
- package/dist/setup/detect/workspace.d.mts +10 -10
- package/dist/setup/detect/workspace.mjs +10 -12
- package/dist/setup/doctor.d.mts +4 -1
- package/dist/setup/doctor.mjs +7 -5
- package/dist/setup/migrate/dex-folder.d.mts +61 -0
- package/dist/setup/migrate/dex-folder.mjs +544 -0
- package/dist/setup/migrate/files-folder.mjs +1 -1
- package/dist/setup/migrate/guides.mjs +1 -1
- package/dist/setup/migrate/migrations.mjs +4 -0
- package/dist/setup/migrate/setup-files.d.mts +5 -0
- package/dist/setup/migrate/setup-files.mjs +115 -0
- package/dist/setup/migrate/studio-state.d.mts +2 -2
- package/dist/setup/migrate/studio-state.mjs +4 -4
- package/dist/setup/placement.d.mts +1 -1
- package/dist/setup/placement.mjs +5 -4
- package/dist/setup/plan.d.mts +5 -5
- package/dist/setup/plan.mjs +8 -12
- package/dist/setup/project.mjs +1 -1
- package/dist/setup/prompts.d.mts +2 -1
- package/dist/setup/prompts.mjs +4 -3
- package/dist/setup/questions.mjs +3 -2
- package/dist/setup/starters.d.mts +1 -1
- package/dist/setup/starters.mjs +2 -2
- package/dist/setup/write.d.mts +15 -3
- package/dist/setup/write.mjs +23 -3
- package/dist/shared/canvas-core.d.mts +22 -7
- package/dist/shared/canvas-core.mjs +38 -10
- package/dist/shared/comments/routes.d.mts +3 -1
- package/dist/shared/comments/routes.mjs +4 -2
- package/dist/shared/export-core.d.mts +62 -0
- package/dist/shared/export-core.mjs +101 -0
- package/dist/shared/live-core.d.mts +2 -0
- package/dist/shared/live-core.mjs +6 -1
- package/dist/shared/live-presence.d.mts +57 -2
- package/dist/shared/live-presence.mjs +90 -4
- package/dist/shared/page-messages.d.mts +14 -1
- package/dist/shared/page-messages.mjs +30 -3
- package/dist/shared/people-core.d.mts +28 -0
- package/dist/shared/people-core.mjs +27 -1
- package/dist/shared/presence-core.d.mts +2 -0
- package/dist/shared/references-core.d.mts +4 -0
- package/dist/shared/references-core.mjs +12 -4
- package/dist/shared/studio-files.d.mts +9 -0
- package/dist/shared/studio-files.mjs +11 -2
- package/dist/shared/studio-routes.d.mts +13 -1
- package/dist/shared/threads-core.d.mts +27 -4
- package/dist/shared/threads-core.mjs +67 -12
- package/extension/dist/feedback.js +104 -294
- package/extension/dist/manifest.json +1 -1
- package/extension/dist/picker.js +104 -294
- package/package.json +2 -2
- package/src/cli/commands/create.ts +4 -4
- package/src/cli/commands/export.ts +78 -0
- package/src/cli/commands/upgrade.ts +1 -1
- package/src/cli/help.ts +13 -7
- package/src/cli/main.ts +1 -0
- package/src/config/load.ts +26 -2
- package/src/config/project-files.ts +15 -0
- package/src/config/renamed.ts +19 -1
- package/src/content/commands.ts +30 -18
- package/src/content/comments-log.ts +4 -1
- package/src/content/content.ts +64 -16
- package/src/content/element-words.ts +175 -0
- package/src/content/hosted-person.ts +107 -0
- package/src/content/merge-rules.ts +29 -0
- package/src/content/screenshot.ts +14 -0
- package/src/content/text-edit.ts +172 -105
- package/src/content/text-replace.ts +3 -32
- package/src/content/thread-module.ts +2 -4
- package/src/content/trash.ts +1 -1
- package/src/server/agents.ts +48 -17
- package/src/server/canvas-presence.ts +237 -0
- package/src/server/channel.ts +1 -1
- package/src/server/command-settings.ts +1 -1
- package/src/server/comments/actions.ts +0 -19
- package/src/server/comments/routes.ts +9 -54
- package/src/server/dev-server.ts +66 -26
- package/src/server/export/build.ts +310 -0
- package/src/server/export/page.ts +85 -0
- package/src/server/export/plugin.ts +138 -0
- package/src/server/export/run.ts +79 -0
- package/src/server/export/save.ts +38 -0
- package/src/server/hosted.ts +113 -0
- package/src/server/live-mirror.ts +93 -8
- package/src/server/live.ts +46 -1
- package/src/server/machine-update.ts +3 -3
- package/src/server/mcp.ts +2 -0
- package/src/server/me.ts +10 -1
- package/src/server/notices.ts +2 -2
- package/src/server/people.ts +11 -2
- package/src/server/pictures.ts +2 -2
- package/src/server/prebundle.ts +230 -0
- package/src/server/presence.ts +1 -1
- package/src/server/problems.ts +11 -0
- package/src/server/requests.ts +55 -40
- package/src/server/roster.ts +1 -1
- package/src/server/saved.ts +1 -1
- package/src/server/source-stamp.ts +118 -37
- package/src/server/state.ts +53 -31
- package/src/server/thread-source.ts +35 -3
- package/src/server/tools/export.ts +56 -0
- package/src/server/tools/place-frame.ts +23 -15
- package/src/server/tools/thread-list.ts +1 -1
- package/src/server/updates.ts +2 -2
- package/src/server/vite.ts +106 -110
- package/src/server/welcome.ts +3 -1
- package/src/setup/apply.ts +8 -5
- package/src/setup/create.ts +10 -10
- package/src/setup/design-system-checks.ts +1 -6
- package/src/setup/detect/workspace.ts +20 -21
- package/src/setup/doctor.ts +13 -6
- package/src/setup/migrate/dex-folder.ts +842 -0
- package/src/setup/migrate/files-folder.ts +1 -1
- package/src/setup/migrate/guides.ts +3 -1
- package/src/setup/migrate/migrations.ts +8 -2
- package/src/setup/migrate/setup-files.ts +198 -0
- package/src/setup/migrate/studio-state.ts +12 -10
- package/src/setup/own-app.ts +1 -1
- package/src/setup/placement.ts +7 -6
- package/src/setup/plan.ts +13 -18
- package/src/setup/project.ts +2 -2
- package/src/setup/prompts.ts +5 -4
- package/src/setup/questions.ts +6 -3
- package/src/setup/starters.ts +3 -3
- package/src/setup/write.ts +34 -3
- package/src/shared/canvas-core.ts +48 -9
- package/src/shared/comments/routes.ts +3 -1
- package/src/shared/export-core.ts +198 -0
- package/src/shared/live-core.ts +8 -0
- package/src/shared/live-presence.ts +171 -2
- package/src/shared/page-messages.ts +38 -2
- package/src/shared/people-core.ts +44 -0
- package/src/shared/presence-core.ts +2 -0
- package/src/shared/references-core.ts +22 -3
- package/src/shared/studio-files.ts +15 -1
- package/src/shared/studio-routes.ts +11 -1
- package/src/shared/threads-core.ts +132 -10
- package/templates/methods/explore.md +1 -1
- package/templates/methods/handoff.md +1 -1
- package/templates/methods/review.md +2 -1
- package/templates/rules/canvas-frames.md +6 -3
- package/templates/rules/commands.md +1 -0
- package/templates/rules/prototypes.md +1 -1
- package/templates/rules/studio.md +17 -11
- package/templates/skills/comprehend/SKILL.md +56 -0
- package/templates/skills/distill/SKILL.md +172 -0
- package/templates/skills/export-prototype/SKILL.md +35 -0
- package/templates/skills/riff/SKILL.md +21 -0
- package/templates/skills/riff-deep/SKILL.md +40 -0
- package/templates/skills/riff-max/SKILL.md +46 -0
- package/templates/skills/riff-state/SKILL.md +45 -0
- package/templates/skills/riff-up/SKILL.md +38 -0
- package/templates/skills/riff-wide/SKILL.md +40 -0
- package/templates/starters/standalone/README.md +1 -1
- package/templates/starters/turborepo/README.md +2 -2
- package/templates/starters/turborepo/apps/web/src/app.tsx +2 -2
- package/templates/starters/vite/README.md +1 -1
package/app/canvas/comments.tsx
CHANGED
|
@@ -76,7 +76,7 @@ import {
|
|
|
76
76
|
} from "../shell/thread-list";
|
|
77
77
|
import { shortTimeAgo } from "../shell/time-ago";
|
|
78
78
|
import type { Thread, ThreadAudience, ThreadTarget } from "../types";
|
|
79
|
-
import {
|
|
79
|
+
import { PromptEditor } from "../ui/prompt-editor";
|
|
80
80
|
import { ReferenceDetails, ReferenceText } from "../ui/reference";
|
|
81
81
|
import {
|
|
82
82
|
type ScreenPoint,
|
|
@@ -92,6 +92,16 @@ import {
|
|
|
92
92
|
} from "./command-menu";
|
|
93
93
|
import { acceptRename } from "./flow-renames";
|
|
94
94
|
import { useFollowPin } from "./follow-pin";
|
|
95
|
+
import {
|
|
96
|
+
MessageWords,
|
|
97
|
+
mentionsMe,
|
|
98
|
+
mentionTrigger,
|
|
99
|
+
POSTED_TRIGGERS,
|
|
100
|
+
useFrames,
|
|
101
|
+
useMentionable,
|
|
102
|
+
usePeople,
|
|
103
|
+
usePostedDetails,
|
|
104
|
+
} from "./mentions";
|
|
95
105
|
import { overPin, QUICK_BAR_GAP } from "./quick-bar";
|
|
96
106
|
import {
|
|
97
107
|
ReviewMarker,
|
|
@@ -430,10 +440,23 @@ export const MessageInput = ({
|
|
|
430
440
|
}) => {
|
|
431
441
|
const [body, setBody] = useState(initial);
|
|
432
442
|
const { t } = useLingui();
|
|
433
|
-
const
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
443
|
+
const people = usePeople({ ask: true });
|
|
444
|
+
const frames = useFrames();
|
|
445
|
+
const triggers = useMemo(() => {
|
|
446
|
+
// The "@" menu is named for what it lists.
|
|
447
|
+
let mentions = t`People and frames`;
|
|
448
|
+
if (frames.length === 0) {
|
|
449
|
+
mentions = t`People`;
|
|
450
|
+
} else if (people.length === 0) {
|
|
451
|
+
mentions = t`Frames`;
|
|
452
|
+
}
|
|
453
|
+
return [
|
|
454
|
+
...(commands.length > 0 ? [commandTrigger(commands, t`Commands`)] : []),
|
|
455
|
+
...(people.length > 0 || frames.length > 0
|
|
456
|
+
? [mentionTrigger(people, frames, mentions)]
|
|
457
|
+
: []),
|
|
458
|
+
];
|
|
459
|
+
}, [commands, frames, people, t]);
|
|
437
460
|
const sendBody = useStudioAction(
|
|
438
461
|
async (text: string) => {
|
|
439
462
|
// False keeps the words: the post was held back, not made.
|
|
@@ -783,7 +806,7 @@ export const Reactions = ({
|
|
|
783
806
|
);
|
|
784
807
|
};
|
|
785
808
|
|
|
786
|
-
/** A message's words, with the commands it names as chips. */
|
|
809
|
+
/** A message's words, with the commands and people it names as chips. */
|
|
787
810
|
const MessageText = ({ body }: { body: string }) =>
|
|
788
811
|
body ? (
|
|
789
812
|
<p className="whitespace-pre-wrap">
|
|
@@ -791,9 +814,6 @@ const MessageText = ({ body }: { body: string }) =>
|
|
|
791
814
|
</p>
|
|
792
815
|
) : null;
|
|
793
816
|
|
|
794
|
-
/** The triggers a posted message's chips can start with: commands'. */
|
|
795
|
-
const POSTED_TRIGGERS = ["/"];
|
|
796
|
-
|
|
797
817
|
/** One entry in a thread: who, when, what they said, and anything under it. */
|
|
798
818
|
const Entry = ({
|
|
799
819
|
agent,
|
|
@@ -884,7 +904,7 @@ const ClosingLine = ({ body }: { body: string }) => {
|
|
|
884
904
|
<p
|
|
885
905
|
className={cn("whitespace-pre-wrap", long && !whole && "line-clamp-4")}
|
|
886
906
|
>
|
|
887
|
-
{body}
|
|
907
|
+
<MessageWords text={body} />
|
|
888
908
|
</p>
|
|
889
909
|
{long ? (
|
|
890
910
|
<Button
|
|
@@ -1233,15 +1253,12 @@ export const ThreadBody = ({
|
|
|
1233
1253
|
threads: ThreadsApi;
|
|
1234
1254
|
}) => {
|
|
1235
1255
|
const { i18n, t } = useLingui();
|
|
1236
|
-
// Every command: the details of those its messages name (
|
|
1237
|
-
// left the / menu since), and, in work for the agent,
|
|
1238
|
-
// edit can run as well.
|
|
1256
|
+
// Every command and person: the details of those its messages name (a
|
|
1257
|
+
// command may have left the / menu since), and, in work for the agent,
|
|
1258
|
+
// what a reply or an edit can run as well.
|
|
1239
1259
|
const [answer] = useCommands(!GUEST_REVIEW);
|
|
1240
1260
|
const known = answer?.commands ?? NO_COMMANDS;
|
|
1241
|
-
const describe =
|
|
1242
|
-
() => detailsOf([commandTrigger(known, "")]),
|
|
1243
|
-
[known]
|
|
1244
|
-
);
|
|
1261
|
+
const describe = usePostedDetails();
|
|
1245
1262
|
const commands = audienceOf(thread) === "agent" ? known : NO_COMMANDS;
|
|
1246
1263
|
const closed = isClosed(thread);
|
|
1247
1264
|
const state = threadState(thread);
|
|
@@ -1675,9 +1692,12 @@ export const usePinFilter = (showResolved: boolean, activeThread?: string) => {
|
|
|
1675
1692
|
} = useCommentsView();
|
|
1676
1693
|
const canvas = useCanvasIfAny();
|
|
1677
1694
|
const isTeamComment = useIsTeamComment(canvas?.prototype.slug ?? "");
|
|
1695
|
+
const me = useMentionable();
|
|
1678
1696
|
const resolvedShown = showResolved && status !== "open";
|
|
1679
|
-
// On a deployed studio, "You" leaves only a guest's own pins
|
|
1697
|
+
// On a deployed studio, "You" leaves only a guest's own pins; Mentions,
|
|
1698
|
+
// only those of threads that mention you.
|
|
1680
1699
|
const onlyYours = audience === "yours";
|
|
1700
|
+
const onlyMentions = audience === "mentions";
|
|
1681
1701
|
// Reviewers' imported comments stay within Reviews: on the canvas while
|
|
1682
1702
|
// it shows (one review's, when one is picked), and never beside the team's.
|
|
1683
1703
|
if (reviewsShowing) {
|
|
@@ -1689,7 +1709,8 @@ export const usePinFilter = (showResolved: boolean, activeThread?: string) => {
|
|
|
1689
1709
|
thread.id === activeThread ||
|
|
1690
1710
|
(isTeamComment(thread) &&
|
|
1691
1711
|
(resolvedShown || !isClosed(thread)) &&
|
|
1692
|
-
!(onlyYours && !isGuestThread(thread))
|
|
1712
|
+
!(onlyYours && !isGuestThread(thread)) &&
|
|
1713
|
+
!(onlyMentions && !mentionsMe(me)(thread)));
|
|
1693
1714
|
};
|
|
1694
1715
|
|
|
1695
1716
|
/**
|
|
@@ -1966,14 +1987,15 @@ const says = (query: string) => {
|
|
|
1966
1987
|
|
|
1967
1988
|
/**
|
|
1968
1989
|
* The threads `filter` shows that say `query`: open ones (the agent's
|
|
1969
|
-
* replies first, then newest), then resolved ones, newest first.
|
|
1990
|
+
* replies first, then newest), then resolved ones, newest first. `me`, a
|
|
1991
|
+
* contributor's slug, is who Mentions is for.
|
|
1970
1992
|
*/
|
|
1971
1993
|
export const filterThreads = <T extends Thread>(
|
|
1972
1994
|
threads: T[],
|
|
1973
1995
|
{ audience, status }: CommentFilter,
|
|
1974
|
-
query = ""
|
|
1996
|
+
{ me, query = "" }: { me?: string; query?: string } = {}
|
|
1975
1997
|
) => {
|
|
1976
|
-
const mine = threads.filter(byFilter(audience)).filter(says(query));
|
|
1998
|
+
const mine = threads.filter(byFilter(audience, me)).filter(says(query));
|
|
1977
1999
|
const open = mine.filter((thread) => !isClosed(thread)).sort(yourTurnFirst);
|
|
1978
2000
|
const closed =
|
|
1979
2001
|
status === "open" ? [] : mine.filter(isClosed).sort(newestFirst);
|
|
@@ -1997,6 +2019,15 @@ const emptyCopy = (
|
|
|
1997
2019
|
),
|
|
1998
2020
|
};
|
|
1999
2021
|
}
|
|
2022
|
+
if (filter.audience === "mentions") {
|
|
2023
|
+
return {
|
|
2024
|
+
icon: "AtSign",
|
|
2025
|
+
title: <Trans>No mentions</Trans>,
|
|
2026
|
+
line: (
|
|
2027
|
+
<Trans>Comments where someone writes @ and your name show here.</Trans>
|
|
2028
|
+
),
|
|
2029
|
+
};
|
|
2030
|
+
}
|
|
2000
2031
|
if (filter.audience === "people") {
|
|
2001
2032
|
return {
|
|
2002
2033
|
icon: "MessageCircle",
|
|
@@ -2061,6 +2092,7 @@ const FROM_OPTIONS: { id: ThreadFilter; label: MessageDescriptor }[] =
|
|
|
2061
2092
|
{ id: "all", label: msg`All` },
|
|
2062
2093
|
{ id: "people", label: msg`People` },
|
|
2063
2094
|
{ id: "agents", label: msg`Agents` },
|
|
2095
|
+
{ id: "mentions", label: msg`Mentions` },
|
|
2064
2096
|
];
|
|
2065
2097
|
|
|
2066
2098
|
/**
|
|
@@ -2075,6 +2107,8 @@ const FilterMenu = ({
|
|
|
2075
2107
|
value: CommentFilter;
|
|
2076
2108
|
}) => {
|
|
2077
2109
|
const { i18n, t } = useLingui();
|
|
2110
|
+
// Only someone the workspace knows can be mentioned.
|
|
2111
|
+
const known = useMentionable() !== undefined;
|
|
2078
2112
|
const label = t`Filter comments`;
|
|
2079
2113
|
const filtered = value.audience !== DEFAULT_FILTER.audience;
|
|
2080
2114
|
return (
|
|
@@ -2108,11 +2142,13 @@ const FilterMenu = ({
|
|
|
2108
2142
|
}
|
|
2109
2143
|
value={value.audience}
|
|
2110
2144
|
>
|
|
2111
|
-
{FROM_OPTIONS.
|
|
2112
|
-
|
|
2113
|
-
{
|
|
2114
|
-
|
|
2115
|
-
|
|
2145
|
+
{FROM_OPTIONS.filter(({ id }) => known || id !== "mentions").map(
|
|
2146
|
+
({ id, label: name }) => (
|
|
2147
|
+
<DropdownMenuRadioItem key={id} value={id}>
|
|
2148
|
+
{i18n._(name)}
|
|
2149
|
+
</DropdownMenuRadioItem>
|
|
2150
|
+
)
|
|
2151
|
+
)}
|
|
2116
2152
|
</DropdownMenuRadioGroup>
|
|
2117
2153
|
</DropdownMenuGroup>
|
|
2118
2154
|
</DropdownMenuContent>
|
|
@@ -2269,14 +2305,15 @@ const CommentsBody = ({
|
|
|
2269
2305
|
query: string;
|
|
2270
2306
|
threads: Thread[];
|
|
2271
2307
|
}) => {
|
|
2272
|
-
const
|
|
2308
|
+
const me = useMentionable();
|
|
2309
|
+
const shown = filterThreads(threads, filter, { me, query });
|
|
2273
2310
|
const words = query.trim();
|
|
2274
2311
|
// A search that finds nothing says so in a line, where without it the
|
|
2275
2312
|
// filter would show threads.
|
|
2276
2313
|
if (
|
|
2277
2314
|
words !== "" &&
|
|
2278
2315
|
shown.length === 0 &&
|
|
2279
|
-
filterThreads(threads, filter).length > 0
|
|
2316
|
+
filterThreads(threads, filter, { me }).length > 0
|
|
2280
2317
|
) {
|
|
2281
2318
|
return (
|
|
2282
2319
|
<p className="px-3 py-4 text-center text-muted-foreground">
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import { isRecord, isText } from "../../src/shared/checks.ts";
|
|
2
|
+
import {
|
|
3
|
+
type ChangePlace,
|
|
4
|
+
changePlace,
|
|
5
|
+
type PlacedElement,
|
|
6
|
+
} from "../../src/shared/threads-core.ts";
|
|
7
|
+
import type { ThreadTarget } from "../types";
|
|
8
|
+
|
|
9
|
+
// A link to elements on a frame (?element=<place>), copied from the menu a
|
|
10
|
+
// right-click on a frame opens: to the element under the pointer. It finds
|
|
11
|
+
// its frame as an agent's "where" does (changePlace), after the frame moves,
|
|
12
|
+
// and its elements as a comment's pin does: by selector, words and the code
|
|
13
|
+
// that renders them, in the states of the page they are in, folded onto
|
|
14
|
+
// what opens them while that is closed. Opening one: linked-element.tsx.
|
|
15
|
+
|
|
16
|
+
/** The query parameter that holds a link's place. */
|
|
17
|
+
const ELEMENT_PARAM = "element";
|
|
18
|
+
|
|
19
|
+
/** The longest of each thing kept about an element, as a comment keeps it. */
|
|
20
|
+
const MOST = { code: 300, selector: 500, text: 200, state: 200 } as const;
|
|
21
|
+
/** At most this many states, openers or more elements. */
|
|
22
|
+
const MOST_ENTRIES = 10;
|
|
23
|
+
|
|
24
|
+
const shortText = (value: unknown, most: number): string | undefined =>
|
|
25
|
+
isText(value) && value.length <= most ? value : undefined;
|
|
26
|
+
|
|
27
|
+
const states = (value: unknown): string[] | undefined => {
|
|
28
|
+
if (!Array.isArray(value)) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const kept = value
|
|
32
|
+
.slice(0, MOST_ENTRIES)
|
|
33
|
+
.flatMap((state) => shortText(state, MOST.state) ?? []);
|
|
34
|
+
return kept.length > 0 ? kept : undefined;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** An element as a link keeps it, with only the fields it has. */
|
|
38
|
+
const placedElement = (value: unknown): PlacedElement | undefined => {
|
|
39
|
+
if (!isRecord(value)) {
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
const selector = shortText(value.selector, MOST.selector);
|
|
43
|
+
if (!selector) {
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
const code = shortText(value.code, MOST.code);
|
|
47
|
+
const text = shortText(value.text, MOST.text);
|
|
48
|
+
const within = states(value.within);
|
|
49
|
+
return {
|
|
50
|
+
selector,
|
|
51
|
+
...(code ? { code } : {}),
|
|
52
|
+
...(text ? { text } : {}),
|
|
53
|
+
...(within ? { within } : {}),
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const placedElements = (value: unknown): PlacedElement[] | undefined => {
|
|
58
|
+
if (!Array.isArray(value)) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
const kept = value
|
|
62
|
+
.slice(0, MOST_ENTRIES)
|
|
63
|
+
.flatMap((entry) => placedElement(entry) ?? []);
|
|
64
|
+
return kept.length > 0 ? kept : undefined;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
/**
|
|
68
|
+
* A place a link can go to, from what it says: its frame and view (as
|
|
69
|
+
* changePlace keeps them) and, for elements, how to find them on the page.
|
|
70
|
+
* Anything else is left out.
|
|
71
|
+
*/
|
|
72
|
+
const readPlace = (value: unknown): ChangePlace | undefined => {
|
|
73
|
+
const place = changePlace(value);
|
|
74
|
+
if (!(place && place.kind === "element" && isRecord(value))) {
|
|
75
|
+
return place;
|
|
76
|
+
}
|
|
77
|
+
const first = placedElement(value);
|
|
78
|
+
const openers = placedElements(value.openers);
|
|
79
|
+
const also = placedElements(value.also);
|
|
80
|
+
return {
|
|
81
|
+
...place,
|
|
82
|
+
...first,
|
|
83
|
+
...(openers ? { openers } : {}),
|
|
84
|
+
...(also ? { also } : {}),
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* Where a link to what a comment would be on goes: its elements, or else its
|
|
90
|
+
* whole frame. None for what is on no frame.
|
|
91
|
+
*/
|
|
92
|
+
export const placeToLink = (target: ThreadTarget): ChangePlace | undefined => {
|
|
93
|
+
if (!(target.kind === "element" || target.kind === "frame")) {
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
return (
|
|
97
|
+
readPlace(target) ??
|
|
98
|
+
changePlace({
|
|
99
|
+
kind: "frame",
|
|
100
|
+
frame: target.frame,
|
|
101
|
+
view: target.view,
|
|
102
|
+
params: target.params,
|
|
103
|
+
})
|
|
104
|
+
);
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/** A link to a place, on the canvas open at `href`. */
|
|
108
|
+
export const elementLink = (place: ChangePlace, href: string): string => {
|
|
109
|
+
const url = new URL(href);
|
|
110
|
+
url.search = new URLSearchParams({
|
|
111
|
+
[ELEMENT_PARAM]: JSON.stringify(place),
|
|
112
|
+
}).toString();
|
|
113
|
+
url.hash = "";
|
|
114
|
+
return url.toString();
|
|
115
|
+
};
|
|
116
|
+
|
|
117
|
+
/** The place an address links to, if it names one Dex can read. */
|
|
118
|
+
export const placeFromAddress = (search: string): ChangePlace | undefined => {
|
|
119
|
+
const value = new URLSearchParams(search).get(ELEMENT_PARAM);
|
|
120
|
+
if (!value) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
try {
|
|
124
|
+
return readPlace(JSON.parse(value));
|
|
125
|
+
} catch {
|
|
126
|
+
return;
|
|
127
|
+
}
|
|
128
|
+
};
|
|
129
|
+
|
|
130
|
+
/** An address without its link, once the canvas has gone there. */
|
|
131
|
+
export const withoutLink = (href: string): string => {
|
|
132
|
+
const url = new URL(href);
|
|
133
|
+
url.searchParams.delete(ELEMENT_PARAM);
|
|
134
|
+
return url.toString();
|
|
135
|
+
};
|
|
@@ -124,6 +124,29 @@ export const textRun = (element: Element): Text[] | undefined => {
|
|
|
124
124
|
export const isEditableText = (element: Element) =>
|
|
125
125
|
textRun(element) !== undefined;
|
|
126
126
|
|
|
127
|
+
/** Where the dev server stamps an element's words as written (source-stamp.ts). */
|
|
128
|
+
const TEXT_PLACE = "data-studio-text";
|
|
129
|
+
|
|
130
|
+
const textOfElement = (element: Element) =>
|
|
131
|
+
(element.textContent ?? "").replace(WHITESPACE_RE, " ").trim();
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* Where an element's text is written in the code, as the dev server stamps
|
|
135
|
+
* it: the element's own place, or that of the component around it when it
|
|
136
|
+
* shows only this text (a button's label in a span of its own). None when
|
|
137
|
+
* the text is written elsewhere, or what is around it says more.
|
|
138
|
+
*/
|
|
139
|
+
export const textPlace = (element: Element): string | undefined => {
|
|
140
|
+
const stamped = element.closest(`[${TEXT_PLACE}]`);
|
|
141
|
+
if (
|
|
142
|
+
!stamped ||
|
|
143
|
+
(stamped !== element && textOfElement(stamped) !== textOfElement(element))
|
|
144
|
+
) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
return stamped.getAttribute(TEXT_PLACE) ?? undefined;
|
|
148
|
+
};
|
|
149
|
+
|
|
127
150
|
/** Whether an element shows: not hidden, nor see-through. */
|
|
128
151
|
const shows = (element: Element) =>
|
|
129
152
|
element.checkVisibility?.({
|
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
import type { MessageDescriptor } from "@lingui/core";
|
|
2
|
+
import { msg } from "@lingui/core/macro";
|
|
3
|
+
import { Trans, useLingui } from "@lingui/react/macro";
|
|
4
|
+
import { Button } from "@studio/ui/shadcn/button";
|
|
5
|
+
import { Checkbox } from "@studio/ui/shadcn/checkbox";
|
|
6
|
+
import {
|
|
7
|
+
Dialog,
|
|
8
|
+
DialogContent,
|
|
9
|
+
DialogDescription,
|
|
10
|
+
DialogFooter,
|
|
11
|
+
DialogHeader,
|
|
12
|
+
DialogTitle,
|
|
13
|
+
} from "@studio/ui/shadcn/dialog";
|
|
14
|
+
import { Spinner } from "@studio/ui/shadcn/spinner";
|
|
15
|
+
import { cn } from "cn";
|
|
16
|
+
import { useState, useSyncExternalStore } from "react";
|
|
17
|
+
import { parseFrameKey } from "../../src/shared/canvas-core.ts";
|
|
18
|
+
import {
|
|
19
|
+
AGENT_PREPARED,
|
|
20
|
+
EXPORT_COMMAND,
|
|
21
|
+
EXPORT_KINDS,
|
|
22
|
+
type ExportChoice,
|
|
23
|
+
type ExportKind,
|
|
24
|
+
exportFileName,
|
|
25
|
+
} from "../../src/shared/export-core.ts";
|
|
26
|
+
import { problemsOf } from "../live/studio-action";
|
|
27
|
+
import { studioRequest } from "../live/studio-request";
|
|
28
|
+
import { saveFile } from "../save-file";
|
|
29
|
+
import { frameTarget } from "./anchoring";
|
|
30
|
+
import { useCanvas } from "./canvas-context";
|
|
31
|
+
import type { MenuFrame } from "./frame-context-menu";
|
|
32
|
+
|
|
33
|
+
// Export…, from the frames' right-click menu: the frames, or their whole
|
|
34
|
+
// sections, as a zip that opens by double-click, offline
|
|
35
|
+
// (src/server/export/), saved where the browser saves downloads. Each kind
|
|
36
|
+
// is a card; the content and source packs need the views prepared first,
|
|
37
|
+
// which the agent does (templates/skills/export-prototype).
|
|
38
|
+
|
|
39
|
+
const KINDS: Record<
|
|
40
|
+
ExportKind,
|
|
41
|
+
{ description: MessageDescriptor; title: MessageDescriptor }
|
|
42
|
+
> = {
|
|
43
|
+
clickable: {
|
|
44
|
+
title: msg`Clickable`,
|
|
45
|
+
description: msg`One page that steps through the frames, as Play does.`,
|
|
46
|
+
},
|
|
47
|
+
pages: {
|
|
48
|
+
title: msg`Page per frame`,
|
|
49
|
+
description: msg`A page for each frame, to link to one directly.`,
|
|
50
|
+
},
|
|
51
|
+
content: {
|
|
52
|
+
title: msg`Content pack`,
|
|
53
|
+
description: msg`The words and data in content.js, to change without the code.`,
|
|
54
|
+
},
|
|
55
|
+
source: {
|
|
56
|
+
title: msg`Source pack`,
|
|
57
|
+
description: msg`The views' own files beside it, to build on.`,
|
|
58
|
+
},
|
|
59
|
+
};
|
|
60
|
+
|
|
61
|
+
// Which frames the dialog is open for: set from the menu, which closes as
|
|
62
|
+
// the dialog opens.
|
|
63
|
+
let asked: MenuFrame[] | undefined;
|
|
64
|
+
const listeners = new Set<() => void>();
|
|
65
|
+
const setAsked = (frames: MenuFrame[] | undefined) => {
|
|
66
|
+
asked = frames;
|
|
67
|
+
for (const listener of listeners) {
|
|
68
|
+
listener();
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
const subscribe = (listener: () => void) => {
|
|
72
|
+
listeners.add(listener);
|
|
73
|
+
return () => listeners.delete(listener);
|
|
74
|
+
};
|
|
75
|
+
|
|
76
|
+
/** Open Export… for these frames. */
|
|
77
|
+
export const openExport = (frames: MenuFrame[]) => setAsked(frames);
|
|
78
|
+
|
|
79
|
+
const KindCard = ({
|
|
80
|
+
checked,
|
|
81
|
+
kind,
|
|
82
|
+
onPick,
|
|
83
|
+
}: {
|
|
84
|
+
checked: boolean;
|
|
85
|
+
kind: ExportKind;
|
|
86
|
+
onPick: () => void;
|
|
87
|
+
}) => {
|
|
88
|
+
const { i18n } = useLingui();
|
|
89
|
+
return (
|
|
90
|
+
<label
|
|
91
|
+
className={cn(
|
|
92
|
+
"flex cursor-pointer flex-col items-start gap-1 rounded-lg border p-3 transition-colors has-[:focus-visible]:ring-2 has-[:focus-visible]:ring-ring",
|
|
93
|
+
checked
|
|
94
|
+
? "border-primary bg-primary/5"
|
|
95
|
+
: "border-border hover:bg-muted/60"
|
|
96
|
+
)}
|
|
97
|
+
>
|
|
98
|
+
<input
|
|
99
|
+
checked={checked}
|
|
100
|
+
className="sr-only"
|
|
101
|
+
name="export-kind"
|
|
102
|
+
onChange={onPick}
|
|
103
|
+
type="radio"
|
|
104
|
+
value={kind}
|
|
105
|
+
/>
|
|
106
|
+
<span className="font-medium">{i18n._(KINDS[kind].title)}</span>
|
|
107
|
+
<span className="text-muted-foreground text-xs">
|
|
108
|
+
{i18n._(KINDS[kind].description)}
|
|
109
|
+
</span>
|
|
110
|
+
{AGENT_PREPARED.has(kind) ? (
|
|
111
|
+
<span className="text-muted-foreground text-xs">
|
|
112
|
+
<Trans>The agent prepares the views first.</Trans>
|
|
113
|
+
</span>
|
|
114
|
+
) : null}
|
|
115
|
+
</label>
|
|
116
|
+
);
|
|
117
|
+
};
|
|
118
|
+
|
|
119
|
+
const ExportDialog = ({
|
|
120
|
+
frames,
|
|
121
|
+
onClose,
|
|
122
|
+
}: {
|
|
123
|
+
frames: MenuFrame[];
|
|
124
|
+
onClose: () => void;
|
|
125
|
+
}) => {
|
|
126
|
+
const { i18n, t } = useLingui();
|
|
127
|
+
const { editor, prototype, threads } = useCanvas();
|
|
128
|
+
const [kind, setKind] = useState<ExportKind>("clickable");
|
|
129
|
+
const [whole, setWhole] = useState(false);
|
|
130
|
+
const [flows, setFlows] = useState(false);
|
|
131
|
+
const [working, setWorking] = useState(false);
|
|
132
|
+
const [problem, setProblem] = useState<string>();
|
|
133
|
+
|
|
134
|
+
const keys = frames.map(({ key }) => key);
|
|
135
|
+
const sections = [...new Set(keys.map((key) => parseFrameKey(key).section))];
|
|
136
|
+
// Each row is a flow to switch to: there is a choice only with two or more.
|
|
137
|
+
const flowCount = whole
|
|
138
|
+
? editor.canvas.sections
|
|
139
|
+
.filter((section) => sections.includes(section.id))
|
|
140
|
+
.reduce((count, section) => count + section.rows.length, 0)
|
|
141
|
+
: new Set(
|
|
142
|
+
keys.map((key) => {
|
|
143
|
+
const { row, section } = parseFrameKey(key);
|
|
144
|
+
return `${section}/${row}`;
|
|
145
|
+
})
|
|
146
|
+
).size;
|
|
147
|
+
const switching = flows && flowCount > 1;
|
|
148
|
+
const choice: ExportChoice = {
|
|
149
|
+
kind,
|
|
150
|
+
flows: switching,
|
|
151
|
+
...(whole ? { sections } : { frames: keys }),
|
|
152
|
+
};
|
|
153
|
+
|
|
154
|
+
const exportNow = async () => {
|
|
155
|
+
setWorking(true);
|
|
156
|
+
setProblem(undefined);
|
|
157
|
+
try {
|
|
158
|
+
const zip = await studioRequest("export", {
|
|
159
|
+
method: "POST",
|
|
160
|
+
query: { slug: prototype.slug },
|
|
161
|
+
body: choice,
|
|
162
|
+
});
|
|
163
|
+
saveFile(zip, exportFileName(prototype.title ?? prototype.slug));
|
|
164
|
+
onClose();
|
|
165
|
+
} catch (error) {
|
|
166
|
+
setProblem(problemsOf(error, i18n).join(" ") || t`The export failed.`);
|
|
167
|
+
} finally {
|
|
168
|
+
setWorking(false);
|
|
169
|
+
}
|
|
170
|
+
};
|
|
171
|
+
|
|
172
|
+
const askAgent = () => {
|
|
173
|
+
const [first] = frames;
|
|
174
|
+
if (!first) {
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
const scope = whole
|
|
178
|
+
? t`their sections (${sections.join(", ")})`
|
|
179
|
+
: t`these frames (${keys.join(", ")})`;
|
|
180
|
+
threads.create(
|
|
181
|
+
frameTarget(first.key, first.frame),
|
|
182
|
+
`/${EXPORT_COMMAND} ${kind}: ${scope}${switching ? t`, letting people switch flows` : ""}.`
|
|
183
|
+
);
|
|
184
|
+
onClose();
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
return (
|
|
188
|
+
<Dialog onOpenChange={(open) => (open ? undefined : onClose())} open>
|
|
189
|
+
<DialogContent className="sm:max-w-lg">
|
|
190
|
+
<DialogHeader>
|
|
191
|
+
<DialogTitle>
|
|
192
|
+
<Trans>Export frames</Trans>
|
|
193
|
+
</DialogTitle>
|
|
194
|
+
<DialogDescription>
|
|
195
|
+
<Trans>
|
|
196
|
+
A zip that opens by double-click, offline: a page, its script and
|
|
197
|
+
its stylesheet. It goes to your downloads.
|
|
198
|
+
</Trans>
|
|
199
|
+
</DialogDescription>
|
|
200
|
+
</DialogHeader>
|
|
201
|
+
<fieldset className="grid grid-cols-2 gap-2">
|
|
202
|
+
<legend className="sr-only">
|
|
203
|
+
<Trans>What to export</Trans>
|
|
204
|
+
</legend>
|
|
205
|
+
{EXPORT_KINDS.map((each) => (
|
|
206
|
+
<KindCard
|
|
207
|
+
checked={kind === each}
|
|
208
|
+
key={each}
|
|
209
|
+
kind={each}
|
|
210
|
+
onPick={() => setKind(each)}
|
|
211
|
+
/>
|
|
212
|
+
))}
|
|
213
|
+
</fieldset>
|
|
214
|
+
<div className="flex flex-col gap-2">
|
|
215
|
+
{/* biome-ignore lint/a11y/noLabelWithoutControl: the checkbox is inside the label */}
|
|
216
|
+
<label className="flex items-center gap-2">
|
|
217
|
+
<Checkbox
|
|
218
|
+
checked={whole}
|
|
219
|
+
onCheckedChange={(checked) => setWhole(checked)}
|
|
220
|
+
/>
|
|
221
|
+
{sections.length > 1 ? (
|
|
222
|
+
<Trans>All of their {sections.length} sections</Trans>
|
|
223
|
+
) : (
|
|
224
|
+
<Trans>All of their section</Trans>
|
|
225
|
+
)}
|
|
226
|
+
</label>
|
|
227
|
+
{flowCount > 1 ? (
|
|
228
|
+
// biome-ignore lint/a11y/noLabelWithoutControl: the checkbox is inside the label
|
|
229
|
+
<label className="flex items-center gap-2">
|
|
230
|
+
<Checkbox
|
|
231
|
+
checked={flows}
|
|
232
|
+
onCheckedChange={(checked) => setFlows(checked)}
|
|
233
|
+
/>
|
|
234
|
+
<Trans>Let people switch between flows</Trans>
|
|
235
|
+
</label>
|
|
236
|
+
) : null}
|
|
237
|
+
</div>
|
|
238
|
+
{problem ? (
|
|
239
|
+
<p className="text-destructive text-sm" role="alert">
|
|
240
|
+
{problem}
|
|
241
|
+
</p>
|
|
242
|
+
) : null}
|
|
243
|
+
<DialogFooter>
|
|
244
|
+
{AGENT_PREPARED.has(kind) ? (
|
|
245
|
+
<Button onClick={askAgent} variant="outline">
|
|
246
|
+
<Trans>Ask the agent to prepare it</Trans>
|
|
247
|
+
</Button>
|
|
248
|
+
) : null}
|
|
249
|
+
<Button disabled={working} onClick={exportNow}>
|
|
250
|
+
{working ? <Spinner /> : null}
|
|
251
|
+
{working ? <Trans>Exporting…</Trans> : <Trans>Export</Trans>}
|
|
252
|
+
</Button>
|
|
253
|
+
</DialogFooter>
|
|
254
|
+
</DialogContent>
|
|
255
|
+
</Dialog>
|
|
256
|
+
);
|
|
257
|
+
};
|
|
258
|
+
|
|
259
|
+
/** Where Export… opens, on the canvas. */
|
|
260
|
+
export const ExportDialogHost = () => {
|
|
261
|
+
const frames = useSyncExternalStore(subscribe, () => asked);
|
|
262
|
+
return frames ? (
|
|
263
|
+
<ExportDialog frames={frames} onClose={() => setAsked(undefined)} />
|
|
264
|
+
) : null;
|
|
265
|
+
};
|