feat: implement administrative control panel with real-time bot actions

This commit is contained in:
syntaxbullet
2026-01-08 21:19:16 +01:00
parent 3f3a6c88e8
commit 0f6cce9b6e
14 changed files with 499 additions and 47 deletions

View File

@@ -121,7 +121,7 @@ export const dashboardService = {
// Combine and sort by timestamp
const allEvents = [...txEvents, ...modEvents]
.sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
.sort((a, b) => new Date(b.timestamp).getTime() - new Date(a.timestamp).getTime())
.slice(0, limit);
return allEvents;
@@ -141,7 +141,7 @@ export const dashboardService = {
const { systemEvents, EVENTS } = await import("@shared/lib/events");
systemEvents.emit(EVENTS.DASHBOARD.NEW_EVENT, {
...fullEvent,
timestamp: fullEvent.timestamp.toISOString()
timestamp: (fullEvent.timestamp as Date).toISOString()
});
} catch (e) {
console.error("Failed to emit system event:", e);

View File

@@ -1,7 +1,7 @@
import { z } from "zod";
export const RecentEventSchema = z.object({
type: z.enum(['success', 'error', 'info']),
type: z.enum(['success', 'error', 'info', 'warn']),
message: z.string(),
timestamp: z.union([z.date(), z.string().datetime()]),
icon: z.string().optional(),
@@ -39,6 +39,7 @@ export const DashboardStatsSchema = z.object({
recentEvents: z.array(RecentEventSchema),
uptime: z.number(),
lastCommandTimestamp: z.number().nullable(),
maintenanceMode: z.boolean(),
});
export type DashboardStats = z.infer<typeof DashboardStatsSchema>;