Provide an at-a-glance overview of file storage usage and recent upload activity.
- UI:
/page (dashboard home) - API:
GET /files/stats,GET /files,GET /files/stats/activity
apps/web/src/components/dashboard/stats-cards.tsx— 4 stat cardsapps/web/src/components/dashboard/recent-uploads-table.tsx— last 10 uploadsapps/web/src/components/dashboard/upload-chart.tsx— bar chart of uploads per dayapps/web/src/lib/api-client.ts—getFileStats(),getFiles(),getUploadActivity()services/api/app/runtime/files.py—GET /files/statshandlerservices/api/app/service/files.py—get_stats()business logicservices/api/app/repo/b2_client.py—get_upload_stats()data access
- Dashboard page layout:
apps/web/src/components/dashboard/stats-cards.tsx - Stats service logic:
services/api/app/service/files.py
- None (dashboard loads data automatically)
GET /files/stats→UploadStats(total_files, total_size_bytes, total_size_human, uploads_today, total_downloads)GET /files(limit 10) →FileMetadata[]for recent uploads table (sorted newest-first)GET /files/stats/activity?days=7→DailyUploadCount[]for chart (server-side aggregation)
- Page loads → three parallel API calls (stats, recent files, upload activity)
- Stats cards display total files, storage used, uploads today, total downloads
- Upload chart displays server-aggregated daily counts for last 7 days as bar chart
- Recent uploads table shows last 10 files with filename, size, type, date, status badge
- API unavailable → stats default to zeros, table shows empty state
- No files uploaded → empty chart message, empty table message
- Large file count → stats endpoint paginates through all objects using
ContinuationToken
- Loading: skeleton placeholders for cards and table
- Empty: "No files uploaded yet" / "No upload data available yet"
- Loaded: populated cards, chart, table
- Test files:
services/api/tests/test_upload_activity.py,services/api/tests/test_recent_files.py - Required cases: stats with files, stats with empty bucket, API error fallback
- Quick verify command:
pnpm test:api - Full verify command:
pnpm lint && pnpm lint:api && pnpm test:api && pnpm check:structure - Pass criteria: all pytest tests green, no ruff violations