TheYuchen commited on
Commit
123b5a8
·
1 Parent(s): d3d2c90

Restore/replay: transient pulse on the rebuilt canvas

Browse files

pendingRestore (History restore/replay and scenario boots — same
bridge) swaps the whole canvas behind the pane the user clicked in;
the silent mutation read as "nothing happened". Every restored node
now pulses one 1.2s accent ring (.restore-pulse, index.css), class
stripped after 1.4s via functional setNodes so mid-window drags
survive and the next restore re-triggers. Global
prefers-reduced-motion rule collapses the animation.

frontend/src/components/FlowCanvas.tsx CHANGED
@@ -858,6 +858,14 @@ export function FlowCanvas() {
858
  id: pn.i,
859
  type: "qnode",
860
  position: { x: pn.x, y: pn.y },
 
 
 
 
 
 
 
 
861
  data: {
862
  kind: pn.k,
863
  params: {
@@ -874,6 +882,18 @@ export function FlowCanvas() {
874
  }));
875
  setNodes(restoredNodes);
876
  setEdges(restoredEdges);
 
 
 
 
 
 
 
 
 
 
 
 
877
  setRun(null);
878
  useApp.getState().setRestoredFrom(sourceRunId);
879
  if (pinSeed != null) setPinnedSeed(pinSeed);
 
858
  id: pn.i,
859
  type: "qnode",
860
  position: { x: pn.x, y: pn.y },
861
+ // Transient acknowledgment: a restore (and a scenario boot, which
862
+ // rides the same bridge) swaps the whole canvas behind whatever
863
+ // panel the user clicked in — a silent mutation disorients ("did
864
+ // anything happen? whose graph is this?"). Every restored node
865
+ // pulses an accent ring once (~1.2s CSS animation, class defined
866
+ // in index.css; the global prefers-reduced-motion rule collapses
867
+ // it) alongside the textual notice.
868
+ className: "restore-pulse",
869
  data: {
870
  kind: pn.k,
871
  params: {
 
882
  }));
883
  setNodes(restoredNodes);
884
  setEdges(restoredEdges);
885
+ // Strip the pulse class after the animation ends (functional update:
886
+ // must not clobber a drag that happened inside the window) so the
887
+ // NEXT restore re-triggers the animation on reused DOM nodes.
888
+ window.setTimeout(() => {
889
+ setNodes((ns) =>
890
+ ns.map((n) =>
891
+ n.className?.includes("restore-pulse")
892
+ ? { ...n, className: undefined }
893
+ : n,
894
+ ),
895
+ );
896
+ }, 1400);
897
  setRun(null);
898
  useApp.getState().setRestoredFrom(sourceRunId);
899
  if (pinSeed != null) setPinnedSeed(pinSeed);
frontend/src/index.css CHANGED
@@ -239,6 +239,28 @@
239
  }
240
  }
241
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
242
  /* ----- prefers-reduced-motion ----------------------------------------
243
  * Honor the OS-level "reduce motion" setting. Without this rule the
244
  * default React Flow `animated` edges loop a stroke-dash forever, and
 
239
  }
240
  }
241
 
242
+ /* Restore/replay acknowledgment: FlowCanvas adds .restore-pulse to every
243
+ node it just rebuilt from an archived run (or a scenario boot) and
244
+ removes it ~1.4s later. One accent ring swelling out and fading — long
245
+ enough to catch peripheral vision, short enough not to nag. Radius
246
+ matches .panel-alt's rounded-xl so the ring hugs the node card. The
247
+ global prefers-reduced-motion rule below collapses the animation. */
248
+ .react-flow__node.restore-pulse {
249
+ border-radius: 0.75rem;
250
+ animation: restore-pulse 1.2s ease-out 1;
251
+ }
252
+ @keyframes restore-pulse {
253
+ 0% {
254
+ box-shadow: 0 0 0 0 rgb(var(--color-accent) / 0.85);
255
+ }
256
+ 70% {
257
+ box-shadow: 0 0 0 7px rgb(var(--color-accent) / 0.3);
258
+ }
259
+ 100% {
260
+ box-shadow: 0 0 0 11px rgb(var(--color-accent) / 0);
261
+ }
262
+ }
263
+
264
  /* ----- prefers-reduced-motion ----------------------------------------
265
  * Honor the OS-level "reduce motion" setting. Without this rule the
266
  * default React Flow `animated` edges loop a stroke-dash forever, and