# FlowPilot Dashboard & Sidebar Redesign — Implementation Plan > **For Claude:** REQUIRED SUB-SKILL: Use superpowers:executing-plans to implement this plan task-by-task. **Goal:** Transform the dashboard into a FlowPilot-centric cockpit where engineers land, see their active work, start new sessions, and navigate to deeper pages — with every number acting as a portal. **Architecture:** Replace `QuickStartPage` with a new `FlowPilotDashboardPage` composed of section cards that each call existing APIs (sidebar stats, AI sessions, escalation queue, flowpilot analytics). Restructure the sidebar from 3 sections (Resolve/Build/Insights) to a cleaner nav (Resolve/Knowledge/Insights) with stats moved to the dashboard. No backend changes needed. **Tech Stack:** React 19, TypeScript, Tailwind CSS v4, Zustand, Lucide React, existing API clients --- ## Task 1: Create StartSessionInput Component **Files:** - Create: `frontend/src/components/dashboard/StartSessionInput.tsx` **What it does:** A prominent text input with Guided | Chat mode toggle. Pressing Enter navigates to `/pilot` (Guided) or `/assistant` (Chat) with the problem text pre-filled via router state. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/StartSessionInput.tsx import { useState, useRef, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { Sparkles, MessageCircle } from 'lucide-react' import { cn } from '@/lib/utils' type SessionMode = 'guided' | 'chat' export function StartSessionInput() { const [mode, setMode] = useState('guided') const [value, setValue] = useState('') const navigate = useNavigate() const inputRef = useRef(null) // Auto-focus on mount useEffect(() => { inputRef.current?.focus() }, []) const handleSubmit = () => { const trimmed = value.trim() if (!trimmed) return if (mode === 'guided') { navigate('/pilot', { state: { prefill: trimmed } }) } else { navigate('/assistant', { state: { prefill: trimmed } }) } } const handleKeyDown = (e: React.KeyboardEvent) => { if (e.key === 'Enter' && !e.shiftKey) { e.preventDefault() handleSubmit() } } return (
setValue(e.target.value)} onKeyDown={handleKeyDown} placeholder="What are you troubleshooting?" className="w-full rounded-xl border border-border bg-background py-3.5 pl-11 pr-4 text-sm text-foreground placeholder:text-muted-foreground focus:border-[rgba(6,182,212,0.3)] focus:outline-hidden focus:ring-1 focus:ring-primary/20" />
Press Enter to start
) } ``` **Step 2: Verify build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build 2>&1 | tail -5` Expected: Build succeeds (component isn't imported yet, just verifying no syntax errors via tree-shaking) **Step 3: Commit** ```bash git add frontend/src/components/dashboard/StartSessionInput.tsx git commit -m "feat(dashboard): add StartSessionInput with guided/chat mode toggle" ``` --- ## Task 2: Create PendingEscalations Component **Files:** - Create: `frontend/src/components/dashboard/PendingEscalations.tsx` **What it does:** Shows unacknowledged escalations with "Pick up" buttons. Only renders if there are pending escalations. Team leads see all team escalations; engineers see their own. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/PendingEscalations.tsx import { useState, useEffect } from 'react' import { Link, useNavigate } from 'react-router-dom' import { AlertTriangle } from 'lucide-react' import { aiSessionsApi } from '@/api/aiSessions' import type { AISessionSummary } from '@/types/ai-session' function timeAgo(dateStr: string): string { const diffMs = Date.now() - new Date(dateStr).getTime() const minutes = Math.floor(diffMs / 60000) if (minutes < 1) return 'just now' if (minutes < 60) return `${minutes}m ago` const hours = Math.floor(minutes / 60) if (hours < 24) return `${hours}h ago` return `${Math.floor(hours / 24)}d ago` } export function PendingEscalations() { const [escalations, setEscalations] = useState([]) const navigate = useNavigate() useEffect(() => { aiSessionsApi.getEscalationQueue() .then(setEscalations) .catch(() => {}) }, []) if (escalations.length === 0) return null return (

Pending Escalations {escalations.length}

View all
{escalations.slice(0, 3).map((esc, i) => (
{esc.problem_summary || 'Escalated session'}
{esc.problem_domain || 'General'} · {timeAgo(esc.created_at)}
))}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/PendingEscalations.tsx git commit -m "feat(dashboard): add PendingEscalations component with pickup action" ``` --- ## Task 3: Create ActiveFlowPilotSessions Component **Files:** - Create: `frontend/src/components/dashboard/ActiveFlowPilotSessions.tsx` **What it does:** Shows the user's active FlowPilot (AI) sessions as cards. Click any card to resume at `/pilot/{id}`. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/ActiveFlowPilotSessions.tsx import { useState, useEffect } from 'react' import { Link, useNavigate } from 'react-router-dom' import { Sparkles, Clock, ArrowRight } from 'lucide-react' import { aiSessionsApi } from '@/api/aiSessions' import type { AISessionSummary } from '@/types/ai-session' import { cn } from '@/lib/utils' function timeAgo(dateStr: string): string { const diffMs = Date.now() - new Date(dateStr).getTime() const minutes = Math.floor(diffMs / 60000) if (minutes < 1) return 'just now' if (minutes < 60) return `${minutes}m ago` const hours = Math.floor(minutes / 60) if (hours < 24) return `${hours}h ago` return `${Math.floor(hours / 24)}d ago` } export function ActiveFlowPilotSessions() { const [sessions, setSessions] = useState([]) const [loading, setLoading] = useState(true) const navigate = useNavigate() useEffect(() => { aiSessionsApi.listSessions({ status: 'active', limit: 6 }) .then(setSessions) .catch(() => {}) .finally(() => setLoading(false)) }, []) if (loading) { return (

Active Sessions

{Array.from({ length: 3 }).map((_, i) => (
))}
) } return (

Active Sessions

{sessions.length > 0 && ( {sessions.length} )}
View all
{sessions.length === 0 ? (

No active sessions

Start typing above to begin troubleshooting

) : (
{sessions.map((session) => ( ))}
)}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/ActiveFlowPilotSessions.tsx git commit -m "feat(dashboard): add ActiveFlowPilotSessions card grid" ``` --- ## Task 4: Create PerformanceCards Component **Files:** - Create: `frontend/src/components/dashboard/PerformanceCards.tsx` **What it does:** 4 stat cards (Resolved Today, Avg MTTR, Success Rate, Escalated) — each clickable to navigate to analytics. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/PerformanceCards.tsx import { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { CheckCircle, Clock, TrendingUp, AlertTriangle } from 'lucide-react' import type { LucideIcon } from 'lucide-react' import { sidebarApi } from '@/api' import { cn } from '@/lib/utils' interface StatCard { label: string value: string | number icon: LucideIcon iconColor: string href: string highlight?: boolean } export function PerformanceCards() { const navigate = useNavigate() const [resolved, setResolved] = useState(0) const [active, setActive] = useState(0) const [totalMinutes, setTotalMinutes] = useState(0) useEffect(() => { sidebarApi.getStats() .then((stats) => { setResolved(stats.resolved_today) setActive(stats.active_count) setTotalMinutes(stats.total_session_minutes_today) }) .catch(() => {}) }, []) const avgMttr = resolved > 0 ? Math.round(totalMinutes / resolved) : 0 const cards: StatCard[] = [ { label: 'Resolved Today', value: resolved, icon: CheckCircle, iconColor: '#34d399', href: '/analytics', highlight: true, }, { label: 'Avg Resolution', value: avgMttr > 0 ? `${avgMttr}m` : '—', icon: Clock, iconColor: '#22d3ee', href: '/analytics', }, { label: 'Active Now', value: active, icon: TrendingUp, iconColor: '#38bdf8', href: '/sessions?filter=active', }, { label: 'Session Time', value: totalMinutes > 0 ? `${totalMinutes}m` : '—', icon: AlertTriangle, iconColor: '#fbbf24', href: '/analytics', }, ] return (
{cards.map((card, i) => ( ))}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/PerformanceCards.tsx git commit -m "feat(dashboard): add PerformanceCards with clickable stat cards" ``` --- ## Task 5: Create KnowledgeBaseCards Component **Files:** - Create: `frontend/src/components/dashboard/KnowledgeBaseCards.tsx` **What it does:** Shows counts (Flows, Scripts, Pending Review) — each clickable to navigate to the relevant page. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/KnowledgeBaseCards.tsx import { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { Network, Code2, ListChecks, ArrowRight } from 'lucide-react' import { sidebarApi } from '@/api' export function KnowledgeBaseCards() { const navigate = useNavigate() const [flowCount, setFlowCount] = useState(0) useEffect(() => { sidebarApi.getStats() .then((stats) => { setFlowCount(stats.tree_counts.total) }) .catch(() => {}) }, []) const items = [ { label: 'Flows', value: flowCount, icon: Network, color: '#a78bfa', href: '/trees' }, { label: 'Scripts', value: '—', icon: Code2, color: '#2dd4bf', href: '/scripts' }, { label: 'Pending Review', value: '—', icon: ListChecks, color: '#fbbf24', href: '/review-queue' }, ] return (

Knowledge Base

{items.map((item) => ( ))}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/KnowledgeBaseCards.tsx git commit -m "feat(dashboard): add KnowledgeBaseCards with portal navigation" ``` --- ## Task 6: Create TeamSummary Component **Files:** - Create: `frontend/src/components/dashboard/TeamSummary.tsx` **What it does:** Admin/team lead only section showing team-wide metrics. Each number navigates to its detail page. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/TeamSummary.tsx import { useState, useEffect } from 'react' import { useNavigate } from 'react-router-dom' import { Users, AlertTriangle, Activity, ArrowRight } from 'lucide-react' import { usePermissions } from '@/hooks/usePermissions' import { aiSessionsApi } from '@/api/aiSessions' export function TeamSummary() { const { isAccountOwner } = usePermissions() const navigate = useNavigate() const [escalationCount, setEscalationCount] = useState(0) useEffect(() => { if (!isAccountOwner) return aiSessionsApi.getEscalationQueue() .then((esc) => setEscalationCount(esc.length)) .catch(() => {}) }, [isAccountOwner]) if (!isAccountOwner) return null const items = [ { label: 'Escalations', value: escalationCount, icon: AlertTriangle, color: '#fbbf24', href: '/escalations' }, { label: 'Team Activity', value: '—', icon: Activity, color: '#22d3ee', href: '/analytics' }, { label: 'Members', value: '—', icon: Users, color: '#a78bfa', href: '/account' }, ] return (

Team Summary

{items.map((item) => ( ))}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/TeamSummary.tsx git commit -m "feat(dashboard): add TeamSummary component (admin/lead only)" ``` --- ## Task 7: Create RecentFlowPilotSessions Component **Files:** - Create: `frontend/src/components/dashboard/RecentFlowPilotSessions.tsx` **What it does:** Shows last 5 completed/escalated AI sessions with status indicators and links to history. **Step 1: Create the component** ```tsx // frontend/src/components/dashboard/RecentFlowPilotSessions.tsx import { useState, useEffect } from 'react' import { Link, useNavigate } from 'react-router-dom' import { CheckCircle, AlertTriangle, XCircle, ArrowRight } from 'lucide-react' import { aiSessionsApi } from '@/api/aiSessions' import type { AISessionSummary } from '@/types/ai-session' function timeAgo(dateStr: string): string { const diffMs = Date.now() - new Date(dateStr).getTime() const minutes = Math.floor(diffMs / 60000) if (minutes < 1) return 'just now' if (minutes < 60) return `${minutes}m ago` const hours = Math.floor(minutes / 60) if (hours < 24) return `${hours}h ago` const days = Math.floor(hours / 24) if (days === 1) return 'yesterday' return `${days}d ago` } const STATUS_CONFIG: Record = { resolved: { icon: CheckCircle, color: '#34d399', label: 'Resolved' }, escalated: { icon: AlertTriangle, color: '#fbbf24', label: 'Escalated' }, abandoned: { icon: XCircle, color: '#8891a0', label: 'Abandoned' }, } export function RecentFlowPilotSessions() { const [sessions, setSessions] = useState([]) const navigate = useNavigate() useEffect(() => { // Fetch recent completed sessions (resolved, escalated, abandoned) Promise.all([ aiSessionsApi.listSessions({ status: 'resolved', limit: 5 }).catch(() => []), aiSessionsApi.listSessions({ status: 'escalated', limit: 3 }).catch(() => []), ]).then(([resolved, escalated]) => { const all = [...resolved, ...escalated] .sort((a, b) => new Date(b.created_at).getTime() - new Date(a.created_at).getTime()) .slice(0, 5) setSessions(all) }) }, []) if (sessions.length === 0) return null return (

Recent Sessions

History
{sessions.map((session, i) => { const config = STATUS_CONFIG[session.status] || STATUS_CONFIG.abandoned const StatusIcon = config.icon return ( ) })}
) } ``` **Step 2: Commit** ```bash git add frontend/src/components/dashboard/RecentFlowPilotSessions.tsx git commit -m "feat(dashboard): add RecentFlowPilotSessions with status indicators" ``` --- ## Task 8: Assemble FlowPilotDashboardPage **Files:** - Modify: `frontend/src/pages/QuickStartPage.tsx` (rewrite) **What it does:** Replace the current QuickStartPage content with the new FlowPilot cockpit layout, composing all the new section components. **Step 1: Rewrite QuickStartPage** Replace the entire file content with: ```tsx // frontend/src/pages/QuickStartPage.tsx import { PageMeta } from '@/components/common/PageMeta' import { useAuthStore } from '@/store/authStore' import { StartSessionInput } from '@/components/dashboard/StartSessionInput' import { PendingEscalations } from '@/components/dashboard/PendingEscalations' import { ActiveFlowPilotSessions } from '@/components/dashboard/ActiveFlowPilotSessions' import { PerformanceCards } from '@/components/dashboard/PerformanceCards' import { KnowledgeBaseCards } from '@/components/dashboard/KnowledgeBaseCards' import { TeamSummary } from '@/components/dashboard/TeamSummary' import { RecentFlowPilotSessions } from '@/components/dashboard/RecentFlowPilotSessions' import { OnboardingChecklist } from '@/components/dashboard/OnboardingChecklist' export function QuickStartPage() { const user = useAuthStore((s) => s.user) return (
{/* Greeting */}

Good{' '} {new Date().getHours() < 12 ? 'morning' : new Date().getHours() < 18 ? 'afternoon' : 'evening'} , {user?.name?.split(' ')[0] || 'there'}

{new Date().toLocaleDateString('en-US', { weekday: 'long', month: 'long', day: 'numeric', year: 'numeric', })}

{/* Onboarding */} {/* 1. Start Session Input */}
{/* 2. Pending Escalations (auto-hides if none) */} {/* 3. Active Sessions */} {/* 4. Performance Stats */} {/* 5 + 6. Knowledge Base + Team Summary side by side on desktop */}
{/* 7. Recent Sessions */}
) } export default QuickStartPage ``` **Step 2: Verify build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build 2>&1 | tail -5` Expected: Build succeeds **Step 3: Commit** ```bash git add frontend/src/pages/QuickStartPage.tsx git commit -m "feat(dashboard): replace QuickStartPage with FlowPilot cockpit layout" ``` --- ## Task 9: Wire Prefill into FlowPilotSessionPage and AssistantChatPage **Files:** - Modify: `frontend/src/pages/FlowPilotSessionPage.tsx` — read `location.state.prefill` and pass to `FlowPilotIntake` - Modify: `frontend/src/pages/AssistantChatPage.tsx` — read `location.state.prefill` and auto-send first message **Step 1: Update FlowPilotSessionPage** In `FlowPilotSessionPage.tsx`, add after the existing `useParams`/`useSearchParams`: ```tsx const location = useLocation() const prefill = (location.state as { prefill?: string })?.prefill || '' ``` Pass `prefill` to `FlowPilotIntake` as a `defaultProblem` prop. In the `FlowPilotIntake` component, initialize the problem field with this value. **Step 2: Update AssistantChatPage** In `AssistantChatPage.tsx`, read `location.state.prefill`. If present and no existing chat is loaded, auto-populate the input field and optionally auto-send. **Step 3: Verify build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build 2>&1 | tail -5` **Step 4: Commit** ```bash git add frontend/src/pages/FlowPilotSessionPage.tsx frontend/src/pages/AssistantChatPage.tsx git commit -m "feat(dashboard): wire prefill from dashboard input to FlowPilot and Chat" ``` --- ## Task 10: Restructure Sidebar Navigation **Files:** - Modify: `frontend/src/components/layout/Sidebar.tsx` **What it does:** Replace the 3-section nav (Resolve/Build/Insights) with the new structure: Dashboard → Resolve (Active Sessions, History, Escalations) → Knowledge (Flows, Step Library, Scripts, Review Queue) → Insights (Analytics, FlowPilot Analytics). Remove SidebarStatsBar, SidebarActivityFeed, and "New Session" CTA. **Step 1: Update expanded sidebar nav** Replace lines 106-175 (the expanded mode content) with: ```tsx {/* Navigation — no stats bar, no activity feed, no New Session CTA */}
{/* Dashboard */} {/* Resolve */}
Resolve
{/* Knowledge */}
Knowledge
{/* Insights */}
Insights
``` **Step 2: Update collapsed sidebar** Update the collapsed icon list to match (remove New Session, FlowPilot, Flow Editor, Flow Assist, KB Accelerator). **Step 3: Remove unused imports** Remove `SidebarStatsBar` and `SidebarActivityFeed` imports (they're no longer rendered). **Step 4: Verify build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build 2>&1 | tail -5` **Step 5: Commit** ```bash git add frontend/src/components/layout/Sidebar.tsx git commit -m "refactor(sidebar): restructure nav to Resolve/Knowledge/Insights sections" ``` --- ## Task 11: Update Mobile Nav in AppLayout **Files:** - Modify: `frontend/src/components/layout/AppLayout.tsx` **What it does:** Update the mobile hamburger menu items to match the new sidebar structure. **Step 1: Update mobile nav items** Find the mobile nav items array and replace with: ```tsx const mobileNavItems = [ { href: '/', label: 'Dashboard', icon: LayoutGrid }, { href: '/sessions?filter=active', label: 'Active Sessions', icon: Clock }, { href: '/sessions', label: 'History', icon: Clock }, { href: '/escalations', label: 'Escalations', icon: AlertTriangle }, { href: '/trees', label: 'Flows', icon: Network }, { href: '/step-library', label: 'Step Library', icon: Library }, { href: '/scripts', label: 'Scripts', icon: Code2 }, { href: '/analytics', label: 'Analytics', icon: BarChart3 }, { href: '/account', label: 'Account', icon: Settings }, ] ``` **Step 2: Verify build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build 2>&1 | tail -5` **Step 3: Commit** ```bash git add frontend/src/components/layout/AppLayout.tsx git commit -m "refactor(mobile): update mobile nav to match new sidebar structure" ``` --- ## Task 12: Final Build Verification + Cleanup **Step 1: Full frontend build** Run: `cd frontend && PATH="/home/michaelchihlas/.nvm/versions/node/v20.19.0/bin:$PATH" npm run build` Expected: Clean build with no errors **Step 2: Backend tests** Run: `cd backend && source venv/bin/activate && python -m pytest tests/ -x -q --override-ini="addopts=" 2>&1 | tail -10` Expected: All tests pass (no backend changes, so this is a sanity check) **Step 3: Verify all routes still work** Manual spot-check that these routes still load: - `/` — new dashboard - `/pilot` — FlowPilot (still works) - `/assistant` — Chat (still works) - `/sessions` — Session history - `/escalations` — Escalation queue - `/trees` — Flow library - `/analytics` — Team analytics - `/my-trees` — Flow editor (deep link still works even though removed from nav) **Step 4: Commit and push** ```bash git add -A git commit -m "chore: final build verification for dashboard/sidebar redesign" git push ``` --- ## Removed Items — Routes Preserved These pages are removed from nav but their routes are NOT deleted (deep links still work): - `/assistant` — FlowPilot Chat (accessible via dashboard Chat mode) - `/my-trees` — Flow Editor (accessible via Flows sub-navigation or direct link) - `/flow-assist` — Flow Assist (accessible from within flow editor) - `/kb-accelerator` — KB Accelerator (accessible from review queue) No routes are deleted from `router.tsx` — only sidebar nav links are reorganized.