@zyro-sec/session-ui 0.0.0-stage → 1.0.4
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/AGENTS.md +25 -0
- package/bunfig.toml +2 -0
- package/component-tests/basic-tool.fixture.tsx +46 -0
- package/component-tests/basic-tool.spec.ts +63 -0
- package/component-tests/file-media.fixture.tsx +39 -0
- package/component-tests/file-media.spec.ts +13 -0
- package/component-tests/file-tool.spec.ts +62 -0
- package/component-tests/file-viewer.fixture.tsx +109 -0
- package/component-tests/file-viewer.spec.ts +134 -0
- package/component-tests/file.spec.ts +33 -0
- package/component-tests/line-comment-v2.spec.ts +15 -0
- package/component-tests/markdown-code-wrap.spec.ts +94 -0
- package/component-tests/markdown-readiness.spec.ts +95 -0
- package/component-tests/markdown.fixture.tsx +104 -0
- package/component-tests/markdown.spec.ts +1564 -0
- package/component-tests/mermaid-preview.spec.ts +43 -0
- package/component-tests/patch-group.spec.ts +79 -0
- package/component-tests/read-group.spec.ts +72 -0
- package/component-tests/read-image.fixture.tsx +66 -0
- package/component-tests/read-image.spec.ts +154 -0
- package/component-tests/session-compaction.spec.ts +254 -0
- package/component-tests/session-lifecycle.spec.ts +190 -0
- package/component-tests/session-message-projection.spec.ts +639 -0
- package/component-tests/session-notice-projection.spec.ts +20 -0
- package/component-tests/session-review-comments.spec.ts +179 -0
- package/component-tests/session-shell.spec.ts +93 -0
- package/component-tests/session-timeline-mobile.spec.ts +201 -0
- package/component-tests/session-timeline-notices.spec.ts +38 -0
- package/component-tests/session-timeline-reasoning.spec.ts +107 -0
- package/component-tests/session-timeline.spec.ts +157 -0
- package/component-tests/session-tool-projection.spec.ts +323 -0
- package/component-tests/text-lifecycle.fixture.tsx +26 -0
- package/component-tests/text-lifecycle.spec.ts +42 -0
- package/component-tests/timeline-subagent-rows.spec.ts +33 -0
- package/component-tests/tool-disclosure.spec.ts +48 -0
- package/component-tests/tool-group-sticky.spec.ts +37 -0
- package/component-tests/tool-group.spec.ts +290 -0
- package/component-tests/tool-status-title.fixture.tsx +22 -0
- package/component-tests/tool-status-title.spec.ts +30 -0
- package/component-tests/user-message-quotes.spec.ts +111 -0
- package/package.json +91 -4
- package/playwright.components.config.ts +4 -0
- package/playwright.local.config.ts +2 -0
- package/src/actions.ts +54 -0
- package/src/components/apply-patch-file.ts +122 -0
- package/src/components/basic-tool.css +487 -0
- package/src/components/basic-tool.tsx +258 -0
- package/src/components/copy-machine.ts +78 -0
- package/src/components/copy.ts +85 -0
- package/src/components/diagram-preview.tsx +28 -0
- package/src/components/disclosure-machine.ts +188 -0
- package/src/components/disclosure.ts +129 -0
- package/src/components/dock-prompt.stories.tsx +73 -0
- package/src/components/dock-prompt.tsx +29 -0
- package/src/components/file-comment-selection.tsx +146 -0
- package/src/components/file-media-machine.ts +165 -0
- package/src/components/file-media.stories.tsx +112 -0
- package/src/components/file-media.tsx +323 -0
- package/src/components/file-search.tsx +73 -0
- package/src/components/file.css +59 -0
- package/src/components/file.tsx +1300 -0
- package/src/components/image-preview.tsx +35 -0
- package/src/components/line-comment-annotations.tsx +580 -0
- package/src/components/line-comment-machine.ts +262 -0
- package/src/components/line-comment-styles.ts +293 -0
- package/src/components/line-comment.stories.tsx +152 -0
- package/src/components/line-comment.tsx +448 -0
- package/src/components/link-segments.ts +20 -0
- package/src/components/linked-text.tsx +21 -0
- package/src/components/markdown-cache-machine.ts +257 -0
- package/src/components/markdown-cache.tsx +556 -0
- package/src/components/markdown-clipboard.ts +101 -0
- package/src/components/markdown-code-machine.ts +200 -0
- package/src/components/markdown-code-state.ts +22 -0
- package/src/components/markdown-fragment-links.ts +74 -0
- package/src/components/markdown-github.svg +3 -0
- package/src/components/markdown-globe.svg +5 -0
- package/src/components/markdown-image-machine.ts +170 -0
- package/src/components/markdown-image.ts +156 -0
- package/src/components/markdown-inline-code-kind.ts +39 -0
- package/src/components/markdown-mermaid.ts +18 -0
- package/src/components/markdown-phase-machine.ts +102 -0
- package/src/components/markdown-projection.ts +13 -0
- package/src/components/markdown-session-links.ts +183 -0
- package/src/components/markdown-solid.test.tsx +92 -0
- package/src/components/markdown-solid.tsx +113 -0
- package/src/components/markdown-stream.ts +95 -0
- package/src/components/markdown-worker-machine.ts +516 -0
- package/src/components/markdown-worker-protocol.ts +73 -0
- package/src/components/markdown-worker.ts +250 -0
- package/src/components/markdown.css +672 -0
- package/src/components/markdown.stories.tsx +199 -0
- package/src/components/markdown.tsx +1612 -0
- package/src/components/markdown.worker.ts +188 -0
- package/src/components/message-file.ts +102 -0
- package/src/components/message-nav.css +134 -0
- package/src/components/message-nav.tsx +159 -0
- package/src/components/message-part.css +2109 -0
- package/src/components/message-part.tsx +3 -0
- package/src/components/question-prompt-experimental.css +576 -0
- package/src/components/question-prompt.css +527 -0
- package/src/components/quote-highlight.css +59 -0
- package/src/components/review-focus-driver.ts +142 -0
- package/src/components/review-focus-machine.ts +95 -0
- package/src/components/session-compaction.css +270 -0
- package/src/components/session-diff.ts +358 -0
- package/src/components/session-error.tsx +41 -0
- package/src/components/session-retry.tsx +92 -0
- package/src/components/session-review-machine.ts +241 -0
- package/src/components/session-review.css +264 -0
- package/src/components/session-review.stories.tsx +232 -0
- package/src/components/session-review.tsx +733 -0
- package/src/components/session-turn.css +282 -0
- package/src/components/shell-submessage.css +24 -0
- package/src/components/timeline-separator.tsx +69 -0
- package/src/components/tool-count-label.css +57 -0
- package/src/components/tool-count-label.tsx +76 -0
- package/src/components/tool-count-summary.css +102 -0
- package/src/components/tool-count-summary.stories.tsx +99 -0
- package/src/components/tool-count-summary.tsx +44 -0
- package/src/components/tool-error-card.css +178 -0
- package/src/components/tool-error-card.stories.tsx +113 -0
- package/src/components/tool-error-card.tsx +202 -0
- package/src/components/tool-status-title-machine.ts +128 -0
- package/src/components/tool-status-title.css +89 -0
- package/src/components/tool-status-title.tsx +163 -0
- package/src/context/data.tsx +107 -0
- package/src/context/index.ts +1 -0
- package/src/context/markdown.tsx +129 -0
- package/src/context/sources.tsx +34 -0
- package/src/document.ts +8 -0
- package/src/file-presentation.ts +34 -0
- package/src/message/action-machine.ts +72 -0
- package/src/message/agent-label.ts +3 -0
- package/src/message/attachment-card.css +119 -0
- package/src/message/attachment-card.tsx +40 -0
- package/src/message/attachment-media-machine.ts +213 -0
- package/src/message/comment-card.tsx +155 -0
- package/src/message/compaction-entrance-machine.ts +93 -0
- package/src/message/current-message.tsx +157 -0
- package/src/message/current-tool-state.ts +161 -0
- package/src/message/message-content.tsx +1391 -0
- package/src/message/paced-text-machine.ts +73 -0
- package/src/message/prompt-message.stories.tsx +149 -0
- package/src/message/relative-time.ts +45 -0
- package/src/message/user-message-quote-parts.ts +16 -0
- package/src/message/user-message-quotes.stories.tsx +797 -0
- package/src/message/user-message-quotes.tsx +135 -0
- package/src/pierre/comment-hover-machine.ts +53 -0
- package/src/pierre/comment-hover.ts +131 -0
- package/src/pierre/comment-selection-machine.ts +257 -0
- package/src/pierre/commented-lines.ts +106 -0
- package/src/pierre/diff-selection.ts +91 -0
- package/src/pierre/file-find-machine.ts +323 -0
- package/src/pierre/file-find.ts +537 -0
- package/src/pierre/file-runtime.ts +42 -0
- package/src/pierre/file-selection.ts +140 -0
- package/src/pierre/index.ts +344 -0
- package/src/pierre/media.ts +140 -0
- package/src/pierre/render-machine.ts +381 -0
- package/src/pierre/selection-bridge.ts +82 -0
- package/src/pierre/selection-machine.ts +198 -0
- package/src/pierre/virtualizer.ts +114 -0
- package/src/pierre/worker.ts +46 -0
- package/src/sources/experiment.ts +59 -0
- package/src/sources/site-icon.tsx +53 -0
- package/src/sources/sources-chip.tsx +57 -0
- package/src/sources/sources-expand-machine.ts +101 -0
- package/src/sources/sources-panel.tsx +249 -0
- package/src/sources/sources-title.tsx +21 -0
- package/src/sources/sources.css +266 -0
- package/src/sources/sources.ts +141 -0
- package/src/storybook/current-session-fixtures.ts +1492 -0
- package/src/storybook/current-session-scenarios.ts +76 -0
- package/src/storybook/current-session-story.tsx +154 -0
- package/src/storybook/index.ts +43 -0
- package/src/styles/index.css +19 -0
- package/src/timeline/__snapshots__/group-labels.test.ts.snap +110 -0
- package/src/timeline/__snapshots__/placement.test.ts.snap +1041 -0
- package/src/timeline/code-blocks.stories.tsx +105 -0
- package/src/timeline/commentary.stories.tsx +70 -0
- package/src/timeline/commentary.ts +38 -0
- package/src/timeline/detail.ts +111 -0
- package/src/timeline/error-card.stories.tsx +134 -0
- package/src/timeline/error-spacing.stories.tsx +71 -0
- package/src/timeline/facts.ts +493 -0
- package/src/timeline/file-changes.stories.tsx +436 -0
- package/src/timeline/group-label-fixtures.ts +97 -0
- package/src/timeline/mermaid.stories.tsx +131 -0
- package/src/timeline/place.ts +280 -0
- package/src/timeline/placement-fixtures.ts +365 -0
- package/src/timeline/placement-reactivity.ts +133 -0
- package/src/timeline/projection.ts +1261 -0
- package/src/timeline/research-and-agents.stories.tsx +461 -0
- package/src/timeline/session-timeline-row.tsx +1675 -0
- package/src/timeline/session-timeline.tsx +68 -0
- package/src/timeline/steer-arrival-machine.ts +134 -0
- package/src/timeline/terminal-work.stories.tsx +464 -0
- package/src/timeline/timeline-row.stories.tsx +1069 -0
- package/src/timeline/timeline-row.ts +238 -0
- package/src/timeline/turn-phase-machine.ts +112 -0
- package/src/timeline/user-message-fold.stories.tsx +194 -0
- package/src/timeline/user-runs.ts +87 -0
- package/src/timeline-next/__snapshots__/placement.test.ts.snap +990 -0
- package/src/timeline-next/compaction.tsx +236 -0
- package/src/timeline-next/errors.ts +101 -0
- package/src/timeline-next/event-row.tsx +168 -0
- package/src/timeline-next/events.ts +103 -0
- package/src/timeline-next/index.ts +10 -0
- package/src/timeline-next/nested-rail.ts +125 -0
- package/src/timeline-next/projection.ts +1028 -0
- package/src/timeline-next/row.tsx +1728 -0
- package/src/timeline-next/rules.ts +89 -0
- package/src/timeline-next/separator.tsx +73 -0
- package/src/timeline-next/spacing.ts +127 -0
- package/src/timeline-next/status-line.tsx +41 -0
- package/src/timeline-next/status.ts +33 -0
- package/src/timeline-next/stories/compare-renderer.stories.tsx +190 -0
- package/src/timeline-next/stories/compare-sessions/.gitignore +3 -0
- package/src/timeline-next/stories/compare.stories.tsx +486 -0
- package/src/timeline-next/stories/playground.stories.tsx +297 -0
- package/src/timeline-next/stories/session-replay.ts +1156 -0
- package/src/timeline-next/stories/session-timeline.tsx +50 -0
- package/src/timeline-next/stories/subagent-status.stories.tsx +132 -0
- package/src/timeline-next/timeline-next.css +649 -0
- package/src/timeline-next/tools/__snapshots__/activity-label.test.ts.snap +39 -0
- package/src/timeline-next/tools/activity-label.ts +166 -0
- package/src/timeline-next/tools/assistant-content.tsx +84 -0
- package/src/timeline-next/tools/context-group.tsx +619 -0
- package/src/timeline-next/tools/error-card.tsx +147 -0
- package/src/timeline-next/tools/explore.tsx +119 -0
- package/src/timeline-next/tools/file-group.tsx +128 -0
- package/src/timeline-next/tools/patch.tsx +174 -0
- package/src/timeline-next/tools/shell.tsx +186 -0
- package/src/timeline-next/tools/thought.tsx +87 -0
- package/src/timeline-next/tools/tool-display.tsx +119 -0
- package/src/tools/ansi.ts +8 -0
- package/src/tools/context-group-label.ts +123 -0
- package/src/tools/file-runs.ts +35 -0
- package/src/tools/project-path.ts +18 -0
- package/src/tools/read-group.stories.tsx +159 -0
- package/src/tools/run-machine.ts +185 -0
- package/src/tools/shell-output-machine.ts +233 -0
- package/src/tools/shell-output.ts +91 -0
- package/src/tools/subagent-row-variants.stories.tsx +129 -0
- package/src/tools/tool-group.stories.tsx +345 -0
- package/src/tools/tool-renderer.tsx +2876 -0
- package/src/v2/components/line-comment-annotations-v2.tsx +215 -0
- package/src/v2/components/session-file-panel-v2.tsx +149 -0
- package/src/v2/components/session-progress-indicator-v2.css +5 -0
- package/src/v2/components/session-progress-indicator-v2.stories.tsx +86 -0
- package/src/v2/components/session-progress-indicator-v2.tsx +16 -0
- package/src/v2/components/session-review-empty-changes-v2.tsx +17 -0
- package/src/v2/components/session-review-empty-no-git-v2.tsx +28 -0
- package/src/v2/components/session-review-file-preview-v2-virtualize.ts +5 -0
- package/src/v2/components/session-review-file-preview-v2.tsx +266 -0
- package/src/v2/components/session-review-v2.css +653 -0
- package/src/v2/components/session-review-v2.tsx +422 -0
- package/src/v2/components/sidebar-presence-machine.ts +69 -0
- package/tsconfig.json +20 -0
- package/README.md +0 -3
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { For, Show, createEffect, createMemo, on, onCleanup } from "solid-js"
|
|
2
|
+
import { createStore } from "solid-js/store"
|
|
3
|
+
import { TextShimmer } from "@zyro-sec/ui/text-shimmer"
|
|
4
|
+
import { CurrentSessionProviders } from "../../storybook/current-session-story"
|
|
5
|
+
import { timelinePresets } from "../../timeline/detail"
|
|
6
|
+
import { SessionTimeline } from "../../timeline/session-timeline"
|
|
7
|
+
import { createNextTimelineProjection } from "../projection"
|
|
8
|
+
import { laneGap } from "../spacing"
|
|
9
|
+
import { timelineStatus, timelineThinking } from "../status"
|
|
10
|
+
import { StatusLane } from "../status-line"
|
|
11
|
+
import { replayScript, scenarios, ticks, type ScenarioName } from "./session-replay"
|
|
12
|
+
import { NextSessionTimeline } from "./session-timeline"
|
|
13
|
+
|
|
14
|
+
export default {
|
|
15
|
+
title: "OpenCode/Timeline/Playground",
|
|
16
|
+
id: "timeline-playground",
|
|
17
|
+
component: SessionTimeline,
|
|
18
|
+
parameters: { layout: "fullscreen" },
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
type PresetID = (typeof timelinePresets)[number]["id"]
|
|
22
|
+
|
|
23
|
+
const defaultPreset: PresetID = "compact"
|
|
24
|
+
|
|
25
|
+
const defaultScenario: ScenarioName = "Feature work"
|
|
26
|
+
|
|
27
|
+
// SAFETY: the keys of the scenarios object are exactly its scenario names.
|
|
28
|
+
const scenarioNames = Object.keys(scenarios) as ScenarioName[]
|
|
29
|
+
|
|
30
|
+
// The status line the app shows below a working turn, in the New timeline.
|
|
31
|
+
const statusLabels = {
|
|
32
|
+
waitingApproval: "Waiting for approval",
|
|
33
|
+
waitingAnswer: "Waiting for your answer",
|
|
34
|
+
waitingShell: "Waiting for shell",
|
|
35
|
+
working: "Working",
|
|
36
|
+
} as const
|
|
37
|
+
|
|
38
|
+
// Another page can drive an embedded playground, such as one comparing it with the released timeline step by step.
|
|
39
|
+
type PlaygroundMessage = {
|
|
40
|
+
type: "timeline-playground"
|
|
41
|
+
scenario?: ScenarioName
|
|
42
|
+
preset?: PresetID
|
|
43
|
+
activity?: boolean
|
|
44
|
+
tick?: number
|
|
45
|
+
width?: number
|
|
46
|
+
turnDiffs?: boolean
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export const Playground = {
|
|
50
|
+
args: {
|
|
51
|
+
embedded: false,
|
|
52
|
+
scenario: defaultScenario,
|
|
53
|
+
preset: defaultPreset,
|
|
54
|
+
activity: true,
|
|
55
|
+
width: 720,
|
|
56
|
+
turnDiffs: false,
|
|
57
|
+
progress: 100,
|
|
58
|
+
},
|
|
59
|
+
argTypes: {
|
|
60
|
+
scenario: { options: scenarioNames },
|
|
61
|
+
preset: { options: timelinePresets.map((preset) => preset.id) },
|
|
62
|
+
width: { control: { type: "range", min: 480, max: 960, step: 240 } },
|
|
63
|
+
progress: { control: { type: "range", min: 0, max: 100, step: 1 } },
|
|
64
|
+
},
|
|
65
|
+
render: (args: {
|
|
66
|
+
embedded: boolean
|
|
67
|
+
scenario: ScenarioName
|
|
68
|
+
preset: PresetID
|
|
69
|
+
activity: boolean
|
|
70
|
+
width: number
|
|
71
|
+
turnDiffs: boolean
|
|
72
|
+
progress: number
|
|
73
|
+
}) => {
|
|
74
|
+
const [state, setState] = createStore({
|
|
75
|
+
scenario: args.scenario,
|
|
76
|
+
preset: args.preset,
|
|
77
|
+
activity: args.activity,
|
|
78
|
+
tick: Number.MAX_SAFE_INTEGER,
|
|
79
|
+
playing: false,
|
|
80
|
+
width: args.width,
|
|
81
|
+
turnDiffs: args.turnDiffs,
|
|
82
|
+
})
|
|
83
|
+
|
|
84
|
+
const script = createMemo(() => scenarios[state.scenario])
|
|
85
|
+
const detail = createMemo(() => timelinePresets.find((preset) => preset.id === state.preset)!.value)
|
|
86
|
+
const total = createMemo(() => script().reduce((sum, beat) => sum + ticks(beat), 0))
|
|
87
|
+
const tick = createMemo(() => Math.min(state.tick, total()))
|
|
88
|
+
createEffect(() => setState("scenario", args.scenario))
|
|
89
|
+
createEffect(() => setState("preset", args.preset))
|
|
90
|
+
createEffect(() => setState("activity", args.activity))
|
|
91
|
+
createEffect(() => setState("width", args.width))
|
|
92
|
+
createEffect(() => setState("turnDiffs", args.turnDiffs))
|
|
93
|
+
createEffect(
|
|
94
|
+
on([() => args.progress, () => args.scenario], () =>
|
|
95
|
+
setState({ tick: Math.round((total() * args.progress) / 100), playing: false }),
|
|
96
|
+
),
|
|
97
|
+
)
|
|
98
|
+
// The playhead is now, so live durations read like a session happening as you watch.
|
|
99
|
+
const replay = createMemo(() => replayScript(script(), tick(), Date.now() - tick() * 1_500))
|
|
100
|
+
|
|
101
|
+
const busy = () => replay().document.status.type === "busy"
|
|
102
|
+
|
|
103
|
+
const projection = createNextTimelineProjection({
|
|
104
|
+
sessionMessages: () => replay().document.messages,
|
|
105
|
+
status: () => replay().document.status,
|
|
106
|
+
timelineDetail: detail,
|
|
107
|
+
})
|
|
108
|
+
|
|
109
|
+
// Where the status line sits: the space the turn's next row would take, as the app computes it.
|
|
110
|
+
const laneSpacing = createMemo(() => {
|
|
111
|
+
const active = projection.activeMessageID()
|
|
112
|
+
|
|
113
|
+
return active ? laneGap(projection.rows(), active, projection.messageByID()) : undefined
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
const status = createMemo(() => {
|
|
117
|
+
const last = replay().document.messages.findLast((message) => message.type === "assistant")
|
|
118
|
+
|
|
119
|
+
const content = last?.type === "assistant" ? last.content : []
|
|
120
|
+
const value = timelineStatus({ content })
|
|
121
|
+
|
|
122
|
+
// The thought the model is writing says Thinking in its own row, in place of Working.
|
|
123
|
+
return value === "working" && state.activity && timelineThinking(detail(), content) ? undefined : value
|
|
124
|
+
})
|
|
125
|
+
|
|
126
|
+
const receive = (event: MessageEvent<PlaygroundMessage>) => {
|
|
127
|
+
if (event.data?.type !== "timeline-playground") return
|
|
128
|
+
const { type: _, ...next } = event.data
|
|
129
|
+
setState({ ...next, playing: false })
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
window.addEventListener("message", receive)
|
|
133
|
+
onCleanup(() => window.removeEventListener("message", receive))
|
|
134
|
+
createEffect(() => window.parent.postMessage({ type: "timeline-playground:total", total: total() }, "*"))
|
|
135
|
+
|
|
136
|
+
createEffect(() => {
|
|
137
|
+
if (!state.playing) return
|
|
138
|
+
|
|
139
|
+
const timer = setInterval(() => {
|
|
140
|
+
if (tick() >= total()) return setState("playing", false)
|
|
141
|
+
setState("tick", tick() + 1)
|
|
142
|
+
}, 700)
|
|
143
|
+
|
|
144
|
+
onCleanup(() => clearInterval(timer))
|
|
145
|
+
})
|
|
146
|
+
|
|
147
|
+
return (
|
|
148
|
+
<div class="flex h-screen min-h-0 flex-col bg-v2-background-bg-base text-v2-text-text-base">
|
|
149
|
+
<div
|
|
150
|
+
classList={{ hidden: args.embedded }}
|
|
151
|
+
class="flex flex-wrap items-center gap-x-6 gap-y-3 border-b border-v2-border-border-base px-6 py-3 text-13-regular"
|
|
152
|
+
>
|
|
153
|
+
<Segmented
|
|
154
|
+
label="Preset"
|
|
155
|
+
options={timelinePresets.map((preset) => preset.id)}
|
|
156
|
+
value={state.preset}
|
|
157
|
+
onChange={(preset) => setState("preset", preset)}
|
|
158
|
+
/>
|
|
159
|
+
<label class="flex items-center gap-2">
|
|
160
|
+
<input
|
|
161
|
+
type="checkbox"
|
|
162
|
+
checked={state.activity}
|
|
163
|
+
onChange={(event) => setState("activity", event.currentTarget.checked)}
|
|
164
|
+
/>
|
|
165
|
+
New timeline
|
|
166
|
+
</label>
|
|
167
|
+
<Segmented
|
|
168
|
+
label="Session"
|
|
169
|
+
options={scenarioNames}
|
|
170
|
+
value={state.scenario}
|
|
171
|
+
onChange={(scenario) => setState({ scenario, tick: Number.MAX_SAFE_INTEGER, playing: false })}
|
|
172
|
+
/>
|
|
173
|
+
<Segmented
|
|
174
|
+
label="Width"
|
|
175
|
+
options={[480, 720, 960] as const}
|
|
176
|
+
value={state.width}
|
|
177
|
+
onChange={(width) => setState("width", width)}
|
|
178
|
+
/>
|
|
179
|
+
<label class="flex items-center gap-2">
|
|
180
|
+
<input
|
|
181
|
+
type="checkbox"
|
|
182
|
+
checked={state.turnDiffs}
|
|
183
|
+
onChange={(event) => setState("turnDiffs", event.currentTarget.checked)}
|
|
184
|
+
/>
|
|
185
|
+
Changed files
|
|
186
|
+
</label>
|
|
187
|
+
</div>
|
|
188
|
+
<div
|
|
189
|
+
classList={{ hidden: args.embedded }}
|
|
190
|
+
class="flex items-center gap-3 border-b border-v2-border-border-base px-6 py-3 text-13-regular"
|
|
191
|
+
>
|
|
192
|
+
<button
|
|
193
|
+
type="button"
|
|
194
|
+
class="w-16 rounded-md border border-v2-border-border-base px-2 py-1"
|
|
195
|
+
onClick={() => {
|
|
196
|
+
if (tick() >= total()) setState("tick", 0)
|
|
197
|
+
setState("playing", !state.playing)
|
|
198
|
+
}}
|
|
199
|
+
>
|
|
200
|
+
{state.playing ? "Pause" : "Play"}
|
|
201
|
+
</button>
|
|
202
|
+
<button
|
|
203
|
+
type="button"
|
|
204
|
+
class="rounded-md border border-v2-border-border-base px-2 py-1"
|
|
205
|
+
onClick={() => setState({ tick: Math.max(0, tick() - 1), playing: false })}
|
|
206
|
+
>
|
|
207
|
+
‹
|
|
208
|
+
</button>
|
|
209
|
+
<button
|
|
210
|
+
type="button"
|
|
211
|
+
class="rounded-md border border-v2-border-border-base px-2 py-1"
|
|
212
|
+
onClick={() => setState({ tick: Math.min(total(), tick() + 1), playing: false })}
|
|
213
|
+
>
|
|
214
|
+
›
|
|
215
|
+
</button>
|
|
216
|
+
<input
|
|
217
|
+
type="range"
|
|
218
|
+
aria-label="Point in the session"
|
|
219
|
+
class="min-w-0 flex-1"
|
|
220
|
+
min="0"
|
|
221
|
+
max={total()}
|
|
222
|
+
value={tick()}
|
|
223
|
+
onInput={(event) => setState({ tick: event.currentTarget.valueAsNumber, playing: false })}
|
|
224
|
+
/>
|
|
225
|
+
<span class="w-72 shrink-0 truncate text-v2-text-text-muted tabular-nums">
|
|
226
|
+
{tick()}/{total()} · {replay().caption}
|
|
227
|
+
</span>
|
|
228
|
+
</div>
|
|
229
|
+
<div class="min-h-0 flex-1 overflow-y-auto" data-scrollable>
|
|
230
|
+
<div class="mx-auto py-6" style={{ "max-width": `${state.width}px` }}>
|
|
231
|
+
<CurrentSessionProviders document={replay().document}>
|
|
232
|
+
<Show
|
|
233
|
+
when={state.activity}
|
|
234
|
+
fallback={
|
|
235
|
+
<SessionTimeline document={replay().document} timelineDetail={detail()} turnDiffs={state.turnDiffs} />
|
|
236
|
+
}
|
|
237
|
+
>
|
|
238
|
+
<NextSessionTimeline
|
|
239
|
+
document={replay().document}
|
|
240
|
+
timelineDetail={detail()}
|
|
241
|
+
turnDiffs={state.turnDiffs}
|
|
242
|
+
/>
|
|
243
|
+
</Show>
|
|
244
|
+
</CurrentSessionProviders>
|
|
245
|
+
<Show
|
|
246
|
+
when={state.activity}
|
|
247
|
+
fallback={
|
|
248
|
+
<div class="flex h-9 items-center gap-2 pt-3 px-4 text-[13px] font-[530] leading-text-compact md:px-6">
|
|
249
|
+
<Show when={busy()}>
|
|
250
|
+
<div data-component="session-working" role="status">
|
|
251
|
+
<TextShimmer text="Working" active />
|
|
252
|
+
</div>
|
|
253
|
+
</Show>
|
|
254
|
+
</div>
|
|
255
|
+
}
|
|
256
|
+
>
|
|
257
|
+
<StatusLane
|
|
258
|
+
class="px-4 md:px-6"
|
|
259
|
+
spacing={laneSpacing()}
|
|
260
|
+
label={busy() && status() ? statusLabels[status()!] : undefined}
|
|
261
|
+
collapsed={busy() && !status()}
|
|
262
|
+
/>
|
|
263
|
+
</Show>
|
|
264
|
+
</div>
|
|
265
|
+
</div>
|
|
266
|
+
</div>
|
|
267
|
+
)
|
|
268
|
+
},
|
|
269
|
+
}
|
|
270
|
+
|
|
271
|
+
function Segmented<T extends string | number>(props: {
|
|
272
|
+
label: string
|
|
273
|
+
options: readonly T[]
|
|
274
|
+
value: T
|
|
275
|
+
onChange: (value: T) => void
|
|
276
|
+
}) {
|
|
277
|
+
return (
|
|
278
|
+
<div class="flex items-center gap-2">
|
|
279
|
+
<span class="text-v2-text-text-muted">{props.label}</span>
|
|
280
|
+
<div class="flex rounded-md border border-v2-border-border-base p-0.5">
|
|
281
|
+
<For each={props.options}>
|
|
282
|
+
{(option) => (
|
|
283
|
+
<button
|
|
284
|
+
type="button"
|
|
285
|
+
class="rounded px-2 py-0.5 capitalize"
|
|
286
|
+
classList={{ "bg-v2-background-bg-layer-03": option === props.value }}
|
|
287
|
+
aria-pressed={option === props.value}
|
|
288
|
+
onClick={() => props.onChange(option)}
|
|
289
|
+
>
|
|
290
|
+
{option}
|
|
291
|
+
</button>
|
|
292
|
+
)}
|
|
293
|
+
</For>
|
|
294
|
+
</div>
|
|
295
|
+
</div>
|
|
296
|
+
)
|
|
297
|
+
}
|