Proactively choose the right state management pattern: derived state, URL state, server state, local state, lifted state, Context, or external store. Always apply without being asked.
84
76%
Does it follow best practices?
Impact
97%
1.16xAverage score across 5 eval scenarios
Passed
No known issues
Build a sales analytics dashboard page in React with TypeScript. The page fetches daily sales data from /api/sales which returns { data: SaleRecord[] } where each SaleRecord has id: string, date: string, amount: number, category: string, and region: string.
The dashboard should include:
Users should be able to bookmark or share a dashboard URL that preserves their active filters.
Produce TypeScript/TSX files in a src/ directory:
src/types.ts -- TypeScript type definitionssrc/hooks/useSalesData.ts -- custom hook to fetch sales datasrc/components/Dashboard.tsx -- the main dashboard page with filters, table, summary, and chartsrc/components/SalesTable.tsx -- the sortable data tablesrc/components/SummaryCards.tsx -- the summary statistics cardssrc/components/SalesChart.tsx -- the chart placeholdersrc/components/FilterBar.tsx -- the filter controlssrc/App.tsx -- the app entry pointThe code does not need to run against a real server. Do not include test files or build configuration.