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:
64
web/src/App.css
Normal file
64
web/src/App.css
Normal file
@@ -0,0 +1,64 @@
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
|
||||
:root {
|
||||
--bg: #0f0f13;
|
||||
--surface: #1a1a22;
|
||||
--border: #2a2a36;
|
||||
--accent: #7c6af7;
|
||||
--text: #e0e0e8;
|
||||
--muted: #6b6b80;
|
||||
--sidebar-w: 200px;
|
||||
--peerlist-w: 180px;
|
||||
}
|
||||
|
||||
html, body, #root { height: 100%; }
|
||||
body { background: var(--bg); color: var(--text); font-family: system-ui, sans-serif; font-size: 14px; }
|
||||
|
||||
button { cursor: pointer; background: var(--accent); color: #fff; border: none; border-radius: 4px; padding: 4px 10px; font-size: 13px; }
|
||||
button:disabled { opacity: 0.4; cursor: default; }
|
||||
input { background: var(--surface); color: var(--text); border: 1px solid var(--border); border-radius: 4px; padding: 6px 10px; font-size: 13px; outline: none; }
|
||||
input:focus { border-color: var(--accent); }
|
||||
|
||||
/* ── onboarding ── */
|
||||
.onboarding { display: flex; flex-direction: column; align-items: center; justify-content: center; height: 100%; gap: 16px; }
|
||||
.onboarding h1 { font-size: 2rem; letter-spacing: 0.1em; color: var(--accent); }
|
||||
.onboarding .status { color: var(--muted); }
|
||||
.join-form { display: flex; gap: 8px; }
|
||||
.join-form input { width: 220px; }
|
||||
|
||||
/* ── chat layout ── */
|
||||
.chat-layout { display: grid; grid-template-columns: var(--sidebar-w) 1fr var(--peerlist-w); height: 100%; }
|
||||
|
||||
/* ── sidebar ── */
|
||||
.sidebar { background: var(--surface); border-right: 1px solid var(--border); display: flex; flex-direction: column; gap: 4px; padding: 12px 8px; overflow-y: auto; }
|
||||
.sidebar-identity { padding: 8px; border-bottom: 1px solid var(--border); margin-bottom: 8px; }
|
||||
.sidebar-identity .alias { display: block; font-weight: 600; }
|
||||
.sidebar-identity .peer-id { display: block; color: var(--muted); font-size: 11px; font-family: monospace; }
|
||||
.sidebar-section { display: flex; flex-direction: column; gap: 2px; margin-bottom: 16px; }
|
||||
.sidebar-label { font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted); padding: 4px 8px; }
|
||||
.sidebar-item { background: none; color: var(--text); text-align: left; padding: 5px 8px; border-radius: 4px; width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
||||
.sidebar-item:hover { background: var(--border); }
|
||||
.sidebar-item.active { background: var(--accent); color: #fff; }
|
||||
|
||||
/* ── message pane ── */
|
||||
.message-pane { display: flex; flex-direction: column; height: 100%; }
|
||||
.message-pane-header { padding: 12px 16px; border-bottom: 1px solid var(--border); font-weight: 600; color: var(--muted); }
|
||||
.messages { flex: 1; overflow-y: auto; padding: 12px 16px; display: flex; flex-direction: column; gap: 6px; }
|
||||
.message { display: flex; gap: 8px; align-items: baseline; }
|
||||
.message.mine .message-alias { color: var(--accent); }
|
||||
.message-alias { font-weight: 600; min-width: 80px; color: var(--muted); font-size: 12px; }
|
||||
.message-text { flex: 1; word-break: break-word; }
|
||||
.message-ts { color: var(--muted); font-size: 11px; white-space: nowrap; }
|
||||
.compose { display: flex; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--border); }
|
||||
.compose input { flex: 1; }
|
||||
|
||||
/* ── peer list ── */
|
||||
.peer-list { background: var(--surface); border-left: 1px solid var(--border); padding: 12px 8px; display: flex; flex-direction: column; gap: 4px; overflow-y: auto; }
|
||||
.peer-entry { display: flex; flex-direction: column; gap: 4px; padding: 6px 8px; border-radius: 4px; }
|
||||
.peer-entry:hover { background: var(--border); }
|
||||
.peer-entry-info .alias { display: block; font-weight: 600; font-size: 13px; }
|
||||
.peer-entry-info .peer-id { display: block; color: var(--muted); font-size: 11px; font-family: monospace; }
|
||||
.peer-entry-actions { display: flex; gap: 4px; }
|
||||
.peer-entry-actions button { font-size: 11px; padding: 2px 6px; background: var(--border); color: var(--text); }
|
||||
.peer-entry-actions button:hover { background: var(--accent); color: #fff; }
|
||||
.empty { color: var(--muted); font-size: 12px; padding: 8px; }
|
||||
Reference in New Issue
Block a user