- Added Express.js admin panel on port 3001 (ADMIN_PORT env) - Dashboard: stats (users, products, purchases, revenue) - Users: list, details, ban/unban toggle - Products: CRUD by category - Wallets: list with balances - Purchases: history with filters - Audit log: view audit trail - Auth: token-based login with ADMIN_SECRET env var - Migrated sqlite3 → better-sqlite3 - database.js: async adapter (runAsync/allAsync/getAsync) - purchaseService.js: lastID → lastInsertRowid - userService.js: lastID → lastInsertRowid - Removed sqlite3 from package.json - Fixed: dotenv/config import added to index.js - Fixed: ENCRYPTION_KEY validation (32+ char hex) - Fixed: Dockerfile multi-stage build (no python needed) - Fixed: Docker DNS (network: host in build) - Fixed: docker-compose port 3001, healthcheck on 3001 - Added express, cookie-parser, pino-pretty, better-sqlite3 deps
14 lines
461 B
JavaScript
14 lines
461 B
JavaScript
import { layout, statCard } from './layout.js';
|
|
|
|
export function renderDashboard(stats) {
|
|
const cards = [
|
|
statCard('Total Users', stats.totalUsers),
|
|
statCard('Total Products', stats.totalProducts),
|
|
statCard('Total Purchases', stats.totalPurchases),
|
|
statCard('Revenue', `$${(stats.totalRevenue || 0).toFixed(2)}`),
|
|
].join('');
|
|
|
|
const content = `<div class="stats-grid">${cards}</div>`;
|
|
return layout('Dashboard', content, 'dashboard');
|
|
}
|