I'll create a comprehensive analytics dashboard for 고려아연 (Korea Zinc) cost analysis. Let me start by exploring the project structure and then build this out.
Now let me install recharts for charts and create the full dashboard. Let me start:
Now let me update the HTML title and create all the files. I'll build the entire dashboard.
Now let me create the components directory and build each component:
Let me fix the donut chart - the activeIndex prop in recharts has changed. Let me check the API:
The activeIndex prop should work on the Pie component in recharts. The TypeScript issue might be related to the version. Let me check the installed version and adjust the approach:
Let me check the recharts types for Pie component:
I see - in recharts 3.x, there's no activeIndex prop on Pie. Instead, they use the activeShape prop with onMouseEnter/onMouseLeave on the Pie. Let me rewrite the DonutChartCard:
The activeIndex is indeed not part of the type definition in this version. Let me check how it's used internally in the JS:
Let me search for activeIndex usage in the Pie component:
So activeIndex is used internally by recharts, but it's not exposed as a prop in the type definitions. The activeShape prop works with the tooltip hover. Let me simplify the DonutChartCard to not use activeIndex as a prop since recharts handles it internally. Instead, I'll use the onMouseEnter on individual Cell elements:
The type definition doesn't include activeIndex even though the JS runtime supports it. I'll use a type assertion to bypass the TS error:
The type definition really doesn't have activeIndex. Let me check version and use a different approach with just any type casting on the props:
The ts-expect-error needs to be on the line with the error. Since Pie has overloads, it's tricky. Let me use a workaround - cast the Pie component:
Wait, the require won't work well with vite/ESM. Let me use a proper approach - just use the Pie component and cast the props object:
Good, no errors now. Now let me create the data table component:
Actually, I notice the DataTable has an onFilteredDataChange prop but that's a bit awkward since this component also does its own search/sort. Let me refactor to keep it simpler and more maintainable. Let me also simplify the component to just use the passed data directly without the callback pattern:
Now let me create the main App.tsx that ties everything together:
Now let me build and check:
The project builds successfully. Let me now review the quality and fix a small issue — I want to make the data exploration richer with more interaction. Let me also verify the CSS animation for KPI cards is defined properly (it's already injected via a <style> tag in the App component).
The build succeeded! Let me verify the overall file structure:
The project is complete. Let me provide a summary of what was built.
✅ 구축 완료: 고려아연 원가분석 대시보드
The interactive analytics dashboard has been built successfully with the following features:
📊 Component Architecture
| Component | Description |
|---|
| Filters | Date range picker (6mo/12mo/all quick selects + custom month inputs), segment chips (제련소 A/B, 해외 공장, 연구소), category chips (원자재/인건비/에너지/물류/간접비) — all updates are reactive |
| KPI Summary Cards | 6 cards (총 원가, 평균 원가, 원자재 비용, 에너지 비용, 인건비, 비용 효율성) with trend indicators (▲ up/down/― neutral), percentage change, and staggered fade-in animation |
| Line Chart | Monthly total cost by segment over time — interactive legend toggle (click dots to show/hide lines), custom tooltip, smooth animations |
| Bar Chart | Stacked cost breakdown (원자재, 인건비, 에너지, 물류, 간접비) over months — custom tooltip with all items |
| Donut Charts | Two charts: 사업장별 (by segment) and 비용 유형별 (by category) — hover for active sector popup with value and percentage |
| Data Table | Sortable columns (click header), searchable, paginated (10/page), with alternating row colors and sticky header |
| Dark Mode Toggle | Smooth toggle button (sun/moon icons) — all components respect dark/light theme |
🎨 Visual Features
- Clean modern design with card-based layout, subtle borders, backdrop blur on header
- Smooth transitions — chart animations (1200-1500ms ease-in-out), card fade-slide-up entrance, theme color transitions
- Responsive grid — 1 col → 2 col → 3 col → 6 col for KPI cards, full-width on mobile
- Custom tooltips with backdrop blur and dark/light support on all charts
- Gradient logo and accent bars on KPI cards
🔧 Tech Stack
- React 19 + TypeScript
- Vite (singlefile build)
- Tailwind CSS 4
- Recharts 3.10 for all charts
- Realistic generated data (2023-01 to 2025-03, with seasonal patterns, inflation trends, and noise)
Files built: index.html, src/types.ts, src/data.ts, src/components/ThemeToggle.tsx, src/components/KpiCard.tsx, src/components/Filters.tsx, src/components/LineChartCard.tsx, src/components/BarChartCard.tsx, src/components/DonutChartCard.tsx, src/components/DataTable.tsx, src/App.tsx