saltylab-firmware/ui/dashboard.css
sl-webui b6c6dbd838 feat: WebUI main dashboard with panel launcher (Issue #630)
Replaces ui/index.html (old USB-serial HUD) with a full rosbridge
dashboard. Adds ui/dashboard.{css,js}.

Top bar:
- Robot name +  SALTYBOT logo
- Live battery % + voltage with fill bar (4S LiPo: 12.0V–16.8V)
- Safety state from /saltybot/safety_zone/status (GREEN/AMBER/RED)
- E-stop state display
- Drive mode display
- ROS uptime counter
- rosbridge WS input + CONNECT button

Panel grid (auto-fill responsive):
- MAP VIEW (#587) — /saltybot/pose/fused liveness dot
- GAMEPAD TELEOP (#598) — /cmd_vel activity indicator
- DIAGNOSTICS (#562) — /diagnostics liveness dot
- EVENT LOG (#576) — /rosout liveness dot
- SETTINGS (#614) — param service (config state, no topic)
- GIMBAL (#551) — /gimbal/state liveness dot

Each card shows: icon, title, issue #, description, topic chips,
and a LIVE/IDLE/OFFLINE status badge updated every second. Cards
open the linked standalone panel in the same tab.

Auto-detect rosbridge:
- Probes: page hostname:9090, localhost:9090, saltybot.local:9090
- Progress dots per candidate (trying/ok/fail)
- Falls back to manual URL entry
- Saves last successful URL to localStorage

Bottom bar:
-  E-STOP button (latches, publishes zero Twist to /cmd_vel)
  Space bar shortcut from dashboard
- RESUME button
- Drive mode switcher: MANUAL / AUTO / FOLLOW / DOCK
  (publishes to /saltybot/drive_mode std_msgs/String)
- Session timer (HH:MM:SS since page load)

Info strip: rosbridge URL · msg rate · latency (5s ping via
/rosapi/get_time) · robot IP

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-15 14:35:56 -04:00

430 lines
9.5 KiB
CSS

/* dashboard.css — Saltybot Main Dashboard (Issue #630) */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
--bg0: #050510;
--bg1: #070712;
--bg2: #0a0a1a;
--bd: #0c2a3a;
--bd2: #1e3a5f;
--dim: #374151;
--mid: #6b7280;
--base: #9ca3af;
--hi: #d1d5db;
--cyan: #06b6d4;
--green: #22c55e;
--amber: #f59e0b;
--red: #ef4444;
}
html, body {
height: 100%;
font-family: 'Courier New', Courier, monospace;
font-size: 12px;
background: var(--bg0);
color: var(--base);
display: flex;
flex-direction: column;
overflow: hidden;
}
/* ══════════════════ TOP BAR ══════════════════ */
#topbar {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 14px;
background: var(--bg1);
border-bottom: 1px solid var(--bd);
flex-shrink: 0;
flex-wrap: wrap;
}
#topbar-left {
display: flex;
align-items: baseline;
gap: 8px;
flex-shrink: 0;
}
.logo {
color: #f97316;
font-weight: bold;
letter-spacing: .18em;
font-size: 14px;
}
#robot-name {
color: var(--mid);
font-size: 10px;
letter-spacing: .12em;
}
#topbar-status {
display: flex;
align-items: center;
gap: 0;
flex: 1;
min-width: 0;
flex-wrap: wrap;
gap: 2px;
}
.stat-block {
display: flex;
align-items: center;
gap: 5px;
padding: 2px 10px;
}
.stat-icon { font-size: 14px; flex-shrink: 0; }
.stat-body { display: flex; flex-direction: column; gap: 1px; }
.stat-label {
font-size: 8px;
color: var(--dim);
letter-spacing: .1em;
text-transform: uppercase;
}
.stat-val {
font-size: 11px;
color: var(--hi);
font-family: monospace;
white-space: nowrap;
}
.stat-sep {
width: 1px;
height: 28px;
background: var(--bd);
flex-shrink: 0;
}
/* Battery bar */
.batt-bar {
width: 28px;
height: 12px;
border: 1px solid var(--bd2);
border-radius: 2px;
overflow: hidden;
position: relative;
background: var(--bg0);
}
.batt-bar::after {
content: '';
position: absolute;
right: -3px; top: 3px;
width: 3px; height: 6px;
background: var(--bd2);
border-radius: 0 1px 1px 0;
}
#batt-fill {
height: 100%;
width: 0%;
background: var(--green);
transition: width .5s, background .5s;
}
#topbar-right {
display: flex;
align-items: center;
gap: 6px;
flex-shrink: 0;
margin-left: auto;
}
#conn-dot {
width: 8px; height: 8px; border-radius: 50%;
background: var(--dim); flex-shrink: 0;
transition: background .3s;
}
#conn-dot.connected { background: var(--green); }
#conn-dot.error { background: var(--red); animation: blink 1s infinite; }
#conn-label {
font-size: 10px;
color: var(--mid);
white-space: nowrap;
}
#ws-input {
background: var(--bg2); border: 1px solid var(--bd2); border-radius: 4px;
color: #67e8f9; padding: 2px 7px; font-family: monospace; font-size: 11px;
width: 175px;
}
#ws-input:focus { outline: none; border-color: var(--cyan); }
.hbtn {
padding: 2px 8px; border-radius: 4px; border: 1px solid var(--bd2);
background: var(--bg2); color: #67e8f9; font-family: monospace;
font-size: 10px; font-weight: bold; cursor: pointer; transition: background .15s;
white-space: nowrap;
}
.hbtn:hover { background: #0e4f69; }
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:.3} }
@keyframes pulse { 0%,100%{opacity:1} 50%{opacity:.5} }
/* ══════════════════ MAIN / GRID ══════════════════ */
#main {
flex: 1;
display: flex;
flex-direction: column;
overflow-y: auto;
padding: 16px;
gap: 12px;
min-height: 0;
}
/* Auto-detect bar */
#detect-bar {
display: flex;
align-items: center;
gap: 10px;
padding: 6px 12px;
background: var(--bg2);
border: 1px solid var(--bd2);
border-radius: 6px;
font-size: 10px;
color: var(--mid);
flex-shrink: 0;
}
#detect-bar.connected {
border-color: #14532d;
color: var(--green);
background: #020f06;
}
#detect-bar.error {
border-color: #7f1d1d;
color: var(--red);
}
#detect-status { flex: 1; }
#detect-dots { display: flex; gap: 4px; }
.detect-dot {
width: 6px; height: 6px; border-radius: 50%;
background: var(--dim);
transition: background .3s;
}
.detect-dot.trying { background: var(--amber); animation: pulse .7s infinite; }
.detect-dot.ok { background: var(--green); }
.detect-dot.fail { background: var(--red); }
/* Panel grid */
#grid {
display: grid;
grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
gap: 12px;
}
/* Panel card */
.panel-card {
display: flex;
flex-direction: column;
gap: 8px;
padding: 14px;
background: var(--bg2);
border: 1px solid var(--bd2);
border-radius: 10px;
text-decoration: none;
color: inherit;
cursor: pointer;
transition: border-color .2s, background .2s, transform .1s;
position: relative;
overflow: hidden;
}
.panel-card::before {
content: '';
position: absolute;
inset: 0;
background: radial-gradient(ellipse at top left, rgba(6,182,212,.04), transparent 60%);
pointer-events: none;
}
.panel-card:hover {
border-color: var(--cyan);
background: #0a0a1e;
transform: translateY(-1px);
}
.panel-card:active { transform: translateY(0); }
.card-header {
display: flex;
align-items: center;
gap: 10px;
}
.card-icon { font-size: 24px; flex-shrink: 0; }
.card-title {
font-size: 12px;
font-weight: bold;
letter-spacing: .12em;
color: var(--hi);
text-transform: uppercase;
}
.card-sub { font-size: 9px; color: var(--dim); }
.card-dot {
width: 9px; height: 9px; border-radius: 50%;
background: var(--dim);
margin-left: auto;
flex-shrink: 0;
transition: background .3s;
}
.card-dot.live { background: var(--green); }
.card-dot.idle { background: var(--amber); }
.card-dot.config { background: var(--mid); }
.card-desc {
font-size: 10px;
color: var(--mid);
line-height: 1.5;
}
.card-topics {
display: flex;
flex-wrap: wrap;
gap: 4px;
}
.card-topics code {
font-size: 8px;
color: #4b5563;
background: var(--bg0);
border: 1px solid var(--bd);
border-radius: 2px;
padding: 1px 4px;
}
.card-footer {
display: flex;
align-items: center;
justify-content: space-between;
border-top: 1px solid var(--bd);
padding-top: 6px;
margin-top: auto;
}
.card-status {
font-size: 9px;
font-weight: bold;
letter-spacing: .1em;
color: var(--dim);
}
.card-status.live { color: var(--green); }
.card-status.idle { color: var(--amber); }
.card-msg { font-size: 9px; color: var(--dim); font-family: monospace; }
/* Estop active state on card */
.panel-card.estop-flash {
border-color: var(--red) !important;
animation: blink .6s infinite;
}
/* Info strip */
#info-strip {
display: flex;
align-items: center;
gap: 0;
padding: 6px 12px;
background: var(--bg2);
border: 1px solid var(--bd);
border-radius: 6px;
flex-shrink: 0;
flex-wrap: wrap;
}
.info-item {
display: flex;
align-items: center;
gap: 6px;
padding: 0 14px;
border-right: 1px solid var(--bd);
}
.info-item:first-child { padding-left: 0; }
.info-item:last-child { border-right: none; }
.info-lbl { font-size: 8px; color: var(--dim); letter-spacing: .1em; }
.info-val { font-size: 10px; color: var(--hi); font-family: monospace; }
/* ══════════════════ BOTTOM BAR ══════════════════ */
#bottombar {
display: flex;
align-items: center;
padding: 6px 14px;
background: var(--bg1);
border-top: 1px solid var(--bd);
flex-shrink: 0;
gap: 12px;
flex-wrap: wrap;
}
#bottombar-left { display: flex; gap: 8px; align-items: center; }
.estop-btn {
padding: 5px 18px;
border-radius: 5px;
border: 2px solid #7f1d1d;
background: #1c0505;
color: #fca5a5;
font-family: monospace;
font-size: 11px;
font-weight: bold;
cursor: pointer;
letter-spacing: .08em;
transition: background .15s, border-color .15s;
}
.estop-btn:hover { background: #3b0606; border-color: var(--red); }
.estop-btn.active {
background: #7f1d1d;
border-color: var(--red);
color: #fff;
animation: blink .7s infinite;
}
.resume-btn {
padding: 5px 14px;
border-radius: 5px;
border: 1px solid #14532d;
background: #052010;
color: #86efac;
font-family: monospace;
font-size: 11px;
font-weight: bold;
cursor: pointer;
transition: background .15s;
}
.resume-btn:hover { background: #0a3a1a; }
#bottombar-center {
display: flex;
align-items: center;
gap: 8px;
flex: 1;
}
.bb-lbl { font-size: 9px; color: var(--dim); letter-spacing: .1em; flex-shrink: 0; }
#mode-btns { display: flex; gap: 4px; }
.mode-btn {
padding: 3px 10px;
border-radius: 4px;
border: 1px solid var(--bd2);
background: var(--bg2);
color: var(--mid);
font-family: monospace;
font-size: 10px;
font-weight: bold;
cursor: pointer;
letter-spacing: .08em;
transition: background .15s, color .15s, border-color .15s;
}
.mode-btn:hover { background: #0e4f69; color: var(--hi); }
.mode-btn.active { background: #0e4f69; border-color: var(--cyan); color: #fff; }
#bottombar-right {
display: flex;
align-items: center;
gap: 10px;
margin-left: auto;
}
#uptime-display { display: flex; align-items: center; gap: 6px; }
#session-time { font-size: 11px; color: var(--mid); font-family: monospace; }
/* ══════════════════ RESPONSIVE ══════════════════ */
@media (max-width: 700px) {
#topbar-status { display: none; }
#grid { grid-template-columns: 1fr 1fr; }
}
@media (max-width: 480px) {
#grid { grid-template-columns: 1fr; }
#mode-btns .mode-btn:nth-child(n+3) { display: none; }
}