Skip to content

Commit 9967644

Browse files
committed
feat(web): timeline version history panel
Adds a History tab to the timeline editor's inspector region backed by a new useTimelineVersions server-state hook (list, manual snapshot, restore, delete over timeline.versions.*). Restore applies the mutation response to the open editor via applyTimelineSequenceToStore (extracted from useLoadTimelineIntoStore), which replaces the document, sets the fresh baseUpdatedAt token, and clears undo history — so the debounced autosave re-arms on the restored state instead of clobbering it with pre-restore in-memory edits. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01AFVn8LPnkLRAGYUE3ucuKA
1 parent 638a53b commit 9967644

6 files changed

Lines changed: 888 additions & 16 deletions

File tree

web/src/components/timeline/TimelineEditor.tsx

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ import {
3636
MOTION
3737
} from "../ui_primitives";
3838
import AutoAwesomeIcon from "@mui/icons-material/AutoAwesome";
39+
import HistoryOutlinedIcon from "@mui/icons-material/HistoryOutlined";
3940
import TuneOutlinedIcon from "@mui/icons-material/TuneOutlined";
4041

4142
import { TopBar } from "./TopBar";
@@ -54,6 +55,7 @@ import { TimelineProvider } from "../../stores/timeline/TimelineInstance";
5455
import { PreviewArea } from "./preview/PreviewArea";
5556
import { TimelineInspector } from "./Inspector/TimelineInspector";
5657
import TimelineAgentPanel from "./TimelineAgentPanel";
58+
import TimelineVersionHistoryPanel from "./TimelineVersionHistoryPanel";
5759
import { useTimelineAgentBridge } from "../../hooks/timeline/useTimelineAgentBridge";
5860
import { TranscriptPanel } from "./TranscriptPanel";
5961
import { useHasScript } from "../../hooks/timeline/useHasScript";
@@ -231,16 +233,18 @@ const PreviewRegion: React.FC<{
231233
});
232234
PreviewRegion.displayName = "PreviewRegion";
233235

234-
type InspectorTab = "inspector" | "agent";
236+
type InspectorTab = "inspector" | "agent" | "history";
235237

236-
const InspectorRegion: React.FC = memo(() => {
238+
const InspectorRegion: React.FC<{ sequenceId: string | undefined }> = memo(
239+
({ sequenceId }) => {
237240
const theme = useTheme();
238241
const [tab, setTab] = useState<InspectorTab>("inspector");
239242

240243
const tabs = useMemo(
241244
() => [
242245
{ value: "inspector", label: "Inspector", icon: <TuneOutlinedIcon /> },
243-
{ value: "agent", label: "Assistant", icon: <AutoAwesomeIcon /> }
246+
{ value: "agent", label: "Assistant", icon: <AutoAwesomeIcon /> },
247+
{ value: "history", label: "History", icon: <HistoryOutlinedIcon /> }
244248
],
245249
[]
246250
);
@@ -263,11 +267,18 @@ const InspectorRegion: React.FC = memo(() => {
263267
}}
264268
/>
265269
<FlexColumn fullWidth sx={{ flex: 1, minHeight: 0, overflow: "hidden" }}>
266-
{tab === "inspector" ? <TimelineInspector /> : <TimelineAgentPanel />}
270+
{tab === "inspector" ? (
271+
<TimelineInspector />
272+
) : tab === "agent" ? (
273+
<TimelineAgentPanel />
274+
) : (
275+
<TimelineVersionHistoryPanel sequenceId={sequenceId} />
276+
)}
267277
</FlexColumn>
268278
</FlexColumn>
269279
);
270-
});
280+
}
281+
);
271282
InspectorRegion.displayName = "InspectorRegion";
272283

273284
const TranscriptRegion: React.FC = memo(() => {
@@ -610,7 +621,7 @@ const TimelineEditorBody: React.FC<
610621
createSequencePending={createTimeline.isPending}
611622
createSequenceErrorMessage={createErrorMessage}
612623
/>
613-
<InspectorRegion />
624+
<InspectorRegion sequenceId={sequenceId} />
614625
</FlexRow>
615626

616627
{/* ── Horizontal drag handle (mouse + keyboard resizable) ───── */}

0 commit comments

Comments
 (0)