Files
yaris-obd/templates/index.html
T
Mathieu MoranandCopilot beddfec8a5 Phase 23 UX polish: compact layouts, collapsibles, test trip
Dashboard:
- OBD stat cards more compact (py-2, h6 health values, 'OBD' label fits)
- obd-val class prevents Disconnected wrapping
- Speed graph collapsed by default with toggle chevron button
- GPS map + coordinates merged into single card with footer coords
- Pi health rows use h6 (less tall), alert py-2

Dashcam:
- Device status is now a compact single-line bar
- Files on dashcam section is collapsible (hidden by default)
- Import status moved into the dashcam files card footer
- Imported videos on Pi moved to top, open by default
- Column headers trimmed (Select→empty, Actions→empty, Preview→empty)

Trip history:
- col-12 on mobile so list stacks above the map
- Shorter column labels (Distance→km, Duration→Time, Max speed→Max)
- history-map height reduced for mobile (22rem on small screens)

Settings:
- Cellular + ntfy merged into one collapsible card
- Alert thresholds collapsible (advanced)
- Phone hotspot instructions shortened
- Upload retention uses inline row layout (compact)
- All cards use shadow-sm, smaller headers

CSS:
- obd-val: word-break + smaller font for OBD status values
- collapse-chevron: smooth rotation transition
- #map height 18rem (was 20rem)
- history-map 32rem desktop / 22rem mobile (was 36rem)

Co-authored-by: Copilot <[email protected]>
2026-08-09 23:10:58 -04:00

160 lines
7.5 KiB
HTML

{% extends "base.html" %}
{% block title %}Dashboard - Yaris OBD{% endblock %}
{% block styles %}
<link rel="stylesheet" href="{{ url_for('static', filename='vendor/leaflet/leaflet.css') }}">
{% endblock %}
{% block content %}
<h3 class="text-dark mb-3 fw-bold">Dashboard</h3>
{# ── OBD stat cards ──────────────────────────────────────────────────── #}
<div class="row g-2 mb-3">
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-primary h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-primary fw-bold text-xs mb-1">OBD</div>
<div id="obd-status" class="fw-bold mb-0 text-dark obd-val">—</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-success h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-success fw-bold text-xs mb-1">Speed</div>
<div id="obd-speed" class="fw-bold h5 mb-0 text-dark">—</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-info h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-info fw-bold text-xs mb-1">RPM</div>
<div id="obd-rpm" class="fw-bold h5 mb-0 text-dark">—</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-warning h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-warning fw-bold text-xs mb-1">Coolant</div>
<div id="obd-coolant" class="fw-bold h5 mb-0 text-dark">—</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-danger h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-danger fw-bold text-xs mb-1">Throttle</div>
<div id="obd-throttle" class="fw-bold h5 mb-0 text-dark">—</div>
</div>
</div>
</div>
<div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-primary h-100">
<div class="card-body py-2 px-3">
<div class="text-uppercase text-primary fw-bold text-xs mb-1">Fuel</div>
<div id="obd-fuel" class="fw-bold h5 mb-0 text-dark">—</div>
</div>
</div>
</div>
</div>
{# ── Pi health ───────────────────────────────────────────────────────── #}
<div class="card shadow-sm mb-3" id="pi-health-card">
<div class="card-header d-flex flex-wrap justify-content-between align-items-center gap-2 py-2">
<h6 class="text-primary fw-bold m-0">Pi health</h6>
<span id="pi-health-updated" class="small text-muted">Loading…</span>
</div>
<div class="card-body py-2">
<div id="pi-health-warning" class="alert alert-warning py-2 mb-2" role="alert" hidden></div>
<div id="pi-health-error" class="alert alert-danger py-2 mb-2" role="alert" hidden></div>
<div class="row g-2">
<div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">CPU temp</div>
<div id="pi-temperature" class="h6 text-dark fw-bold mb-0">--</div>
</div>
<div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Memory</div>
<div id="pi-memory" class="h6 text-dark fw-bold mb-0">--</div>
</div>
<div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Disk</div>
<div id="pi-disk" class="h6 text-dark fw-bold mb-0">--</div>
</div>
<div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Uptime</div>
<div id="pi-uptime" class="h6 text-dark fw-bold mb-0">--</div>
</div>
</div>
</div>
</div>
{# ── GPS map (with inline coords footer) ─────────────────────────────── #}
<div class="row g-3 mb-3">
<div class="col-lg-5 col-xl-4">
<div class="card shadow-sm h-100">
<div class="card-header py-2">
<h6 class="text-primary fw-bold m-0">Live GPS</h6>
</div>
<div class="card-body p-0">
<div id="map"></div>
</div>
<div class="card-footer py-2 d-flex gap-4 bg-white border-top">
<div>
<div class="text-xs text-muted fw-bold text-uppercase">Lat</div>
<div id="gpsLocationX" class="fw-semibold small">—</div>
</div>
<div>
<div class="text-xs text-muted fw-bold text-uppercase">Lon</div>
<div id="gpsLocationY" class="fw-semibold small">—</div>
</div>
</div>
</div>
</div>
<div class="col-lg-7 col-xl-8">
<div class="card shadow-sm h-100">
<div class="card-header py-2 d-flex align-items-center justify-content-between">
<h6 class="text-primary fw-bold m-0">Speed history</h6>
<button class="btn btn-link btn-sm p-0 text-muted" id="speed-graph-toggle" type="button"
aria-expanded="false" aria-controls="speed-graph-body">
<i class="fas fa-chevron-down"></i>
</button>
</div>
<div class="collapse" id="speed-graph-body">
<div class="card-body">
<div class="chart-container" style="position:relative;height:14rem;">
<canvas id="speedGraph"></canvas>
</div>
</div>
</div>
</div>
</div>
</div>
{% endblock %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/chart.min.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/socketio/socket.io.min.js') }}"></script>
<script src="{{ url_for('static', filename='vendor/leaflet/leaflet.js') }}"></script>
<script src="{{ url_for('static', filename='js/yaris.js') }}"></script>
<script>
// Speed graph toggle
(function () {
const btn = document.getElementById('speed-graph-toggle');
const body = document.getElementById('speed-graph-body');
if (!btn || !body) return;
const bsCollapse = new bootstrap.Collapse(body, {toggle: false});
body.addEventListener('show.bs.collapse', function () {
btn.setAttribute('aria-expanded', 'true');
btn.querySelector('i').className = 'fas fa-chevron-up';
});
body.addEventListener('hide.bs.collapse', function () {
btn.setAttribute('aria-expanded', 'false');
btn.querySelector('i').className = 'fas fa-chevron-down';
});
btn.addEventListener('click', function () { bsCollapse.toggle(); });
})();
</script>
{% endblock %}