From a11c8bfaa716f9872c2d433d103b94f189aa81ab Mon Sep 17 00:00:00 2001 From: Maurice Date: Fri, 23 Oct 2026 01:45:16 +0000 Subject: [PATCH] fix(studio): the travel panel builds its tiles with the book engine's factories Figures, countries, maps and marks placed from the panel are the elements the assistant adds, built by the shared factories; the panel keeps only their placement. A trip map no longer carries the whole journey's trail, switching a map's scope re-cuts it the way the engine does and clears the roads of the old legs, and switching back to the whole journey restores the trail. --- client/scripts/eslint-baseline.json | 4 +- client/scripts/theme-baseline.json | 1 - .../src/components/Studio/StudioInspector.tsx | 5 +- client/src/components/Studio/StudioShell.tsx | 25 +- .../Studio/StudioTravelInspector.tsx | 39 ++- .../components/Studio/StudioTravelPanel.tsx | 256 ++++++------------ client/tests/unit/studio/inspector.test.tsx | 1 + .../unit/studio/inspectorTravel.test.tsx | 57 +++- .../unit/studio/travelPanelEngine.test.tsx | 240 ++++++++++++++++ 9 files changed, 418 insertions(+), 210 deletions(-) create mode 100644 client/tests/unit/studio/travelPanelEngine.test.tsx diff --git a/client/scripts/eslint-baseline.json b/client/scripts/eslint-baseline.json index 03c927b19..d1308f2c7 100644 --- a/client/scripts/eslint-baseline.json +++ b/client/scripts/eslint-baseline.json @@ -6,7 +6,7 @@ "complexity": 226, "@typescript-eslint/no-explicit-any": 146, "trek/no-swallowed-catch": 131, - "max-params": 34, + "max-params": 33, "trek/store-without-selector": 67, "react-hooks/refs": 557, "react-hooks/set-state-in-effect": 195, @@ -14,7 +14,7 @@ "react-hooks/exhaustive-deps": 116, "@typescript-eslint/no-unused-vars": 126, "react-hooks/immutability": 28, - "max-lines-per-function": 133, + "max-lines-per-function": 132, "react-hooks/static-components": 78, "react-hooks/preserve-manual-memoization": 12, "no-useless-assignment": 7, diff --git a/client/scripts/theme-baseline.json b/client/scripts/theme-baseline.json index 2ab2bac1c..74cf5cc22 100644 --- a/client/scripts/theme-baseline.json +++ b/client/scripts/theme-baseline.json @@ -105,7 +105,6 @@ "components/Studio/StudioInspector.tsx": 2, "components/Studio/StudioShell.tsx": 2, "components/Studio/StudioSidebar.tsx": 2, - "components/Studio/StudioTravelPanel.tsx": 1, "components/Studio/TravelElements.tsx": 5, "components/Studio/printSheets.ts": 5, "components/SystemNotices/ReleaseNoticeVisuals.tsx": 4, diff --git a/client/src/components/Studio/StudioInspector.tsx b/client/src/components/Studio/StudioInspector.tsx index 570ba7b24..e88e52093 100644 --- a/client/src/components/Studio/StudioInspector.tsx +++ b/client/src/components/Studio/StudioInspector.tsx @@ -52,6 +52,7 @@ export function StudioInspector({ spreadIndex, page, stats, + path, source, setPageNumbers, t, @@ -62,6 +63,8 @@ export function StudioInspector({ setPageNumbers: (patch: Partial) => void /** Live journey figures, so a travel element can be brought up to date. */ stats: JourneyStats | null + /** The journey's recorded way, thinned, so a map of the whole journey can be given it again. */ + path: [number, number][][] /** The journal itself, so a bound mark can be re-set from it. */ source: JourneySource t: (k: string) => string @@ -647,7 +650,7 @@ export function StudioInspector({ )} - + {/* Where it sits, folded away. diff --git a/client/src/components/Studio/StudioShell.tsx b/client/src/components/Studio/StudioShell.tsx index 5b7a0633b..2fab721b7 100644 --- a/client/src/components/Studio/StudioShell.tsx +++ b/client/src/components/Studio/StudioShell.tsx @@ -2,7 +2,7 @@ import { useEffect, useRef, useState } from 'react' import { createPortal } from 'react-dom' import { useNavigate } from 'react-router' import { - ArrowLeft, BookOpen, Check, ChevronDown, ClipboardPaste, Download, Maximize2, MessageSquare, Minus, Plus, + ArrowLeft, BookOpen, Check, ChevronDown, ClipboardPaste, Download, Maximize2, Minus, Plus, Redo2, Sparkles, Undo2, } from 'lucide-react' import { useJourneyStudio } from '../../pages/journeyStudio/useJourneyStudio' @@ -21,7 +21,7 @@ import { PeerBadges } from './PeerBadges' import { TrimField } from './TrimField' import { Tooltip } from '../shared/Tooltip' import { useStudioStore } from '../../store/studioStore' -import StudioAssistantPanel, { StudioPageStage } from './StudioAssistantPanel' +import { StudioAssistantColumn, StudioAssistantToggle, StudioPageStage } from './StudioAssistantPanel' import { useStudioAssistant, type StudioAssistant } from './useStudioAssistant' import '../../styles/dashboard.css' import '../../styles/studio.css' @@ -128,12 +128,13 @@ export default function StudioShell() { spreadIndex={s.activeSpread} page={s.page} stats={s.stats} + path={s.path} source={s.source} setPageNumbers={s.setPageNumbers} t={s.t} locale={s.locale} /> - + @@ -153,12 +154,6 @@ export default function StudioShell() { type Studio = ReturnType -/** The chat column at the end of the body, while it is open. */ -function AssistantColumn({ s, assistant }: { s: Studio; assistant: StudioAssistant }) { - if (!assistant.open) return null - return -} - function StudioBar({ s, bookView, setBookView, onExport, assistant, }: { @@ -238,17 +233,7 @@ function StudioBar({ {/* The book's assistant, as a column beside the page; only where it can run for this user. */} - {assistant.available && ( - - )} +