feat: standalone web UI (React + Vite)

React + TypeScript UI on port 5274. Connects to local daemon via
WebSocket IPC (DaemonAdapter). Full chat layout with sidebar, message
pane, and peer list. Mirrors the TUI feature set.

- src/types.ts        — IPC types mirroring proto.go
- src/adapter/daemon  — WebSocket IPC adapter with auto-reconnect
- src/store/index.ts  — Zustand store; handles all daemon events
- src/pages/          — Onboarding (connect + join) and Chat
- src/components/     — Sidebar, MessagePane, PeerList

Dev: cd web && npm run dev  (port 5274)
Build: cd web && npm run build

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
Fredrik Johansson
2026-06-22 21:57:32 +02:00
parent 77830a3b3f
commit ff14e955ea
27 changed files with 3782 additions and 0 deletions

22
web/src/App.tsx Normal file
View File

@@ -0,0 +1,22 @@
import { useEffect } from 'react'
import { useWaste } from './store'
import { Onboarding } from './pages/Onboarding'
import { Chat } from './pages/Chat'
import './App.css'
// Default to local daemon WS IPC. Override with VITE_DAEMON_WS env var.
const DAEMON_WS = import.meta.env.VITE_DAEMON_WS ?? 'ws://127.0.0.1:17338'
export default function App() {
const { connect, daemonStatus, localPeer } = useWaste()
useEffect(() => {
connect(DAEMON_WS)
}, [connect])
if (daemonStatus !== 'connected' || !localPeer) {
return <Onboarding status={daemonStatus} />
}
return <Chat />
}