# Dashboard
## One-Liner
**The Dashboard provides an at-a-glance overview of your project's workflow status, statistics, and recent activity through an intuitive widget-based interface.**
---
## Pain Points Solved
| Pain Point | Current State | Dashboard Solution |
|------------|---------------|-------------------|
| **No project visibility** | Can't see overall project health | Project info banner with tech stack and development index |
| **Scattered metrics** | Stats across multiple locations | Centralized statistics with sparklines |
| **Unknown workflow status** | Hard to track session progress | Pie chart with status breakdown |
| **Lost in recent work** | No quick access to active sessions | Session carousel with task details |
| **Indexing status unclear** | Don't know if code is indexed | Real-time index status indicator |
---
## Overview
**Location**: `ccw/frontend/src/pages/HomePage.tsx`
**Purpose**: Dashboard home page providing project overview, statistics, workflow status, and recent activity monitoring.
**Access**: Navigation → Dashboard (default home page at `/`)
**Layout**:
```
+--------------------------------------------------------------------------+
| Dashboard Header (title + refresh) |
+--------------------------------------------------------------------------+
| WorkflowTaskWidget (Combined Card) |
| +--------------------------------------------------------------------+ |
| | Project Info Banner (expandable) | |
| | - Project name, description, tech stack badges | |
| | - Quick stats (features, bugfixes, enhancements) | |
| | - Index status indicator | |
| +----------------------------------+---------------------------------+ |
| | Stats Section | Workflow Status | Task Details (Carousel) | |
| | - 6 mini cards | - Pie chart | - Session nav | |
| | - Sparklines | - Legend | - Task list (2 columns) | |
| +----------------+-----------------+-------------------------------+ |
+--------------------------------------------------------------------------+
| RecentSessionsWidget |
| +--------------------------------------------------------------------+ |
| | Tabs: All Tasks | Workflow | Lite Tasks | |
| | +---------------+---------------+-------------------------------+ | |
| | | Task cards with status, progress, tags, time | | |
| | +---------------------------------------------------------------+ | |
+--------------------------------------------------------------------------+
```
---
## Live Demo
:::demo DashboardOverview
# dashboard-overview.tsx
/**
* Dashboard Overview Demo
* Shows the main dashboard layout with widgets
*/
export function DashboardOverview() {
return (
{/* Header */}
Dashboard
Project overview and activity monitoring
{/* Workflow Stats Widget */}
Project Overview & Statistics
Statistics
{[
{ label: 'Active Sessions', value: '12', color: 'text-blue-500' },
{ label: 'Total Tasks', value: '48', color: 'text-green-500' },
{ label: 'Completed', value: '35', color: 'text-emerald-500' },
{ label: 'Pending', value: '8', color: 'text-amber-500' },
].map((stat, i) => (
{stat.value}
{stat.label}
))}
Recent Session
Feature: Auth Flow
Running
{/* Recent Sessions Widget */}
{['All Tasks', 'Workflow', 'Lite Tasks'].map((tab, i) => (
))}
{[
{ name: 'Refactor UI Components', status: 'In Progress', progress: 65 },
{ name: 'Fix Login Bug', status: 'Pending', progress: 0 },
{ name: 'Add Dark Mode', status: 'Completed', progress: 100 },
].map((task, i) => (
{task.name}
{task.status}
{task.progress > 0 && task.progress < 100 && (
)}
))}
)
}
:::
---
## Core Features
| Feature | Description |
|---------|-------------|
| **Project Info Banner** | Expandable banner showing project name, description, tech stack (languages, frameworks, architecture), development index (features/bugfixes/enhancements), and real-time index status |
| **Statistics Section** | 6 mini stat cards (Active Sessions, Total Tasks, Completed Tasks, Pending Tasks, Failed Tasks, Today Activity) with 7-day sparkline trends |
| **Workflow Status Pie Chart** | Donut chart showing session status breakdown (completed, in progress, planning, paused, archived) with percentages |
| **Session Carousel** | Auto-rotating (5s) session cards with task list, progress bar, and manual navigation arrows |
| **Recent Sessions Widget** | Tabbed view of recent tasks across all task types with filtering, status badges, and progress indicators |
| **Real-time Updates** | Auto-refresh every 60 seconds for stats and 30 seconds for index status |
---
## Component Hierarchy
```
HomePage
├── DashboardHeader
│ ├── Title
│ └── Refresh Action Button
├── WorkflowTaskWidget
│ ├── ProjectInfoBanner (expandable)
│ │ ├── Project Name & Description
│ │ ├── Tech Stack Badges
│ │ ├── Quick Stats Cards
│ │ ├── Index Status Indicator
│ │ ├── Architecture Section
│ │ ├── Key Components
│ │ └── Design Patterns
│ ├── Stats Section
│ │ └── MiniStatCard (6 cards with Sparkline)
│ ├── WorkflowStatusChart
│ │ └── Pie Chart with Legend
│ └── SessionCarousel
│ ├── Navigation Arrows
│ └── Session Cards (Task List)
└── RecentSessionsWidget
├── Tab Navigation (All | Workflow | Lite)
├── Task Grid
│ └── TaskItemCard
└── Loading/Empty States
```
---
## Props API
### HomePage Component
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| - | - | - | This page component accepts no props (data fetched via hooks) |
### WorkflowTaskWidget
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `className` | `string` | `undefined` | Additional CSS classes for styling |
### RecentSessionsWidget
| Prop | Type | Default | Description |
|------|------|---------|-------------|
| `className` | `string` | `undefined` | Additional CSS classes |
| `maxItems` | `number` | `6` | Maximum number of items to display |
---
## Usage Examples
### Basic Dashboard
```tsx
import { HomePage } from '@/pages/HomePage'
// The dashboard is automatically rendered at the root route (/)
// No props needed - data is fetched via hooks
```
### Embedding WorkflowTaskWidget
```tsx
import { WorkflowTaskWidget } from '@/components/dashboard/widgets/WorkflowTaskWidget'
function CustomDashboard() {
return (
)
}
```
### Custom Recent Sessions Widget
```tsx
import { RecentSessionsWidget } from '@/components/dashboard/widgets/RecentSessionsWidget'
function ActivityFeed() {
return (
)
}
```
---
## State Management
### Local State
| State | Type | Description |
|-------|------|-------------|
| `hasError` | `boolean` | Error tracking for critical failures |
| `projectExpanded` | `boolean` | Project info banner expansion state |
| `currentSessionIndex` | `number` | Active session index in carousel |
| `activeTab` | `'all' \| 'workflow' \| 'lite'` | Recent sessions widget filter tab |
### Store Selectors (Zustand)
| Store | Selector | Purpose |
|-------|----------|---------|
| `appStore` | `selectIsImmersiveMode` | Check if immersive mode is active |
### Custom Hooks (Data Fetching)
| Hook | Description | Refetch Interval |
|------|-------------|------------------|
| `useWorkflowStatusCounts` | Session status distribution data | - |
| `useDashboardStats` | Statistics with sparkline data | 60 seconds |
| `useProjectOverview` | Project information and tech stack | - |
| `useIndexStatus` | Real-time index status | 30 seconds |
| `useSessions` | Active sessions data | - |
| `useLiteTasks` | Lite tasks data for recent widget | - |
---
## Interactive Demos
### Statistics Cards Demo
:::demo MiniStatCards
# mini-stat-cards.tsx
/**
* Mini Stat Cards Demo
* Individual statistics cards with sparkline trends
*/
export function MiniStatCards() {
const stats = [
{ label: 'Active Sessions', value: 12, trend: [8, 10, 9, 11, 10, 12, 12], color: 'blue' },
{ label: 'Total Tasks', value: 48, trend: [40, 42, 45, 44, 46, 47, 48], color: 'green' },
{ label: 'Completed', value: 35, trend: [25, 28, 30, 32, 33, 34, 35], color: 'emerald' },
{ label: 'Pending', value: 8, trend: [12, 10, 11, 9, 8, 7, 8], color: 'amber' },
{ label: 'Failed', value: 5, trend: [3, 4, 3, 5, 4, 5, 5], color: 'red' },
{ label: 'Today Activity', value: 23, trend: [5, 10, 15, 18, 20, 22, 23], color: 'purple' },
]
const colorMap = {
blue: 'text-blue-500 bg-blue-500/10',
green: 'text-green-500 bg-green-500/10',
emerald: 'text-emerald-500 bg-emerald-500/10',
amber: 'text-amber-500 bg-amber-500/10',
red: 'text-red-500 bg-red-500/10',
purple: 'text-purple-500 bg-purple-500/10',
}
return (
Statistics with Sparklines
{stats.map((stat, i) => (
{stat.value}
{stat.trend.map((v, j) => (
))}
))}
)
}
:::
### Project Info Banner Demo
:::demo ProjectInfoBanner
# project-info-banner.tsx
/**
* Project Info Banner Demo
* Expandable project information with tech stack
*/
export function ProjectInfoBanner() {
const [expanded, setExpanded] = React.useState(false)
return (
Project Info Banner
{/* Banner Header */}
My Awesome Project
A modern web application built with React
{/* Tech Stack Badges */}
{['TypeScript', 'React', 'Vite', 'Tailwind CSS', 'Zustand'].map((tech) => (
{tech}
))}
{/* Expanded Content */}
{expanded && (
Architecture
• Component-based UI architecture
• Centralized state management
• RESTful API integration
Key Components
{['Session Manager', 'Dashboard', 'Task Scheduler', 'Analytics'].map((comp) => (
))}
)}
)
}
:::
### Session Carousel Demo
:::demo SessionCarousel
# session-carousel.tsx
/**
* Session Carousel Demo
* Auto-rotating session cards with navigation
*/
export function SessionCarousel() {
const [currentIndex, setCurrentIndex] = React.useState(0)
const sessions = [
{
name: 'Feature: User Authentication',
status: 'running',
tasks: [
{ name: 'Implement login form', status: 'completed' },
{ name: 'Add OAuth provider', status: 'in-progress' },
{ name: 'Create session management', status: 'pending' },
],
},
{
name: 'Bug Fix: Memory Leak',
status: 'running',
tasks: [
{ name: 'Identify leak source', status: 'completed' },
{ name: 'Fix cleanup handlers', status: 'in-progress' },
{ name: 'Add unit tests', status: 'pending' },
],
},
{
name: 'Refactor: API Layer',
status: 'planning',
tasks: [
{ name: 'Design new interface', status: 'pending' },
{ name: 'Migrate existing endpoints', status: 'pending' },
{ name: 'Update documentation', status: 'pending' },
],
},
]
const statusColors = {
completed: 'bg-green-500',
'in-progress': 'bg-amber-500',
pending: 'bg-muted',
}
React.useEffect(() => {
const timer = setInterval(() => {
setCurrentIndex((i) => (i + 1) % sessions.length)
}, 5000)
return () => clearInterval(timer)
}, [sessions.length])
return (
Session Carousel (auto-rotates every 5s)
Session {currentIndex + 1} of {sessions.length}
{sessions.map((_, i) => (
{sessions[currentIndex].name}
{sessions[currentIndex].status}
{sessions[currentIndex].tasks.map((task, i) => (
))}
)
}
:::
---
## Accessibility
- **Keyboard Navigation**:
- Tab - Navigate through interactive elements
- Enter/Space - Activate buttons and cards
- Arrow keys - Navigate carousel sessions
- **ARIA Attributes**:
- `aria-label` on navigation buttons
- `aria-expanded` on expandable sections
- `aria-live` regions for real-time updates
- **Screen Reader Support**:
- All charts have text descriptions
- Status indicators include text labels
- Navigation is announced properly
---
## Related Links
- [Sessions](/features/sessions) - View and manage all sessions
- [Terminal Dashboard](/features/terminal) - Terminal-first monitoring interface
- [Queue](/features/queue) - Issue execution queue management
- [Memory](/features/memory) - Persistent memory management
- [Settings](/features/settings) - Global application settings