feat(analytics): refine timeline visualization and add print support

This commit is contained in:
2026-02-17 21:17:11 -05:00
parent 568d408587
commit 72971a4b49
82 changed files with 6670 additions and 2448 deletions
@@ -158,10 +158,17 @@ export interface DesignerState {
/* Helpers */
/* -------------------------------------------------------------------------- */
function cloneActions(actions: ExperimentAction[]): ExperimentAction[] {
return actions.map((a) => ({
...a,
children: a.children ? cloneActions(a.children) : undefined,
}));
}
function cloneSteps(steps: ExperimentStep[]): ExperimentStep[] {
return steps.map((s) => ({
...s,
actions: s.actions.map((a) => ({ ...a })),
actions: cloneActions(s.actions),
}));
}
@@ -248,8 +255,10 @@ function insertActionIntoTree(
/* Store Implementation */
/* -------------------------------------------------------------------------- */
export const useDesignerStore = create<DesignerState>((set, get) => ({
steps: [],
export const createDesignerStore = (props: {
initialSteps?: ExperimentStep[];
}) => create<DesignerState>((set, get) => ({
steps: props.initialSteps ? reindexSteps(cloneSteps(props.initialSteps)) : [],
dirtyEntities: new Set<string>(),
validationIssues: {},
actionSignatureIndex: new Map(),
@@ -541,6 +550,8 @@ export const useDesignerStore = create<DesignerState>((set, get) => ({
}),
}));
export const useDesignerStore = createDesignerStore({});
/* -------------------------------------------------------------------------- */
/* Convenience Selectors */
/* -------------------------------------------------------------------------- */