โ† ะะฐะทะฐะด

Dashboard Migration Log

2026-02-25 โ€” React Refactor Complete

What Changed

Before (dashboard-old) After (dashboard)
3,180 lines HTML monolith 21 React components
Vanilla JS + inline CSS React 18 + TypeScript + Tailwind
No build step Vite build system
Font Awesome icons Lucide React icons
Manual fetch React Query (auto-refresh)
140KB+ uncompressed 169KB gzipped bundle

Architecture

dashboard/
โ”œโ”€โ”€ src/
โ”‚   โ”œโ”€โ”€ components/
โ”‚   โ”‚   โ”œโ”€โ”€ cards/          # SystemCard, OpenClawCard, PiewellCard, ScreenerCard
โ”‚   โ”‚   โ”œโ”€โ”€ modals/         # KpiModal, KanbanModal
โ”‚   โ”‚   โ”œโ”€โ”€ ui/             # Card, Button, Badge, Dialog (shadcn/ui style)
โ”‚   โ”‚   โ”œโ”€โ”€ Header.tsx
โ”‚   โ”‚   โ””โ”€โ”€ Footer.tsx
โ”‚   โ”œโ”€โ”€ hooks/
โ”‚   โ”‚   โ”œโ”€โ”€ useProjects.ts  # React Query for projects API
โ”‚   โ”‚   โ”œโ”€โ”€ useSystem.ts    # React Query for system metrics
โ”‚   โ”‚   โ””โ”€โ”€ useTheme.ts     # Dark/light theme toggle
โ”‚   โ”œโ”€โ”€ lib/
โ”‚   โ”‚   โ”œโ”€โ”€ api.ts          # API client
โ”‚   โ”‚   โ””โ”€โ”€ utils.ts        # Helpers (cn, formatUptime, formatBytes)
โ”‚   โ”œโ”€โ”€ types/
โ”‚   โ”‚   โ””โ”€โ”€ index.ts        # TypeScript interfaces
โ”‚   โ”œโ”€โ”€ App.tsx
โ”‚   โ””โ”€โ”€ main.tsx
โ”œโ”€โ”€ dist/                   # Production build (deployed)
โ”œโ”€โ”€ backend/                # Node.js API (unchanged)
โ”œโ”€โ”€ DEPLOY.md               # Deployment guide
โ”œโ”€โ”€ README.md               # Quick start
โ””โ”€โ”€ package.json

API Endpoints Used

GET /api/projects          # All projects summary
GET /api/projects/:id      # Single project details
GET /api/system            # System metrics (CPU, RAM, Disk)
GET /api/projects/:id/kanban-tasks  # Task board data
POST /api/actions/restart  # Restart service

Key Features Preserved

New Features Added

Deployment

Current: https://dashboard.szhub.space Build: npm run build โ†’ dist/ folder Server: PM2 + nginx proxy

Legacy Files (dashboard-old)

Kept for reference. Contains:

Can be deleted after: 2026-03-25 (30 days retention)

Next Steps

  1. Phase 2: Add drag-and-drop card reordering (@dnd-kit)
  2. Phase 3: Full recharts integration (historical data)
  3. Phase 4: PWA + offline support

Files Modified in Backend

/home/app/dashboard/backend/index.js:


Migration Date: 2026-02-25 03:20 UTC Migration By: Morty (via sub-agent) Status: โœ… Production Ready