From 1676f53f4d30ae9e01f5e0855b1030ef55d82295 Mon Sep 17 00:00:00 2001 From: Eyejoker Date: Mon, 27 Apr 2026 02:23:32 +0900 Subject: [PATCH] feat(dashboard): send room messages from web (#33) --- apps/dashboard/src/App.tsx | 106 +++++++++++- apps/dashboard/src/api.ts | 11 ++ apps/dashboard/src/i18n.ts | 20 +++ apps/dashboard/src/styles.css | 40 ++++- src/db.ts | 1 + src/db/messages.ts | 11 ++ src/db/runtime-memory-messages.ts | 5 + src/index.ts | 7 +- src/web-dashboard-server.test.ts | 264 +++++++++++++++++++++++++++++- src/web-dashboard-server.ts | 153 ++++++++++++++++- 10 files changed, 612 insertions(+), 6 deletions(-) diff --git a/apps/dashboard/src/App.tsx b/apps/dashboard/src/App.tsx index 8ef9ce0..78a752b 100644 --- a/apps/dashboard/src/App.tsx +++ b/apps/dashboard/src/App.tsx @@ -7,6 +7,7 @@ import { type StatusSnapshot, fetchDashboardData, runScheduledTaskAction, + sendRoomMessage, } from './api'; import { LOCALES, @@ -44,6 +45,10 @@ const DEFAULT_VIEW: DashboardView = 'inbox'; const HEALTH_STALE_MS = 5 * 60_000; const HEALTH_DOWN_MS = 15 * 60_000; +function makeClientRequestId(): string { + return `${Date.now().toString(36)}-${Math.random().toString(36).slice(2, 8)}`; +} + function isDashboardView( value: string | null | undefined, ): value is DashboardView { @@ -865,13 +870,58 @@ function HealthPanel({ ); } +function RoomMessageForm({ + busy, + onChange, + onSubmit, + t, + value, +}: { + busy: boolean; + onChange: (value: string) => void; + onSubmit: () => void; + t: Messages; + value: string; +}) { + return ( +
{ + event.preventDefault(); + onSubmit(); + }} + > +