Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions docs/plans/0038-session-header-breadcrumb.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# 0038 — Session header: breadcrumb + drop the in-session Tools tab

**Status:** done

## Problem

Reported live, with screenshots: opening a session swaps the Dashboard's nav
for a different tab bar (Simple/Pro/Lap Times/Tools/Setups & Notes) that gave
no indication which session was loaded, no obvious way back to the
dashboard, and a "Tools" tab whose contents (Stance Visualizer, Seat
Position Visualizer, My Data) have nothing to do with the loaded session —
all three are session-agnostic calculators, already reachable from the
Dashboard.

## What changed

- **Breadcrumb.** The header's home button (logo + "RacePlex", already
wired to `markExplicitClose()` + `clearSession()`) gained a `›` and the
loaded session's display name, using the same
`formatSessionDisplayName()` (`fileBrowserTree.ts`) the file browser uses —
a saved `displayName` override wins, else the session's start date/time.
Reads as "RacePlex › 9/8/2026 3:51 AM", making both facts visible at once:
which session this is, and that the logo/name to its left is the way back.
`useSessionMetadata` now exposes `displayName` (it previously tracked
every other `FileMetadata` field except this one).
- **Tools tab removed from the session view.** `PanelSlot.Tools` (the
first-party tools plugin's contribution) is still rendered — just not
here. It's independently reachable from the Dashboard via
`ToolsLandingTile` (`MountSlot.Landing`), so nothing is orphaned; the
in-session copy was a pure duplicate that didn't belong once you're
looking at a specific ride. Removed `ToolsTab`'s lazy import, the
`showTools` panel-count check, the `"tools"` value from `TopPanelView`,
the tab button, and its render branch — plus the now-unused `tabs.tools`
i18n key across every locale.

## Files

- `src/pages/Index.tsx` — breadcrumb + Tools-tab removal.
- `src/hooks/useSessionMetadata.ts` — expose `displayName`.
- `src/locales/*/session.json` — drop the unused `tabs.tools` key.

## Verification

`bun run typecheck` / `bun run lint` / `bun run test:run` (2693 tests) /
`bun run build` all green. Verified live via `bun run dev`: header now reads
"RacePlex › 9/8/2026 3:51 AM" with the phone-GPS badge alongside it, the tab
bar no longer offers Tools (Simple/Pro/Lap Times/Setups & Notes only), and
clicking the RacePlex logo still returns to the dashboard.
4 changes: 4 additions & 0 deletions src/hooks/useSessionMetadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ export function useSessionMetadata(currentFileName: string | null) {
const [sessionSetupRev, setSessionSetupRev] = useState<string | null>(null);
const [postSession, setPostSession] = useState<PostSessionData | null>(null);
const [sessionSource, setSessionSource] = useState<FileMetadata["source"] | null>(null);
const [displayName, setDisplayName] = useState<string | null>(null);

const restoreFromMetadata = useCallback((meta: FileMetadata | null) => {
if (meta) {
Expand All @@ -34,13 +35,15 @@ export function useSessionMetadata(currentFileName: string | null) {
setSessionSetupRev(meta.sessionSetupRev ?? null);
setPostSession(meta.postSession ?? null);
setSessionSource(meta.source ?? null);
setDisplayName(meta.displayName?.trim() || null);
} else {
setCachedWeatherStation(null);
setSessionKartId(null);
setSessionSetupId(null);
setSessionSetupRev(null);
setPostSession(null);
setSessionSource(null);
setDisplayName(null);
}
}, []);

Expand Down Expand Up @@ -102,6 +105,7 @@ export function useSessionMetadata(currentFileName: string | null) {
sessionSetupRev,
postSession,
sessionSource,
displayName,
restoreFromMetadata,
handleWeatherStationResolved,
handleSaveSessionSetup,
Expand Down
1 change: 0 additions & 1 deletion src/locales/de/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "Pro",
"lapTimes": "Rundenzeiten",
"coach": "Coach",
"tools": "Werkzeuge",
"setups": "Setups",
"notes": "Notizen",
"setupsNotes": "Setups & Notizen"
Expand Down
1 change: 0 additions & 1 deletion src/locales/en/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
"pro": "Pro",
"lapTimes": "Lap Times",
"coach": "Coach",
"tools": "Tools",
"setups": "Setups",
"notes": "Notes",
"setupsNotes": "Setups & Notes"
Expand Down
1 change: 0 additions & 1 deletion src/locales/es/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "Pro",
"lapTimes": "Tiempos de vuelta",
"coach": "Coach",
"tools": "Herramientas",
"setups": "Reglajes",
"notes": "Notas",
"setupsNotes": "Reglajes y notas"
Expand Down
1 change: 0 additions & 1 deletion src/locales/fr/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "Pro",
"lapTimes": "Temps au tour",
"coach": "Coach",
"tools": "Outils",
"setups": "Réglages",
"notes": "Notes",
"setupsNotes": "Réglages et notes"
Expand Down
1 change: 0 additions & 1 deletion src/locales/it/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "Pro",
"lapTimes": "Tempi sul giro",
"coach": "Coach",
"tools": "Strumenti",
"setups": "Assetti",
"notes": "Note",
"setupsNotes": "Assetti e note"
Expand Down
1 change: 0 additions & 1 deletion src/locales/ja/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "プロ",
"lapTimes": "ラップタイム",
"coach": "コーチ",
"tools": "ツール",
"setups": "セットアップ",
"notes": "メモ",
"setupsNotes": "セットアップとメモ"
Expand Down
1 change: 0 additions & 1 deletion src/locales/pt-BR/session.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"pro": "Pro",
"lapTimes": "Tempos de volta",
"coach": "Coach",
"tools": "Ferramentas",
"setups": "Acertos",
"notes": "Notas",
"setupsNotes": "Acertos e notas"
Expand Down
44 changes: 24 additions & 20 deletions src/pages/Index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { useCallback, useEffect, useMemo, useState, lazy, Suspense } from "react";
import { useLocation, useNavigate } from "react-router-dom";
import { useTranslation } from "react-i18next";
import { Gauge, Map, ListOrdered, BarChart3, FolderOpen, Play, Pause, StepBack, StepForward, Eye, EyeOff, AlertCircle, AlertTriangle, Wrench, NotebookPen, SlidersHorizontal, Columns2 } from "lucide-react";
import { Gauge, Map, ListOrdered, BarChart3, FolderOpen, Play, Pause, StepBack, StepForward, Eye, EyeOff, AlertCircle, AlertTriangle, ChevronRight, NotebookPen, SlidersHorizontal, Columns2 } from "lucide-react";
import { BrandLogo } from "@/components/BrandLogo";
import { Dashboard } from "@/pages/Dashboard";
import { useAutoOpenLastSession } from "@/hooks/useAutoOpenLastSession";
Expand All @@ -23,9 +23,6 @@ const GraphViewTab = lazy(() =>
const CoachTab = lazy(() =>
import("@/components/tabs/CoachTab").then((m) => ({ default: m.CoachTab })),
);
const ToolsTab = lazy(() =>
import("@/components/tabs/ToolsTab").then((m) => ({ default: m.ToolsTab })),
);
// Setups is a main-view tab built on the same component the garage drawer used.
// Lazy-loaded — it pulls in the template creator + setup-history panel that the
// landing/initial view never needs.
Expand All @@ -46,6 +43,7 @@ import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from "@/comp
import { ParsedData } from "@/types/racing";
import { parseDatalogFile } from "@/lib/datalogParser";
import { calculateDistanceArray } from "@/lib/referenceUtils";
import { formatSessionDisplayName } from "@/lib/fileBrowserTree";
import { formatAxisDistance } from "@/lib/chartAxis";
import { applyPalette } from "@/lib/palettes";
import { cn } from "@/lib/utils";
Expand Down Expand Up @@ -84,7 +82,7 @@ import { takePendingLeaderboardSession } from "@/lib/leaderboardHandoff";
import type { LeaderboardDescriptor } from "@/lib/leaderboardSession";


type TopPanelView = "raceline" | "laptable" | "graphview" | "coach" | "tools" | "setups" | "notes";
type TopPanelView = "raceline" | "laptable" | "graphview" | "coach" | "setups" | "notes";

const enableAdmin = import.meta.env.VITE_ENABLE_ADMIN === 'true';
const enableCloud = import.meta.env.VITE_ENABLE_CLOUD === 'true';
Expand Down Expand Up @@ -206,7 +204,7 @@ export default function Index() {

// Session metadata
const sessionMeta = useSessionMetadata(currentFileName);
const { cachedWeatherStation, sessionKartId, sessionSetupId, sessionSetupRev, postSession, sessionSource } = sessionMeta;
const { cachedWeatherStation, sessionKartId, sessionSetupId, sessionSetupRev, postSession, sessionSource, displayName: sessionDisplayName } = sessionMeta;

// Playback
const { isPlaying, toggle: togglePlayback, averageFrameRate } = usePlayback({
Expand All @@ -225,9 +223,6 @@ export default function Index() {
// The Coach tab is self-gating: it appears only when a plugin contributes a
// panel to the Coach slot (i.e. the coach package is installed).
const showCoach = usePanelsForSlot(PanelSlot.Coach).length > 0;
// Tools tab is self-gating like Coach: it appears only when a plugin
// contributes a panel to the Tools slot (the first-party tools plugin does).
const showTools = usePanelsForSlot(PanelSlot.Tools).length > 0;
// Profile tab is self-gating too: appears only when a plugin (cloud-sync)
// contributes a Profile panel (i.e. the cloud build flag is on).
const showProfile = usePanelsForSlot(PanelSlot.Profile).length > 0;
Expand Down Expand Up @@ -753,7 +748,11 @@ export default function Index() {
);
}


// The loaded session's label for the header breadcrumb — a saved
// display-name override (the bundled sample) wins, else the session's own
// start date/time, same formatting the file browser uses for consistency.
const sessionLabel = sessionDisplayName?.trim() || formatSessionDisplayName(data.startDate?.getTime(), currentFileName ?? "");

// Data loaded - show main view
return (
<DeviceProvider>
Expand Down Expand Up @@ -782,11 +781,23 @@ export default function Index() {
clearSession();
}}
aria-label={t("header.home")}
className="flex items-center gap-3 rounded-md focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
className="flex items-center gap-3 rounded-md shrink-0 focus-visible:outline-hidden focus-visible:ring-2 focus-visible:ring-ring"
>
<BrandLogo className="w-6 h-6" />
<span className="font-semibold text-foreground hidden sm:inline">RacePlex</span>
</button>
{/* Breadcrumb: which session is loaded, and a reminder the logo
above is the way back — the logo alone didn't read as a nav
control. */}
<div className="flex items-center gap-1.5 min-w-0">
<ChevronRight className="w-4 h-4 text-muted-foreground shrink-0" />
<span
className="min-w-0 truncate text-sm font-medium text-muted-foreground"
title={sessionLabel}
>
{sessionLabel}
</span>
</div>
{sessionSource === "phone-gps" && (
<TooltipProvider>
<Tooltip>
Expand Down Expand Up @@ -913,7 +924,7 @@ export default function Index() {
</header>

<main className="flex-1 min-h-0 overflow-hidden flex flex-col">
<TabBar topPanelView={topPanelView} setTopPanelView={setTopPanelView} laps={laps} showOverlays={showOverlays} onToggleOverlays={() => setShowOverlays(v => !v)} showCoach={showCoach && !readOnly} showTools={showTools && !readOnly} readOnly={readOnly} setupIndicator={readOnly ? null : setupIndicator} onSetupIndicatorClick={() => setupIndicator && navigateToManage(setupIndicator.target)} overlayLines={overlayLines} splitActive={splitActive} onStartSplit={startSplit} onCombineSplit={combineSplit} />
<TabBar topPanelView={topPanelView} setTopPanelView={setTopPanelView} laps={laps} showOverlays={showOverlays} onToggleOverlays={() => setShowOverlays(v => !v)} showCoach={showCoach && !readOnly} readOnly={readOnly} setupIndicator={readOnly ? null : setupIndicator} onSetupIndicatorClick={() => setupIndicator && navigateToManage(setupIndicator.target)} overlayLines={overlayLines} splitActive={splitActive} onStartSplit={startSplit} onCombineSplit={combineSplit} />


<div className="flex-1 min-h-0 overflow-hidden">
Expand All @@ -922,7 +933,6 @@ export default function Index() {
{topPanelView === "raceline" && <RaceLineTab showOverlays={showOverlays} />}
{topPanelView === "graphview" && <GraphViewTab />}
{topPanelView === "coach" && showCoach && <CoachTab />}
{topPanelView === "tools" && showTools && <ToolsTab />}
{/* Setups + Notes share one surface: a 50/50 split on tablet/desktop,
separate full-width tabs on phones (see SetupsNotesPanel). */}
{(topPanelView === "setups" || topPanelView === "notes") && (
Expand Down Expand Up @@ -991,14 +1001,13 @@ export default function Index() {
}

/** Tab navigation bar for the main data view */
function TabBar({ topPanelView, setTopPanelView, laps, showOverlays, onToggleOverlays, showCoach, showTools, readOnly, setupIndicator, onSetupIndicatorClick, overlayLines, splitActive, onStartSplit, onCombineSplit }: {
function TabBar({ topPanelView, setTopPanelView, laps, showOverlays, onToggleOverlays, showCoach, readOnly, setupIndicator, onSetupIndicatorClick, overlayLines, splitActive, onStartSplit, onCombineSplit }: {
topPanelView: TopPanelView;
setTopPanelView: (view: TopPanelView) => void;
laps: { lapNumber: number }[];
showOverlays: boolean;
onToggleOverlays: () => void;
showCoach: boolean;
showTools: boolean;
readOnly?: boolean;
setupIndicator: SetupIndicator | null;
onSetupIndicatorClick: () => void;
Expand Down Expand Up @@ -1038,11 +1047,6 @@ function TabBar({ topPanelView, setTopPanelView, laps, showOverlays, onToggleOve
<Gauge className="w-4 h-4" /> <span className="hidden sm:inline">{t("tabs.coach")}</span>
</button>
)}
{showTools && (
<button onClick={() => setTopPanelView("tools")} className={tabClass("tools")}>
<Wrench className="w-4 h-4" /> <span className="hidden sm:inline">{t("tabs.tools")}</span>
</button>
)}
{/* Phones: Setups and Notes are separate tabs. Tablet/desktop: one merged
tab opens the 50/50 split (SetupsNotesPanel handles the layout). Hidden
in read-only leaderboard view (no saving). */}
Expand Down