diff --git a/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-dark-linux.png b/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-dark-linux.png index 7f62b4b..9acf73f 100644 Binary files a/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-dark-linux.png and b/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-dark-linux.png differ diff --git a/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-light-linux.png b/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-light-linux.png index 929854b..d5df07a 100644 Binary files a/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-light-linux.png and b/packages/viewer/e2e/visual.spec.ts-snapshots/grouped-light-linux.png differ diff --git a/packages/viewer/e2e/visual.spec.ts-snapshots/sample-dark-linux.png b/packages/viewer/e2e/visual.spec.ts-snapshots/sample-dark-linux.png index f914480..f415768 100644 Binary files a/packages/viewer/e2e/visual.spec.ts-snapshots/sample-dark-linux.png and b/packages/viewer/e2e/visual.spec.ts-snapshots/sample-dark-linux.png differ diff --git a/packages/viewer/e2e/visual.spec.ts-snapshots/sample-light-linux.png b/packages/viewer/e2e/visual.spec.ts-snapshots/sample-light-linux.png index e69dd24..a2e233c 100644 Binary files a/packages/viewer/e2e/visual.spec.ts-snapshots/sample-light-linux.png and b/packages/viewer/e2e/visual.spec.ts-snapshots/sample-light-linux.png differ diff --git a/packages/viewer/src/chrome/ViewerShell.test.tsx b/packages/viewer/src/chrome/ViewerShell.test.tsx index c102741..20047d9 100644 --- a/packages/viewer/src/chrome/ViewerShell.test.tsx +++ b/packages/viewer/src/chrome/ViewerShell.test.tsx @@ -13,7 +13,7 @@ describe('ViewerShell', () => { it('shows title, kind badge and counts', () => { render( {}} />); expect(screen.getByRole('heading', { level: 1, name: 'Commerce API' })).toBeInTheDocument(); - expect(screen.getAllByText('Architecture')).toHaveLength(2); // breadcrumb + badge + expect(screen.getByText('Architecture')).toBeInTheDocument(); expect(screen.getByText('6 nodes · 9 connections')).toBeInTheDocument(); }); diff --git a/packages/viewer/src/chrome/ViewerShell.tsx b/packages/viewer/src/chrome/ViewerShell.tsx index 7a5cf53..a999f9f 100644 --- a/packages/viewer/src/chrome/ViewerShell.tsx +++ b/packages/viewer/src/chrome/ViewerShell.tsx @@ -1,4 +1,3 @@ -import { ChevronRight } from 'lucide-react'; import { useLayoutEffect, useRef, useState, type KeyboardEvent } from 'react'; import type { LaidOutDiagram } from '@stackmap/core'; import { CanvasPanel } from '../canvas/CanvasPanel'; @@ -21,7 +20,7 @@ const DIAGRAM_ID = 'sm-diagram'; function ViewTabs() { const { draft, state, dispatch } = useExplore(); - const tabs = [{ id: null, label: 'Overview', caption: undefined }, ...(draft.views ?? []).map((v) => ({ ...v, id: v.id as string | null }))]; + const tabs = [{ id: null, label: 'Overview' }, ...(draft.views ?? []).map((v) => ({ ...v, id: v.id as string | null }))]; const current = tabs.find((t) => t.id === state.view) ?? tabs[0]!; // One indicator that slides between tabs, so a view change reads as a move rather than a blink. const bar = useRef(null); @@ -55,31 +54,35 @@ function ViewTabs() { document.getElementById(tabId(next.id))?.focus(); }; return ( - <> -
- {tabs.map((tab, i) => ( - - ))} -
- {current.caption &&

{current.caption}

} - + // Scrolls sideways rather than wrapping when views outgrow the row; -mb-px lays the indicator on the header rule. +
+ {tabs.map((tab, i) => ( + + ))} +
); } +function ViewCaption() { + const { draft, state } = useExplore(); + const caption = draft.views?.find((v) => v.id === state.view)?.caption; + return caption ?

{caption}

: null; +} + export function ViewerShell({ diagram, theme, @@ -104,29 +107,23 @@ export function ViewerShell({ return (
-
- -
-
-

{draft.title}

- - {KIND_LABEL[draft.kind]} - -
- - {draft.nodes.length} nodes · {draft.edges.length} connections +
+
+

{draft.title}

+ + {KIND_LABEL[draft.kind]}
+ + {draft.nodes.length} nodes · {draft.edges.length} connections +
-
+ +