Add War Room voice meeting, fix chat overlay, and ship 5 cyan UI themes.

Voice Room lets humans talk with agents via Whisper/TTS; chat typing no longer blocked by a full-screen overlay, attachments/avatars are larger, and Settings exposes five vivid mid-dark cyan/blue themes for the whole cockpit.
This commit is contained in:
Aissa
2026-08-16 15:49:16 +00:00
parent 1dd607b060
commit 910ba465d7
16 changed files with 2162 additions and 139 deletions
+278 -66
View File
@@ -1,33 +1,38 @@
/* Foodlinkk War Room */
/* Foodlinkk War Room — compact, one viewport */
.wr-layout {
display: grid;
grid-template-columns: 220px 1fr;
gap: 0.75rem;
min-height: 62vh;
grid-template-columns: 200px minmax(0, 1fr);
gap: 0.6rem;
height: calc(100vh - 150px);
max-height: calc(100vh - 150px);
}
.wr-page-header { margin-bottom: 0.4rem; }
.wr-page-header h1 { font-size: 1.2rem; margin: 0; }
.wr-page-header .hm-sub { margin: 0.15rem 0 0; font-size: 0.85rem; }
.wr-roster {
border-right: 1px solid rgba(255,255,255,0.08);
padding-right: 0.5rem;
max-height: 70vh;
padding-right: 0.4rem;
overflow: auto;
min-height: 0;
}
.wr-roster h3 {
font-size: 0.72rem;
font-size: 0.7rem;
letter-spacing: 0.06em;
text-transform: uppercase;
opacity: 0.7;
margin: 0 0 0.4rem;
margin: 0 0 0.35rem;
}
.wr-room-btn, .wr-agent-btn {
width: 100%;
display: flex;
align-items: center;
gap: 0.55rem;
gap: 0.45rem;
text-align: left;
background: transparent;
border: 1px solid transparent;
color: inherit;
padding: 0.4rem 0.45rem;
padding: 0.32rem 0.4rem;
border-radius: 8px;
cursor: pointer;
}
@@ -37,51 +42,55 @@
border-color: rgba(255, 215, 0, 0.25);
}
.wr-agent-meta { display: flex; flex-direction: column; min-width: 0; }
.wr-agent-meta strong { font-size: 0.85rem; }
.wr-agent-meta small { opacity: 0.65; font-size: 0.7rem; }
.wr-roster .agent-char-wrap { width: 34px; height: 34px; flex: 0 0 34px; }
.wr-agent-meta strong { font-size: 0.8rem; }
.wr-agent-meta small { opacity: 0.65; font-size: 0.68rem; }
.wr-roster .agent-char-wrap { width: 40px; height: 40px; flex: 0 0 40px; }
.wr-main { display: flex; flex-direction: column; min-width: 0; min-height: 62vh; }
.wr-main {
display: flex;
flex-direction: column;
min-width: 0;
min-height: 0;
height: 100%;
}
.wr-head {
display: flex; justify-content: space-between; align-items: flex-start;
gap: 0.75rem; margin-bottom: 0.5rem;
gap: 0.5rem; margin-bottom: 0.35rem; flex: 0 0 auto;
}
.wr-head h2 { margin: 0; font-size: 1.05rem; letter-spacing: 0.04em; }
.wr-head-actions { display: flex; gap: 0.35rem; }
.wr-head h2 { margin: 0; font-size: 1rem; letter-spacing: 0.04em; }
.wr-head-actions { display: flex; gap: 0.3rem; flex-wrap: wrap; }
.wr-log {
flex: 1;
flex: 1 1 auto;
min-height: 0;
overflow: auto;
background: rgba(0,0,0,0.22);
border: 1px solid rgba(255,255,255,0.06);
border-radius: 10px;
padding: 0.75rem;
contain: content;
min-height: 320px;
padding: 0.55rem 0.65rem;
}
.wr-empty { opacity: 0.6; margin: 0.5rem 0; font-size: 0.9rem; }
.wr-empty { opacity: 0.6; margin: 0.35rem 0; font-size: 0.85rem; }
.wr-bubble {
display: flex; gap: 0.55rem; margin-bottom: 0.7rem;
contain: layout style;
display: flex; gap: 0.45rem; margin-bottom: 0.45rem;
}
.wr-bubble.is-user { flex-direction: row-reverse; }
.wr-bubble.is-system { opacity: 0.85; }
.wr-avatar { width: 36px; height: 36px; flex: 0 0 36px; }
.wr-avatar { width: 44px; height: 44px; flex: 0 0 44px; }
.wr-avatar img, .wr-avatar .agent-char-wrap {
width: 36px; height: 36px; border-radius: 50%; object-fit: cover;
width: 44px; height: 44px; border-radius: 50%; object-fit: cover;
}
.wr-avatar .agent-char-wrap svg { display: block; width: 36px; height: 36px; }
.wr-avatar .agent-char-wrap svg { display: block; width: 44px; height: 44px; }
.wr-avatar-fallback {
display: grid; place-items: center; width: 36px; height: 36px;
border-radius: 50%; background: #1e3a5f; font-size: 0.7rem; font-weight: 700;
display: grid; place-items: center; width: 44px; height: 44px;
border-radius: 50%; background: #1e3a5f; font-size: 0.65rem; font-weight: 700;
}
.wr-bubble-body {
max-width: min(720px, 82%);
max-width: min(680px, 85%);
background: rgba(255,255,255,0.05);
border: 1px solid rgba(255,255,255,0.08);
border-radius: 12px;
padding: 0.45rem 0.65rem;
border-radius: 10px;
padding: 0.35rem 0.55rem;
}
.wr-bubble.is-user .wr-bubble-body {
background: rgba(34, 197, 94, 0.12);
@@ -91,85 +100,288 @@
background: rgba(56, 189, 248, 0.08);
border-color: rgba(56, 189, 248, 0.22);
}
.wr-bubble.is-typing .wr-bubble-body {
border-style: dashed;
opacity: 0.95;
}
.wr-bubble-meta {
font-size: 0.7rem; opacity: 0.7; margin-bottom: 0.15rem;
}
.wr-bubble.is-typing .wr-bubble-body { border-style: dashed; }
.wr-bubble-meta { font-size: 0.68rem; opacity: 0.7; margin-bottom: 0.1rem; }
.wr-bubble-text {
white-space: pre-wrap;
word-break: break-word;
font-size: 0.92rem;
line-height: 1.35;
font-size: 0.88rem;
line-height: 1.3;
}
.wr-typing-cursor::after {
content: '▍
content: "▌";
animation: wrBlink 1s steps(1) infinite;
margin-left: 1px;
}
@keyframes wrBlink { 50% { opacity: 0; } }
.wr-attach-list { display: flex; flex-wrap: wrap; gap: 0.4rem; margin-top: 0.4rem; }
.wr-attach-list { display: flex; flex-wrap: wrap; gap: 0.35rem; margin-top: 0.3rem; }
.wr-attach-card {
display: block; max-width: 220px; text-decoration: none; color: inherit;
display: block; max-width: 300px; text-decoration: none; color: inherit;
border: 1px solid rgba(255,255,255,0.12); border-radius: 8px; overflow: hidden;
background: rgba(0,0,0,0.2);
}
.wr-attach-card img { display: block; width: 100%; max-height: 140px; object-fit: cover; }
.wr-attach-card img { display: block; width: 100%; max-height: 220px; object-fit: cover; }
.wr-attach-card span {
display: block; padding: 0.3rem 0.45rem; font-size: 0.72rem; opacity: 0.85;
display: block; padding: 0.25rem 0.4rem; font-size: 0.7rem; opacity: 0.85;
white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.wr-composer {
margin-top: 0.55rem;
margin-top: 0.4rem;
display: grid;
grid-template-columns: 1fr auto;
gap: 0.45rem;
gap: 0.35rem;
align-items: end;
flex: 0 0 auto;
}
.wr-composer-tools {
grid-column: 1 / -1;
display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center;
display: flex; flex-wrap: wrap; gap: 0.3rem; align-items: center;
}
.wr-pending {
display: flex; flex-wrap: wrap; gap: 0.35rem; grid-column: 1 / -1;
display: flex; flex-wrap: wrap; gap: 0.3rem; grid-column: 1 / -1;
}
.wr-pending-chip {
display: inline-flex; align-items: center; gap: 0.3rem;
font-size: 0.72rem; padding: 0.2rem 0.45rem;
display: inline-flex; align-items: center; gap: 0.25rem;
font-size: 0.7rem; padding: 0.15rem 0.4rem;
border-radius: 999px; background: rgba(255,255,255,0.08);
}
.wr-pending-chip button {
border: 0; background: transparent; color: inherit; cursor: pointer; opacity: 0.7;
}
.wr-emoji-pop {
display: flex; flex-wrap: wrap; gap: 0.2rem;
max-width: 280px; padding: 0.35rem;
display: flex; flex-wrap: wrap; gap: 0.15rem;
max-width: 280px; padding: 0.3rem;
background: #0f172a; border: 1px solid rgba(255,255,255,0.12);
border-radius: 10px;
}
.wr-emoji-pop button {
border: 0; background: transparent; cursor: pointer; font-size: 1.15rem; line-height: 1;
padding: 0.15rem;
border: 0; background: transparent; cursor: pointer; font-size: 1.1rem; line-height: 1;
padding: 0.12rem;
}
.wr-emoji-pop button:hover { transform: scale(1.15); }
.wr-page-header { margin-bottom: 0.75rem; }
.wr-page-header h1 { font-size: 1.35rem; }
/* Call overlay */
.wr-call-overlay {
position: fixed; inset: 0; z-index: 11000;
background: rgba(3, 8, 18, 0.82);
display: none; align-items: center; justify-content: center;
padding: 1rem; pointer-events: none;
}
.wr-call-panel {
width: min(1100px, 96vw);
height: min(780px, 92vh);
background: #0b1220;
border: 1px solid rgba(255,255,255,0.12);
border-radius: 14px;
display: flex; flex-direction: column;
overflow: hidden;
box-shadow: 0 20px 60px rgba(0,0,0,0.45);
}
.wr-call-head {
display: flex; justify-content: space-between; align-items: center;
gap: 0.75rem; padding: 0.65rem 0.85rem;
border-bottom: 1px solid rgba(255,255,255,0.08);
}
.wr-call-head h3 { margin: 0; font-size: 1rem; }
.wr-call-actions { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.wr-call-frame {
flex: 1; border: 0; width: 100%; background: #000;
}
.wr-call-hint {
margin: 0; padding: 0.45rem 0.85rem; font-size: 0.78rem; opacity: 0.75;
border-top: 1px solid rgba(255,255,255,0.06);
}
.wr-popup-body {
margin: 0; min-height: 100vh;
margin: 0; height: 100vh; overflow: hidden;
background: #070b14; color: #e8eef8;
}
.wr-popup-shell { padding: 0.75rem; }
.wr-popup-shell .wr-layout { min-height: calc(100vh - 1.5rem); }
.wr-popup-shell .wr-main { min-height: calc(100vh - 1.5rem); }
.wr-popup-shell .wr-log { min-height: 50vh; }
.wr-popup-shell { padding: 0.55rem; height: 100vh; box-sizing: border-box; }
.wr-popup-shell .wr-layout {
height: calc(100vh - 1.1rem);
max-height: calc(100vh - 1.1rem);
}
@media (max-width: 900px) {
.wr-layout { grid-template-columns: 1fr; }
.wr-roster { max-height: 180px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.wr-layout {
grid-template-columns: 1fr;
height: auto;
max-height: none;
}
.wr-roster { max-height: 140px; border-right: 0; border-bottom: 1px solid rgba(255,255,255,0.08); }
.wr-main { height: calc(100vh - 280px); }
}
.wr-composer-wrap { position: relative; grid-column: 1 / 2; }
.wr-mention-pop {
position: absolute;
left: 0; right: 0; bottom: calc(100% + 4px);
max-height: 220px; overflow: auto;
background: #0f172a;
border: 1px solid rgba(255,215,0,0.35);
border-radius: 10px;
z-index: 20;
box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}
.wr-mention-item {
width: 100%; display: flex; align-items: center; gap: 0.45rem;
text-align: left; border: 0; background: transparent; color: inherit;
padding: 0.4rem 0.55rem; cursor: pointer;
}
.wr-mention-item:hover, .wr-mention-item.active {
background: rgba(255, 215, 0, 0.12);
}
.wr-mention-item strong { font-size: 0.85rem; }
.wr-mention-item small { opacity: 0.65; margin-left: 0.25rem; }
.wr-agent-btn .wr-dm-hint {
margin-left: auto; font-size: 0.65rem; opacity: 0.45;
}
.wr-bubble-meta { display: flex; align-items: center; gap: 0.25rem; flex-wrap: wrap; }
.wr-msg-del {
margin-left: auto;
opacity: 0;
border: 0;
background: transparent;
color: inherit;
cursor: pointer;
font-size: 0.75rem;
padding: 0 0.2rem;
line-height: 1;
}
.wr-bubble:hover .wr-msg-del { opacity: 0.55; }
.wr-msg-del:hover { opacity: 1 !important; color: #e74c3c; }
.wr-call-join {
flex: 1;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
gap: 0.75rem;
padding: 1.5rem;
text-align: center;
min-height: 280px;
}
.wr-call-title { margin: 0; font-size: 1.15rem; font-weight: 600; }
.wr-call-join-actions { display: flex; gap: 0.5rem; flex-wrap: wrap; justify-content: center; }
.wr-call-link {
display: block;
max-width: 100%;
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
font-size: 0.75rem;
opacity: 0.75;
padding: 0.4rem 0.6rem;
border-radius: 6px;
background: rgba(255,255,255,0.06);
}
/* Call overlay must escape wr-main overflow clipping */
.wr-main { position: relative; }
.wr-call-overlay {
position: fixed !important;
inset: 0 !important;
z-index: 11000 !important;
}
.btn.is-recording, button.is-recording {
background: #c0392b !important;
color: #fff !important;
animation: wr-mic-pulse 1s ease-in-out infinite;
}
@keyframes wr-mic-pulse {
0%, 100% { box-shadow: 0 0 0 0 rgba(192,57,43,0.5); }
50% { box-shadow: 0 0 0 8px rgba(192,57,43,0); }
}
.wr-voice-overlay {
position: fixed !important; inset: 0 !important; z-index: 11000 !important;
background: rgba(3, 8, 18, 0.88);
display: none; /* CRITICAL: never cover chat when closed */
align-items: center; justify-content: center;
padding: 1rem;
pointer-events: none;
}
.wr-voice-overlay.is-open {
display: flex !important;
pointer-events: auto;
}
.wr-voice-panel {
width: min(920px, 96vw);
max-height: 92vh;
overflow: auto;
background: #0b1220;
border: 1px solid rgba(255,255,255,0.12);
border-radius: 16px;
padding: 1rem 1.1rem 1.15rem;
box-shadow: 0 24px 70px rgba(0,0,0,0.5);
color: #e8eef8;
}
.wr-voice-head { display: flex; justify-content: space-between; gap: 0.75rem; align-items: flex-start; }
.wr-voice-head h3 { margin: 0; font-size: 1.15rem; }
.wr-voice-head-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; }
.wr-voice-status {
margin: 0.85rem 0 0.75rem;
padding: 0.55rem 0.75rem;
border-radius: 10px;
background: rgba(255,255,255,0.05);
font-size: 0.9rem;
min-height: 1.4em;
}
.wr-voice-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
gap: 0.65rem;
}
.wr-voice-card {
display: flex; flex-direction: column; align-items: center; gap: 0.25rem;
padding: 0.75rem 0.5rem;
border-radius: 12px;
border: 1px solid rgba(255,255,255,0.1);
background: rgba(255,255,255,0.03);
text-align: center;
cursor: pointer;
transition: border-color .15s, box-shadow .15s, opacity .15s;
}
.wr-voice-card.is-human { cursor: default; border-color: rgba(56, 189, 248, 0.35); }
.wr-voice-card.is-live {
border-color: rgba(34, 197, 94, 0.7);
box-shadow: 0 0 0 2px rgba(34, 197, 94, 0.25);
}
.wr-voice-card.is-off { opacity: 0.45; }
.wr-voice-avatar {
width: 52px; height: 52px; border-radius: 50%;
display: flex; align-items: center; justify-content: center;
overflow: hidden; background: #1e293b;
}
.wr-voice-avatar-human {
font-weight: 700; font-size: 0.85rem; background: #0ea5e9; color: #041018;
}
.wr-voice-avatar .agent-char-wrap, .wr-voice-avatar.agent-char-wrap { width: 52px; height: 52px; }
.wr-voice-card strong { font-size: 0.82rem; }
.wr-voice-card small { font-size: 0.7rem; }
.wr-voice-hint { font-size: 0.8rem; opacity: 0.8; margin: 0.75rem 0 0.25rem; }
.wr-voice-ptt { display: flex; justify-content: center; margin: 1rem 0 0.5rem; }
.wr-ptt-btn {
min-width: min(320px, 90vw);
min-height: 64px;
border: 0; border-radius: 999px;
font-size: 1.05rem; font-weight: 600;
background: linear-gradient(135deg, #0ea5e9, #2563eb);
color: #fff; cursor: pointer;
box-shadow: 0 10px 30px rgba(14,165,233,0.35);
}
.wr-ptt-btn.is-recording {
background: linear-gradient(135deg, #dc2626, #b91c1c);
animation: wr-mic-pulse 1s ease-in-out infinite;
}
.wr-ptt-btn.is-busy { opacity: 0.7; cursor: wait; }
.wr-voice-foot {
display: flex; justify-content: space-between; align-items: center; gap: 0.75rem;
flex-wrap: wrap; margin-top: 0.85rem; padding-top: 0.75rem;
border-top: 1px solid rgba(255,255,255,0.08);
font-size: 0.78rem;
}
+180
View File
@@ -0,0 +1,180 @@
/* Foodlinkk UI themes — colorful cyan/blue family, mid-dark, vivid accents */
/* Applied via <html data-theme="..."> (localStorage key: flk-theme) */
html[data-theme="ocean"] {
--bg-root: #07131f;
--bg-surface: #0c1c2e;
--bg-elevated: #123049;
--bg-hover: #183a58;
--border-subtle: #1f4b6e;
--border-strong: #2d6a96;
--text-primary: #eef9ff;
--text-secondary: #b6e3f7;
--text-muted: #7eb6d4;
--text-body: #d5effc;
--accent-cyan: #22d3ee;
--accent-cyan-dim: rgba(34, 211, 238, 0.22);
--accent-purple: #67e8f9;
--accent-purple-dim: rgba(103, 232, 249, 0.18);
--accent-amber: #38bdf8;
--accent-amber-dim: rgba(56, 189, 248, 0.2);
--accent-green: #2dd4bf;
--accent-green-dim: rgba(45, 212, 191, 0.2);
--accent-red: #fb7185;
--accent-red-dim: rgba(251, 113, 133, 0.18);
--shadow-panel: 0 8px 32px rgba(8, 47, 73, 0.55);
--flk-theme-glow: rgba(34, 211, 238, 0.35);
}
html[data-theme="aurora"] {
--bg-root: #0a1020;
--bg-surface: #121a32;
--bg-elevated: #1a2550;
--bg-hover: #243266;
--border-subtle: #3347a0;
--border-strong: #4f6dff;
--text-primary: #f0f4ff;
--text-secondary: #c7d2fe;
--text-muted: #9db0f5;
--text-body: #dde4ff;
--accent-cyan: #22d3ee;
--accent-cyan-dim: rgba(34, 211, 238, 0.2);
--accent-purple: #a78bfa;
--accent-purple-dim: rgba(167, 139, 250, 0.22);
--accent-amber: #818cf8;
--accent-amber-dim: rgba(129, 140, 248, 0.22);
--accent-green: #34d399;
--accent-green-dim: rgba(52, 211, 153, 0.2);
--accent-red: #f472b6;
--accent-red-dim: rgba(244, 114, 182, 0.2);
--shadow-panel: 0 8px 32px rgba(49, 46, 129, 0.5);
--flk-theme-glow: rgba(167, 139, 250, 0.4);
}
html[data-theme="neon"] {
--bg-root: #050b14;
--bg-surface: #0a1628;
--bg-elevated: #10243f;
--bg-hover: #163255;
--border-subtle: #1a4d6e;
--border-strong: #06b6d4;
--text-primary: #ecfeff;
--text-secondary: #a5f3fc;
--text-muted: #67e8f9;
--text-body: #cffafe;
--accent-cyan: #06b6d4;
--accent-cyan-dim: rgba(6, 182, 212, 0.28);
--accent-purple: #e879f9;
--accent-purple-dim: rgba(232, 121, 249, 0.2);
--accent-amber: #22d3ee;
--accent-amber-dim: rgba(34, 211, 238, 0.25);
--accent-green: #4ade80;
--accent-green-dim: rgba(74, 222, 128, 0.22);
--accent-red: #ff6bcb;
--accent-red-dim: rgba(255, 107, 203, 0.22);
--shadow-panel: 0 0 40px rgba(6, 182, 212, 0.18);
--flk-theme-glow: rgba(6, 182, 212, 0.45);
}
html[data-theme="glacier"] {
--bg-root: #0b1522;
--bg-surface: #122033;
--bg-elevated: #1a2f4a;
--bg-hover: #223b5a;
--border-subtle: #2a5078;
--border-strong: #3b82f6;
--text-primary: #f0f9ff;
--text-secondary: #bae6fd;
--text-muted: #7dd3fc;
--text-body: #e0f2fe;
--accent-cyan: #38bdf8;
--accent-cyan-dim: rgba(56, 189, 248, 0.22);
--accent-purple: #60a5fa;
--accent-purple-dim: rgba(96, 165, 250, 0.2);
--accent-amber: #7dd3fc;
--accent-amber-dim: rgba(125, 211, 252, 0.2);
--accent-green: #2dd4bf;
--accent-green-dim: rgba(45, 212, 191, 0.2);
--accent-red: #fb7185;
--accent-red-dim: rgba(251, 113, 133, 0.18);
--shadow-panel: 0 8px 28px rgba(30, 64, 175, 0.35);
--flk-theme-glow: rgba(56, 189, 248, 0.35);
}
html[data-theme="cobalt"] {
--bg-root: #08101c;
--bg-surface: #0f1a2e;
--bg-elevated: #172642;
--bg-hover: #1f3256;
--border-subtle: #274878;
--border-strong: #3b82f6;
--text-primary: #eff6ff;
--text-secondary: #bfdbfe;
--text-muted: #93c5fd;
--text-body: #dbeafe;
--accent-cyan: #22d3ee;
--accent-cyan-dim: rgba(34, 211, 238, 0.2);
--accent-purple: #818cf8;
--accent-purple-dim: rgba(129, 140, 248, 0.22);
--accent-amber: #fbbf24;
--accent-amber-dim: rgba(251, 191, 36, 0.18);
--accent-green: #34d399;
--accent-green-dim: rgba(52, 211, 153, 0.2);
--accent-red: #f87171;
--accent-red-dim: rgba(248, 113, 113, 0.18);
--shadow-panel: 0 10px 36px rgba(37, 99, 235, 0.28);
--flk-theme-glow: rgba(59, 130, 246, 0.4);
}
/* Soft global accents when a theme is active */
html[data-theme] body {
background:
radial-gradient(1200px 600px at 10% -10%, color-mix(in srgb, var(--accent-cyan) 18%, transparent), transparent 60%),
radial-gradient(900px 500px at 100% 0%, color-mix(in srgb, var(--accent-purple) 14%, transparent), transparent 55%),
var(--bg-root);
}
html[data-theme] .sidebar,
html[data-theme] .app-sidebar {
border-right-color: color-mix(in srgb, var(--accent-cyan) 35%, var(--border-subtle));
box-shadow: inset -1px 0 0 color-mix(in srgb, var(--accent-cyan) 15%, transparent);
}
html[data-theme] .btn-pulse,
html[data-theme] .btn-primary {
box-shadow: 0 0 0 1px color-mix(in srgb, var(--accent-cyan) 40%, transparent),
0 8px 24px color-mix(in srgb, var(--accent-cyan) 22%, transparent);
}
html[data-theme] .panel,
html[data-theme] .hm-neo {
border-color: color-mix(in srgb, var(--accent-cyan) 22%, var(--border-subtle));
}
/* Settings theme cards */
.flk-theme-grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
gap: 0.85rem;
margin-top: 1rem;
}
.flk-theme-card {
border: 1px solid var(--border-subtle);
border-radius: 14px;
padding: 0.85rem;
background: var(--bg-elevated);
cursor: pointer;
text-align: left;
color: inherit;
transition: border-color .15s, transform .15s, box-shadow .15s;
}
.flk-theme-card:hover { transform: translateY(-2px); border-color: var(--accent-cyan); }
.flk-theme-card.is-active {
border-color: var(--accent-cyan);
box-shadow: 0 0 0 2px var(--accent-cyan-dim), 0 12px 28px rgba(0,0,0,.35);
}
.flk-theme-swatch {
height: 52px;
border-radius: 10px;
margin-bottom: 0.65rem;
border: 1px solid rgba(255,255,255,0.12);
}
.flk-theme-card strong { display: block; margin-bottom: 0.15rem; }
.flk-theme-card small { opacity: 0.75; line-height: 1.35; display: block; }
+464 -11
View File
@@ -25,11 +25,30 @@ window.WarRoomHub = (function () {
_polling: false,
status: '',
emojiOpen: false,
mentionOpen: false,
mentionQuery: '',
mentionIndex: 0,
emojis: EMOJIS,
pendingFiles: [],
typing: null, // { agent_key, display_name, text }
callOpen: false,
callBusy: false,
callUrl: '',
callSlug: '',
voiceRecording: false,
voiceBusy: false,
speakReplies: true,
voiceRoomOpen: false,
voiceRoomAgents: ['herman'],
voiceSpeakingKey: '',
voiceLastHeard: '',
_voiceRec: null,
_voiceStream: null,
_voiceChunks: null,
async init() {
this.voiceRoomOpen = false;
this.busy = false;
await Promise.all([this.loadMe(), this.loadSouls(), this.loadRooms()]);
var params = new URLSearchParams(window.location.search || '');
var want = params.get('room');
@@ -44,6 +63,7 @@ window.WarRoomHub = (function () {
destroy() {
if (this._poll) clearInterval(this._poll);
if (this._continueTimer) clearTimeout(this._continueTimer);
},
async loadMe() {
@@ -123,6 +143,10 @@ window.WarRoomHub = (function () {
this.paintAvatars();
this.scrollLog();
}.bind(this));
var last = (this.messages || [])[(this.messages || []).length - 1];
if (last && last.sender_type === 'agent' && this.room && this.room.kind === 'warroom') {
this.scheduleContinue(4000);
}
} catch (e) {
this.status = e.message || 'Laden mislukt';
}
@@ -201,6 +225,7 @@ window.WarRoomHub = (function () {
'/messages?limit=50&after_id=' +
(this.lastId || 0);
var r = await fetch(url).then(function (x) { return x.json(); });
this.removeDeletedIds(r.deleted_ids || []);
if (this.mergeMessages(r.items || [])) {
this.$nextTick(function () {
this.paintAvatars();
@@ -228,9 +253,63 @@ window.WarRoomHub = (function () {
},
insertMention(key) {
this.draft = (this.draft || '') + '@' + key + ' ';
var d = this.draft || '';
var at = d.lastIndexOf('@');
if (at >= 0 && !/\s/.test(d.slice(at + 1))) {
// replace partial @query
this.draft = d.slice(0, at) + '@' + key + ' ';
} else {
this.draft = d + (d && !/\s$/.test(d) ? ' ' : '') + '@' + key + ' ';
}
this.mentionOpen = false;
this.mentionQuery = '';
this.mentionIndex = 0;
this.$nextTick(function () {
var el = this.$refs && this.$refs.wrInput;
if (el) { el.focus(); el.setSelectionRange(this.draft.length, this.draft.length); }
}.bind(this));
},
mentionSuggestions() {
if (!this.mentionOpen) return [];
var q = (this.mentionQuery || '').toLowerCase();
return (this.souls || []).filter(function (s) {
if (!s || !s.agent_key) return false;
if (!q) return true;
var key = String(s.agent_key).toLowerCase();
var name = String(s.display_name || '').toLowerCase();
return key.indexOf(q) === 0 || key.indexOf(q) >= 0 || name.indexOf(q) >= 0;
}).slice(0, 8);
},
onDraftInput() {
var d = this.draft || '';
var m = /(^|\s)@([a-zA-Z0-9_-]*)$/.exec(d);
if (m) {
this.mentionOpen = true;
this.mentionQuery = m[2] || '';
this.mentionIndex = 0;
} else {
this.mentionOpen = false;
this.mentionQuery = '';
}
},
pickMention(s) {
if (!s) return;
this.insertMention(s.agent_key);
},
/** Roster: in #war-room → @tag; anders open DM */
selectAgent(agentKey) {
if (this.room && this.room.kind === 'warroom') {
this.insertMention(agentKey);
return;
}
this.openDm(agentKey);
},
async onPickFiles(ev) {
var files = Array.prototype.slice.call((ev.target && ev.target.files) || []);
if (ev.target) ev.target.value = '';
@@ -295,6 +374,7 @@ window.WarRoomHub = (function () {
}
await this.consumeStream(resp);
this.status = '';
this.scheduleContinue(2000);
} catch (e) {
this.draft = text;
this.pendingFiles = files;
@@ -345,6 +425,8 @@ window.WarRoomHub = (function () {
this.upsertMessage(ev.message);
this.status = 'Agent typt…';
this.$nextTick(function () { this.scrollLog(); }.bind(this));
} else if (type === 'continue_start') {
this.status = 'Agents praten verder over: ' + ((ev.topic || '').slice(0, 80));
} else if (type === 'typing_start') {
this.typing = {
agent_key: ev.agent_key,
@@ -368,6 +450,7 @@ window.WarRoomHub = (function () {
} else if (type === 'agent' && ev.message) {
this.typing = null;
this.upsertMessage(ev.message);
if (ev.message.content) this.speakText(ev.message.content, ev.message.agent_key);
this.$nextTick(function () {
this.paintAvatars();
this.scrollLog();
@@ -385,12 +468,379 @@ window.WarRoomHub = (function () {
},
onKey(e) {
var sug = this.mentionSuggestions();
if (this.mentionOpen && sug.length) {
if (e.key === 'ArrowDown') {
e.preventDefault();
this.mentionIndex = (this.mentionIndex + 1) % sug.length;
return;
}
if (e.key === 'ArrowUp') {
e.preventDefault();
this.mentionIndex = (this.mentionIndex - 1 + sug.length) % sug.length;
return;
}
if (e.key === 'Enter' || e.key === 'Tab') {
e.preventDefault();
this.pickMention(sug[this.mentionIndex] || sug[0]);
return;
}
if (e.key === 'Escape') {
this.mentionOpen = false;
return;
}
}
if (e.key === 'Enter' && !e.shiftKey) {
e.preventDefault();
this.send();
}
},
scheduleContinue(delayMs) {
if (!this.autoDebate || !this.room || this.room.kind !== 'warroom') return;
if (this._continueTimer) clearTimeout(this._continueTimer);
var self = this;
this._continueTimer = setTimeout(function () { self.runContinue(2); }, delayMs || 2500);
},
async runContinue(turns) {
if (!this.autoDebate || !this.room || this.room.kind !== 'warroom') return;
if (this.busy || this._continueBusy) return;
// only continue if last message is from an agent (they are mid-debate)
var last = (this.messages || [])[(this.messages || []).length - 1];
if (!last || last.sender_type !== 'agent') return;
this._continueBusy = true;
this.status = 'Agents overleggen verder…';
try {
var resp = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/continue?turns=' + (turns || 2), {
method: 'POST',
credentials: 'same-origin',
headers: { Accept: 'text/event-stream', 'Content-Type': 'application/json' },
body: '{}',
});
if (!resp.ok) throw new Error('Continue mislukt');
this.busy = true;
await this.consumeStream(resp);
this.busy = false;
this.status = '';
// keep the debate alive a bit while the tab is open
this.scheduleContinue(12000);
} catch (e) {
this.busy = false;
this.status = '';
}
this._continueBusy = false;
},
async deleteMessage(m) {
if (!this.room || !m || !m.id) return;
if (!window.confirm('Bericht verwijderen?')) return;
try {
var r = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/messages/' + m.id, {
method: 'DELETE',
credentials: 'same-origin',
}).then(function (x) { return x.json().then(function (d) { return { ok: x.ok, d: d }; }); });
if (!r.ok) throw new Error((r.d && (r.d.detail || r.d.message)) || 'Verwijderen mislukt');
this.messages = (this.messages || []).filter(function (x) { return x.id !== m.id; });
if (window.Cockpit) Cockpit.toast('Bericht verwijderd', 'ok');
} catch (e) {
if (window.Cockpit) Cockpit.toast(e.message || 'Verwijderen mislukt', 'error');
}
},
removeDeletedIds(ids) {
if (!ids || !ids.length) return;
var set = {};
ids.forEach(function (id) { set[id] = true; });
this.messages = (this.messages || []).filter(function (m) { return !set[m.id]; });
},
openVoiceRoom() {
if (!this.room) {
if (window.Cockpit) Cockpit.toast('Geen room geladen', 'error');
return;
}
if (!(this.voiceRoomAgents || []).length) {
this.voiceRoomAgents = ['herman'];
}
this.speakReplies = true;
this.voiceRoomOpen = true;
this.callOpen = false;
this.status = 'Voice Room open — houd 🎤 in om te praten';
this._announceVoiceRoom('join');
if (this.micNeedsHttps()) {
// still open UI; mic will prompt on first PTT
this.status = 'Voice Room open — voor mic: gebruik HTTPS (:8643)';
}
},
closeVoiceRoom() {
if (this.voiceRecording) {
try { this.stopVoiceTalk(); } catch (e) {}
}
if (window.speechSynthesis) try { window.speechSynthesis.cancel(); } catch (e2) {}
this.voiceRoomOpen = false;
this.voiceSpeakingKey = '';
this._announceVoiceRoom('leave');
if (this.status && String(this.status).indexOf('Voice') === 0) this.status = '';
},
async _announceVoiceRoom(action) {
if (!this.room) return;
try {
await fetch('/api/agents/warroom/rooms/' + this.room.id + '/voice-room', {
method: 'POST',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({ action: action || 'join', agents: this.voiceRoomAgents || [] }),
});
await this.pollNew();
} catch (e) { /* quiet */ }
},
toggleVoiceAgent(key) {
var list = (this.voiceRoomAgents || []).slice();
var i = list.indexOf(key);
if (i >= 0) {
if (list.length <= 1) return; // keep at least one
list.splice(i, 1);
} else {
list.push(key);
}
this.voiceRoomAgents = list;
},
isVoiceAgent(key) {
return (this.voiceRoomAgents || []).indexOf(key) >= 0;
},
voiceAgentSouls() {
var souls = (this.souls || []).slice();
if (!souls.length) {
return (this.voiceRoomAgents || ['herman']).map(function (k) {
return { agent_key: k, display_name: k };
});
}
var prefer = ['herman','retail','bizdev','halal','finance','marketing','legal'];
souls.sort(function (a, b) {
var ia = prefer.indexOf(a.agent_key); var ib = prefer.indexOf(b.agent_key);
if (ia < 0) ia = 99; if (ib < 0) ib = 99;
return ia - ib || String(a.display_name||'').localeCompare(String(b.display_name||''));
});
return souls.slice(0, 12);
},
secureWarroomUrl() {
try {
var u = new URL(window.location.href);
if (u.protocol === 'https:') {
if (u.pathname.indexOf('/agents') === 0 && u.search.indexOf('tab=') < 0) {
u.searchParams.set('tab', 'warroom');
}
return u.toString();
}
u.protocol = 'https:';
if (u.port === '8610' || u.port === '8600') u.port = '8643';
else if (!u.port || u.port === '80') u.port = '8643';
if (u.pathname.indexOf('/warroom/popup') >= 0) {
/* keep popup path */
} else {
u.pathname = '/agents';
u.searchParams.set('tab', 'warroom');
}
return u.toString();
} catch (e) {
return 'https://10.4.7.18:8643/agents?tab=warroom';
}
},
micNeedsHttps() {
return !(window.isSecureContext && navigator.mediaDevices && navigator.mediaDevices.getUserMedia);
},
async ensureMic() {
if (!this.micNeedsHttps()) return true;
this.status = 'Microfoon vereist HTTPS — open veilige War Room';
if (window.Cockpit) {
Cockpit.toast('Mic werkt niet op HTTP. Open HTTPS War Room.', 'error');
}
var url = this.secureWarroomUrl();
var go = window.confirm('Spraak met agents werkt via HTTPS.\n\nNu openen?\n' + url);
if (go) window.open(url, '_blank');
return false;
},
async startVoiceTalk(ev) {
if (ev) { try { ev.preventDefault(); } catch (e0) {} }
if (this.voiceRecording || this.voiceBusy || this.busy) return;
if (!this.voiceRoomOpen) this.openVoiceRoom();
if (!(await this.ensureMic())) return;
try {
this._voiceChunks = [];
this._voiceStream = await navigator.mediaDevices.getUserMedia({ audio: true });
var rec = new MediaRecorder(this._voiceStream);
this._voiceRec = rec;
var self = this;
rec.ondataavailable = function (e) {
if (e.data && e.data.size) self._voiceChunks.push(e.data);
};
rec.start(200);
this.voiceRecording = true;
this.status = '🎤 Luisteren… laat los om te sturen';
} catch (e) {
this.status = 'Microfoon geweigerd of niet beschikbaar';
if (window.Cockpit) Cockpit.toast(this.status, 'error');
this._stopVoiceStream();
}
},
async stopVoiceTalk(ev) {
if (ev) { try { ev.preventDefault(); } catch (e0) {} }
if (!this.voiceRecording || !this._voiceRec) return;
var self = this;
this.voiceRecording = false;
this.voiceBusy = true;
this.status = 'Spraak omzetten…';
await new Promise(function (resolve) {
self._voiceRec.onstop = function () { resolve(); };
try { self._voiceRec.stop(); } catch (e1) { resolve(); }
});
this._stopVoiceStream();
try {
var blob = new Blob(this._voiceChunks || [], { type: 'audio/webm' });
this._voiceChunks = [];
if (!blob.size) throw new Error('Geen audio opgenomen');
var fd = new FormData();
fd.append('file', blob, 'warroom-voice.webm');
var r = await fetch('/api/voice/transcribe', { method: 'POST', body: fd, credentials: 'same-origin' });
var j = await r.json().catch(function () { return {}; });
if (!r.ok) throw new Error(j.detail || j.error || 'Transcriptie mislukt');
var text = (j.text || '').trim();
if (!text) throw new Error('Geen spraak herkend — probeer opnieuw');
// Stuur naar War Room (agents antwoorden zoals bij typen)
this.voiceLastHeard = text;
var tags = (this.voiceRoomAgents || ['herman']).map(function (k) { return '@' + k; });
// Mention selected voice-room agents so they all can answer
var missing = tags.filter(function (t) { return text.toLowerCase().indexOf(t) < 0; });
if (missing.length) text = missing.join(' ') + ' ' + text;
this.draft = text;
this.status = 'Versturen naar Voice Room…';
if (this.voiceRoomOpen) this.voiceSpeakingKey = '';
await this.send();
this.status = this.voiceRoomOpen ? 'Voice Room — wachten op agents…' : '';
} catch (e) {
this.status = e.message || 'Voice mislukt';
if (window.Cockpit) Cockpit.toast(this.status, 'error');
}
this.voiceBusy = false;
},
_stopVoiceStream() {
try { if (this._voiceRec && this._voiceRec.state !== 'inactive') this._voiceRec.stop(); } catch (e) {}
this._voiceRec = null;
if (this._voiceStream) {
try { this._voiceStream.getTracks().forEach(function (t) { t.stop(); }); } catch (e2) {}
}
this._voiceStream = null;
},
speakText(text, agentKey) {
if (!this.speakReplies || !text || !window.speechSynthesis) return;
try {
window.speechSynthesis.cancel();
var self = this;
this.voiceSpeakingKey = agentKey || 'agent';
var u = new SpeechSynthesisUtterance(String(text).slice(0, 900));
u.lang = 'nl-NL';
u.rate = 1.02;
var voices = window.speechSynthesis.getVoices() || [];
var nl = voices.find(function (v) { return /nl/i.test(v.lang) && /google|microsoft|maarten|xander|neder/i.test(v.name); })
|| voices.find(function (v) { return /nl/i.test(v.lang); });
if (nl) u.voice = nl;
u.onend = function () {
if (self.voiceSpeakingKey === (agentKey || 'agent')) self.voiceSpeakingKey = '';
if (self.voiceRoomOpen) self.status = 'Voice Room — jouw beurt (houd 🎤 in)';
};
window.speechSynthesis.speak(u);
if (this.voiceRoomOpen) {
this.status = (agentKey || 'Agent') + ' spreekt…';
}
} catch (e) { /* ignore */ }
},
callHref() {
var id = (this.room && this.room.id) ? this.room.id : 1;
var slug = 'FoodlinkkWR' + id;
if (this.room && this.room.kind === 'dm' && this.room.agent_key) {
slug = 'FoodlinkkDM' + this.room.agent_key + id;
}
return 'https://meet.ffmuc.net/' + slug;
},
onCallClick() {
// Runs in the same user-gesture as the <a> navigation — always show panel.
var url = this.callHref();
this.callUrl = url;
this.callSlug = url.split('/').pop();
this.callOpen = true;
this.status = 'Call open — nieuw tabblad of klik Deelnemen';
this.announceCall(url);
},
async announceCall(url) {
if (!this.room || this.callBusy) return;
this.callBusy = true;
try {
var r = await fetch('/api/agents/warroom/rooms/' + this.room.id + '/call', {
method: 'POST',
credentials: 'same-origin',
headers: { 'Content-Type': 'application/json' },
body: '{}',
}).then(function (x) { return x.json().then(function (d) { return { ok: x.ok, d: d }; }); });
if (r.ok && r.d && r.d.url) {
this.callUrl = r.d.url;
this.callSlug = r.d.slug || this.callSlug;
}
await this.pollNew();
} catch (e) {
/* panel + tab already useful without announce */
}
this.callBusy = false;
},
async startCall() {
// Fallback if something still calls startCall()
this.onCallClick();
var url = this.callUrl || this.callHref();
window.open(url, '_blank');
},
closeCall() {
this.callOpen = false;
if (this.status && String(this.status).indexOf('Call') === 0) this.status = '';
},
openCallExternal() {
var url = this.callUrl || this.callHref();
window.open(url, '_blank');
},
async copyCallLink() {
var link = (this.callUrl || this.callHref()).split('#')[0];
try {
await navigator.clipboard.writeText(link);
if (window.Cockpit) Cockpit.toast('Link gekopieerd', 'ok');
} catch (e) {
window.prompt('Kopieer deze call-link:', link);
}
},
popOut() {
var q = this.room ? '?room=' + this.room.id : '';
openPopup(q);
@@ -414,13 +864,16 @@ window.WarRoomHub = (function () {
return { openPopup: openPopup, controller: warRoomController };
})();
document.addEventListener('alpine:init', function () {
if (window.Alpine && Alpine.data) {
Alpine.data('warRoomHub', function () {
return WarRoomHub.controller({ popupMode: false });
});
Alpine.data('warRoomPopup', function () {
return WarRoomHub.controller({ popupMode: true });
});
}
});
function __flkRegisterWarRoomAlpine() {
if (!window.Alpine || typeof Alpine.data !== 'function') return;
if (Alpine.__flkWarRoomRegistered) return;
Alpine.data('warRoomHub', function () {
return WarRoomHub.controller({ popupMode: false });
});
Alpine.data('warRoomPopup', function () {
return WarRoomHub.controller({ popupMode: true });
});
Alpine.__flkWarRoomRegistered = true;
}
document.addEventListener('alpine:init', __flkRegisterWarRoomAlpine);
__flkRegisterWarRoomAlpine();