From 5b4026d36fc83271e8c3198200428b8104862404 Mon Sep 17 00:00:00 2001 From: Jean-Luc Makiola Date: Tue, 17 Mar 2026 15:30:38 +0100 Subject: [PATCH] feat(12-01): wire compare toggle and ComparisonTable into thread detail - Extend uiStore candidateViewMode union to include "compare" value - Add columns-3 compare toggle button, shown only when thread has 2+ candidates - Hide "Add Candidate" button when in compare view (read-only intent) - Import and render ComparisonTable when candidateViewMode === "compare" - Pass displayItems so compare view reflects any pending reorder state - Existing list/grid views unchanged; all 135 tests pass --- src/client/routes/threads/$threadId.tsx | 22 +++++++++++++++++++++- src/client/stores/uiStore.ts | 4 ++-- 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/src/client/routes/threads/$threadId.tsx b/src/client/routes/threads/$threadId.tsx index f16ccc2..4ba63b2 100644 --- a/src/client/routes/threads/$threadId.tsx +++ b/src/client/routes/threads/$threadId.tsx @@ -3,6 +3,7 @@ import { Reorder } from "framer-motion"; import { useEffect, useState } from "react"; import { CandidateCard } from "../../components/CandidateCard"; import { CandidateListItem } from "../../components/CandidateListItem"; +import { ComparisonTable } from "../../components/ComparisonTable"; import { useReorderCandidates, useUpdateCandidate, @@ -120,7 +121,7 @@ function ThreadDetailPage() { {/* Toolbar: Add candidate + view toggle */}
- {isActive && ( + {isActive && candidateViewMode !== "compare" && ( + {thread.candidates.length >= 2 && ( + + )}
)} @@ -189,6 +204,11 @@ function ThreadDetailPage() { Add your first candidate to start comparing.

+ ) : candidateViewMode === "compare" ? ( + ) : candidateViewMode === "list" ? ( isActive ? ( void; // Candidate view mode - candidateViewMode: "list" | "grid"; - setCandidateViewMode: (mode: "list" | "grid") => void; + candidateViewMode: "list" | "grid" | "compare"; + setCandidateViewMode: (mode: "list" | "grid" | "compare") => void; } export const useUIStore = create((set) => ({