New API Endpoint:
- GET /api/complaint/trends - Fetch complaint trends for last 7 months
Component Updates:
- Removed hardcoded trenData array (7 months mock data)
- Removed hardcoded ideInovatif array (2 mock ideas)
- Added API calls to /api/complaint/trends and /api/complaint/innovation-ideas
- Added loading states for trend chart and innovation ideas
- Added empty states for both sections
- Connected LineChart to real complaint data
- Connected Innovation Ideas list to real InnovationIdea model
Features Added:
- Real-time complaint trend visualization
- Real innovation ideas from database
- Proper TypeScript typing for API responses
- Loading skeletons during data fetch
- Empty state messages when no data
Files changed:
- src/api/complaint.ts: Added /trends endpoint
- src/components/pengaduan-layanan-publik.tsx: Connected to APIs
- generated/api.ts: Regenerated types
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
New API Endpoints (src/api/division.ts):
- GET /api/division/discussions - Fetch recent discussions with sender info
- GET /api/division/documents/stats - Fetch document counts by type
- GET /api/division/activities/stats - Fetch activity status breakdown with percentages
Components Connected to Database:
- discussion-panel.tsx: Now fetches from /api/division/discussions
- document-chart.tsx: Now fetches from /api/division/documents/stats
- progress-chart.tsx: Now fetches from /api/division/activities/stats
Features Added:
- Loading states with Loader component
- Empty states with friendly messages
- Date formatting using date-fns with Indonesian locale
- Real-time data from database instead of hardcoded values
- Proper TypeScript typing for API responses
Files changed:
- src/api/division.ts: Added 3 new API endpoints
- src/components/kinerja-divisi/discussion-panel.tsx
- src/components/kinerja-divisi/document-chart.tsx
- src/components/kinerja-divisi/progress-chart.tsx
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added detailed console logging with response structure dump
- Added Array.isArray check for data validation
- Added test data fallback (commented out) for manual testing
- Added emoji indicators for easier debugging
Testing instructions:
1. Open browser DevTools console
2. Look for 📊📈✅⚠️❌ emoji logs
3. If no data appears, check if API returns 401 (unauthorized)
4. To test chart rendering, uncomment the DEBUG useEffect block
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
1. ResponsiveContainer Layout Issue:
- Wrapped in Box with explicit height (300px)
- Changed ResponsiveContainer height to "100%" (relative to parent)
- Fixes chart not rendering due to height constraint issue
2. Bar Fill Color:
- Changed from CSS variable "var(--mantine-color-blue-filled)"
- To direct hex colors: #3B82F6 (light) / #60A5FA (dark)
- Fixes bar color not resolving
3. Empty Data Handling:
- Added check for data.length > 0
- Shows friendly message when no data available
- Prevents rendering empty chart
4. YAxis Improvement:
- Added allowDecimals={false} for cleaner integer display
5. Enhanced Debug Logging:
- Added emoji icons for easier console scanning
- Better error messages
Files changed:
- dashboard/chart-surat.tsx: Fixed all chart rendering issues
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Chart Surat:
- Added console.log debugging to track API response and data mapping
- Helps identify if data is being received but not rendered
Stat Cards:
- Removed hardcoded trend='0%' and trendValue={0} props
- Cards now display clean without misleading 0% trends
- Trend feature can be re-added later with proper API support
Files changed:
- dashboard/chart-surat.tsx: Added debug logging
- dashboard-content.tsx: Removed hardcoded trend props
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added 1 service letter with createdAt 5 days ago (within current week)
→ SKT-2025-001 (KTP) now shows in 'Surat Minggu Ini' stat
- Added 1 complaint with status SELESAI
→ COMP-20250320-003 shows in 'Layanan Selesai' stat
Dashboard stats now display:
- Surat Minggu Ini: 1 (was 0)
- Layanan Selesai: 1 (was 0)
- Pengaduan Aktif: 2 (BARU + DIPROSES)
- Total Penduduk: from resident stats
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added hasExistingData() function to check for existing seed data
- Checks core entities: users (>1), banjars (>=6), divisions (>=4)
- runSeed() now skips entirely if data exists
- runSpecificSeeder() skips non-auth seeders if data exists
- Provides helpful message with reset instructions
- Prevents accidental duplicate data on re-run
Usage:
- bun run seed - Will skip if data exists
- bun x prisma migrate reset - Reset database before re-seeding
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Added 5 service letters with createdAt dates spread across 6 months
- Changed from upsert to update/create pattern to allow createdAt modification
- This ensures chart-surat.tsx displays proper trend data
- Previous data had all timestamps at seed time, causing empty 6-month trend
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Create ActivityCard component for program kegiatan cards
- Create DivisionList component for divisi teraktif with arrow icons
- Create DocumentChart component for bar chart (jumlah dokumen)
- Create ProgressChart component for pie chart (progres kegiatan)
- Create DiscussionPanel component for diskusi internal
- Create EventCard component for agenda hari ini
- Create ArchiveCard component for arsip digital perangkat desa
- Refactor main KinerjaDivisi component to use new modular components
- Implement responsive 3-column grid layout
- Add proper dark mode support with specified colors
- Add hover effects and smooth animations
New components structure:
src/components/kinerja-divisi/
- activity-card.tsx
- archive-card.tsx
- discussion-panel.tsx
- division-list.tsx
- document-chart.tsx
- event-card.tsx
- progress-chart.tsx
- index.ts (exports)
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>