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]>
This commit is contained in:
Mathieu Moran
2026-08-09 23:10:58 -04:00
co-authored by Copilot
parent 6a519dbf9e
commit beddfec8a5
5 changed files with 405 additions and 296 deletions
+22 -3
View File
@@ -211,11 +211,17 @@ body {
/* ── Maps ────────────────────────────────────────────────────────────────── */ /* ── Maps ────────────────────────────────────────────────────────────────── */
#map { height: 20rem; } #map {
height: 18rem;
}
#history-map { #history-map {
height: 36rem; height: 32rem;
min-height: 24rem; min-height: 20rem;
}
@media (max-width: 767.98px) {
#history-map { height: 22rem; }
} }
/* ── Alert dropdown ──────────────────────────────────────────────────────── */ /* ── Alert dropdown ──────────────────────────────────────────────────────── */
@@ -286,6 +292,19 @@ body {
opacity: .2; opacity: .2;
} }
/* Shrink long values (e.g. "Disconnected") so they don't wrap */
.obd-val {
font-size: 1rem;
line-height: 1.2;
word-break: break-word;
}
/* ── Collapsible chevron ──────────────────────────────────────────────────── */
.collapse-chevron {
transition: transform .2s ease;
}
/* ── Misc ────────────────────────────────────────────────────────────────── */ /* ── Misc ────────────────────────────────────────────────────────────────── */
.border-start-primary { border-left: .25rem solid var(--primary) !important; } .border-start-primary { border-left: .25rem solid var(--primary) !important; }
+82 -55
View File
@@ -4,102 +4,129 @@
{% block title %}Dashcam - Yaris OBD{% endblock %} {% block title %}Dashcam - Yaris OBD{% endblock %}
{% block content %} {% block content %}
<h3 class="text-dark mb-4">Dashcam</h3> <h3 class="text-dark mb-3 fw-bold">Dashcam</h3>
<div class="card shadow mb-4">
<div class="card-header py-3"> {# ── Device status bar ───────────────────────────────────────────────── #}
<p class="text-primary m-0 fw-bold">Detected device</p> <div class="card shadow-sm mb-3">
</div> <div class="card-body py-2 d-flex flex-wrap align-items-center gap-2">
<div class="card-body"> <i class="fas fa-usb text-muted"></i>
<p id="dash-device-status">Checking for a USB dashcam...</p> <span id="dash-device-status" class="me-auto small">Checking for a USB dashcam…</span>
<button id="dash-scan-btn" class="btn btn-secondary" type="button">Scan for dashcam</button> <button id="dash-scan-btn" class="btn btn-sm btn-secondary" type="button">
<button id="dash-import-btn" class="btn btn-primary" type="button" disabled>Import videos</button> <i class="fas fa-search me-1"></i>Scan
</div>
</div>
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex flex-wrap align-items-center justify-content-between gap-2">
<div>
<p class="text-primary m-0 fw-bold">Files on dashcam</p>
<small id="dash-file-summary" class="text-muted">Scanning...</small>
</div>
<div class="d-flex gap-2">
<button id="dash-files-refresh-btn" class="btn btn-sm btn-secondary" type="button">
<i class="fas fa-sync-alt me-1"></i>Refresh
</button> </button>
<button id="dash-select-all-btn" class="btn btn-sm btn-outline-secondary" type="button" disabled> <button id="dash-import-btn" class="btn btn-sm btn-primary" type="button" disabled>
Select all <i class="fas fa-download me-1"></i>Import all
</button> </button>
</div>
</div>
{# ── Files on dashcam (collapsible) ─────────────────────────────────── #}
<div class="card shadow-sm mb-3">
<div class="card-header py-2 d-flex flex-wrap align-items-center gap-2">
<button class="btn btn-link text-primary fw-bold p-0 text-decoration-none d-flex align-items-center gap-1"
type="button" data-bs-toggle="collapse" data-bs-target="#dashcam-files-body"
aria-expanded="false" aria-controls="dashcam-files-body" id="dashcam-files-toggle">
<i class="fas fa-chevron-right toggle-icon" style="font-size:.7rem;transition:transform .2s;"></i>
Files on dashcam
</button>
<small id="dash-file-summary" class="text-muted ms-1"></small>
<div class="ms-auto d-flex gap-1 flex-wrap">
<button id="dash-files-refresh-btn" class="btn btn-sm btn-outline-secondary" type="button">
<i class="fas fa-sync-alt"></i>
</button>
<button id="dash-select-all-btn" class="btn btn-sm btn-outline-secondary" type="button" disabled>All</button>
<button id="dash-import-selected-btn" class="btn btn-sm btn-primary" type="button" disabled> <button id="dash-import-selected-btn" class="btn btn-sm btn-primary" type="button" disabled>
<i class="fas fa-download me-1"></i>Import selected <i class="fas fa-download me-1"></i>Import
</button> </button>
<button id="dash-delete-all-btn" class="btn btn-sm btn-danger" type="button" <button id="dash-delete-all-btn" class="btn btn-sm btn-outline-danger" type="button"
data-confirm="Permanently delete every video from the dashcam? This cannot be undone." disabled> data-confirm="Permanently delete every video from the dashcam? This cannot be undone." disabled>
<i class="fas fa-trash me-1"></i>Delete all <i class="fas fa-trash"></i>
</button> </button>
</div> </div>
</div> </div>
<div class="collapse" id="dashcam-files-body">
<div class="card-body p-0"> <div class="card-body p-0">
{{ data_table( {{ data_table(
"dashcam-file-list", "dashcam-file-list",
[ [
{"key": "selected", "label": "Select", "sortable": false}, {"key": "selected", "label": "", "sortable": false},
{"key": "path", "label": "File", "sortable": true}, {"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true}, {"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Modified", "sortable": true}, {"key": "modified", "label": "Modified", "sortable": true},
{"key": "actions", "label": "Actions", "sortable": false} {"key": "actions", "label": "", "sortable": false}
], ],
"No videos found", "No videos found",
"Connect the dashcam in USB storage mode, then refresh this list." "Connect the dashcam in USB storage mode, then refresh this list."
) }} ) }}
</div> </div>
</div> <div class="card-footer py-2 d-flex align-items-center gap-2">
<div class="card shadow mb-4"> <i class="fas fa-info-circle text-muted small"></i>
<div class="card-header py-3"> <span id="dash-import-status" class="small text-muted">No import has been run yet.</span>
<p class="text-primary m-0 fw-bold">Import results</p>
</div>
<div class="card-body">
<p id="dash-import-status">No import has been run yet.</p>
</div> </div>
</div> </div>
<div id="local-video-player-panel" class="card shadow mb-4" hidden>
<div class="card-header py-3 d-flex align-items-center justify-content-between">
<p id="local-video-player-title" class="text-primary m-0 fw-bold">Video player</p>
<button id="local-video-player-close" class="btn btn-sm btn-secondary" type="button">
Close
</button>
</div>
<div class="card-body">
<video id="local-video-player" class="local-video-player" controls preload="metadata"></video>
</div>
</div> </div>
<div class="card shadow mb-4">
<div class="card-header py-3 d-flex flex-wrap align-items-center justify-content-between gap-2"> {# ── Imported videos on Pi ───────────────────────────────────────────── #}
<div> <div class="card shadow-sm mb-3">
<p class="text-primary m-0 fw-bold">Imported videos on Pi</p> <div class="card-header py-2 d-flex flex-wrap align-items-center gap-2">
<small id="local-video-summary" class="text-muted">Loading...</small> <button class="btn btn-link text-primary fw-bold p-0 text-decoration-none d-flex align-items-center gap-1"
</div> type="button" data-bs-toggle="collapse" data-bs-target="#local-videos-body"
<button id="local-videos-refresh-btn" class="btn btn-sm btn-secondary" type="button"> aria-expanded="true" aria-controls="local-videos-body" id="local-videos-toggle">
<i class="fas fa-sync-alt me-1"></i>Refresh <i class="fas fa-chevron-down toggle-icon" style="font-size:.7rem;transition:transform .2s;"></i>
Videos on Pi
</button>
<small id="local-video-summary" class="text-muted ms-1">Loading…</small>
<button id="local-videos-refresh-btn" class="btn btn-sm btn-outline-secondary ms-auto" type="button">
<i class="fas fa-sync-alt"></i>
</button> </button>
</div> </div>
<div class="collapse show" id="local-videos-body">
<div class="card-body p-0"> <div class="card-body p-0">
{{ data_table( {{ data_table(
"local-video-list", "local-video-list",
[ [
{"key": "thumbnail", "label": "Preview", "sortable": false}, {"key": "thumbnail", "label": "", "sortable": false},
{"key": "path", "label": "File", "sortable": true}, {"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true}, {"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Modified", "sortable": true}, {"key": "modified", "label": "Date", "sortable": true},
{"key": "uploaded", "label": "Upload", "sortable": true}, {"key": "uploaded", "label": "Upload", "sortable": true},
{"key": "actions", "label": "Actions", "sortable": false} {"key": "actions", "label": "", "sortable": false}
], ],
"No imported videos", "No imported videos",
"Import videos from the connected dashcam to browse and play them here." "Import videos from the connected dashcam to browse and play them here."
) }} ) }}
</div> </div>
</div> </div>
</div>
{# ── Video player (hidden until opened) ─────────────────────────────── #}
<div id="local-video-player-panel" class="card shadow-sm mb-3" hidden>
<div class="card-header py-2 d-flex align-items-center justify-content-between">
<p id="local-video-player-title" class="text-primary m-0 fw-bold small"></p>
<button id="local-video-player-close" class="btn btn-sm btn-outline-secondary" type="button">
<i class="fas fa-times me-1"></i>Close
</button>
</div>
<div class="card-body p-0">
<video id="local-video-player" class="local-video-player" controls preload="metadata"></video>
</div>
</div>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}
<script src="{{ url_for('static', filename='js/dash.js') }}"></script> <script src="{{ url_for('static', filename='js/dash.js') }}"></script>
<script src="{{ url_for('static', filename='js/local-videos.js') }}"></script> <script src="{{ url_for('static', filename='js/local-videos.js') }}"></script>
<script>
// Rotate chevron icons on collapse toggle
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach(function (btn) {
const target = document.querySelector(btn.getAttribute('data-bs-target'));
if (!target) return;
const icon = btn.querySelector('.toggle-icon');
if (!icon) return;
target.addEventListener('show.bs.collapse', function () { icon.style.transform = 'rotate(90deg)'; });
target.addEventListener('hide.bs.collapse', function () { icon.style.transform = 'rotate(0deg)'; });
// Init state
if (target.classList.contains('show')) icon.style.transform = 'rotate(90deg)';
});
</script>
{% endblock %} {% endblock %}
+20 -20
View File
@@ -8,32 +8,29 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<div class="d-sm-flex justify-content-between align-items-center mb-4"> <h3 class="text-dark mb-3 fw-bold">Trip history</h3>
<div>
<h3 class="text-dark mb-1">Trip history</h3>
<p class="text-muted mb-0">Review recorded drives and replay their routes offline.</p>
</div>
</div>
<div class="row"> {# Mobile: list on top, map below. Desktop: side by side. #}
<div class="col-xl-5 mb-4"> <div class="row g-3">
<div class="card shadow h-100"> {# ── Trip list ──────────────────────────────────────────────────── #}
<div class="card-header py-3"> <div class="col-12 col-xl-5">
<div class="card shadow-sm">
<div class="card-header py-2">
<h6 class="text-primary fw-bold m-0">Recorded trips</h6> <h6 class="text-primary fw-bold m-0">Recorded trips</h6>
</div> </div>
<div class="card-body p-0"> <div class="card-body p-0">
<div id="trip-loading" class="text-center text-muted p-5"> <div id="trip-loading" class="text-center text-muted py-4">
<span class="spinner-border spinner-border-sm me-2" aria-hidden="true"></span> <span class="spinner-border spinner-border-sm me-2" aria-hidden="true"></span>
Loading trips... Loading…
</div> </div>
<div id="trip-error" class="alert alert-danger m-3" role="alert" hidden></div> <div id="trip-error" class="alert alert-danger m-3" role="alert" hidden></div>
{{ data_table( {{ data_table(
"trip-list", "trip-list",
[ [
{"key": "started", "label": "Started", "sortable": true}, {"key": "started", "label": "Started", "sortable": true},
{"key": "distance", "label": "Distance", "sortable": true}, {"key": "distance", "label": "km", "sortable": true},
{"key": "duration", "label": "Duration", "sortable": true}, {"key": "duration", "label": "Time", "sortable": true},
{"key": "maxSpeed", "label": "Max speed", "sortable": true}, {"key": "maxSpeed", "label": "Max", "sortable": true},
{"key": "action", "label": "", "sortable": false} {"key": "action", "label": "", "sortable": false}
], ],
"No trips detected", "No trips detected",
@@ -42,9 +39,11 @@
</div> </div>
</div> </div>
</div> </div>
<div class="col-xl-7 mb-4">
<div class="card shadow"> {# ── Route replay map ───────────────────────────────────────────── #}
<div class="card-header py-3 d-flex justify-content-between align-items-center"> <div class="col-12 col-xl-7">
<div class="card shadow-sm">
<div class="card-header py-2 d-flex justify-content-between align-items-center">
<h6 class="text-primary fw-bold m-0">Route replay</h6> <h6 class="text-primary fw-bold m-0">Route replay</h6>
<span id="trip-summary" class="small text-muted">Select a trip</span> <span id="trip-summary" class="small text-muted">Select a trip</span>
</div> </div>
@@ -52,10 +51,11 @@
<div id="history-map" aria-label="Selected trip route map"></div> <div id="history-map" aria-label="Selected trip route map"></div>
<div id="trip-timeline" class="border-top p-3" hidden> <div id="trip-timeline" class="border-top p-3" hidden>
<div class="d-flex align-items-center gap-3"> <div class="d-flex align-items-center gap-3">
<button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play trip replay"> <button id="trip-play" class="btn btn-primary btn-sm" type="button" aria-label="Play">
<i class="fas fa-play" aria-hidden="true"></i> <i class="fas fa-play" aria-hidden="true"></i>
</button> </button>
<input id="trip-scrubber" class="form-range flex-grow-1" type="range" min="0" max="0" value="0" aria-label="Trip replay timeline"> <input id="trip-scrubber" class="form-range flex-grow-1" type="range"
min="0" max="0" value="0" aria-label="Trip replay timeline">
</div> </div>
<div class="d-flex flex-wrap justify-content-between gap-2 small mt-2"> <div class="d-flex flex-wrap justify-content-between gap-2 small mt-2">
<strong id="trip-replay-time"></strong> <strong id="trip-replay-time"></strong>
+76 -59
View File
@@ -7,54 +7,54 @@
{% endblock %} {% endblock %}
{% block content %} {% block content %}
<h3 class="text-dark mb-4 fw-bold">Dashboard</h3> <h3 class="text-dark mb-3 fw-bold">Dashboard</h3>
{# ── OBD stat cards ──────────────────────────────────────────────────── #} {# ── OBD stat cards ──────────────────────────────────────────────────── #}
<div class="row g-3 mb-4"> <div class="row g-2 mb-3">
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-primary h-100"> <div class="card shadow-sm border-start-primary h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-primary fw-bold text-xs mb-1">OBD Status</div> <div class="text-uppercase text-primary fw-bold text-xs mb-1">OBD</div>
<div id="obd-status" class="fw-bold h5 mb-0 text-dark">—</div> <div id="obd-status" class="fw-bold mb-0 text-dark obd-val">—</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-success h-100"> <div class="card shadow-sm border-start-success h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-success fw-bold text-xs mb-1">Speed</div> <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 id="obd-speed" class="fw-bold h5 mb-0 text-dark">—</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-info h-100"> <div class="card shadow-sm border-start-info h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-info fw-bold text-xs mb-1">RPM</div> <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 id="obd-rpm" class="fw-bold h5 mb-0 text-dark">—</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-warning h-100"> <div class="card shadow-sm border-start-warning h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-warning fw-bold text-xs mb-1">Coolant temp</div> <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 id="obd-coolant" class="fw-bold h5 mb-0 text-dark">—</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-danger h-100"> <div class="card shadow-sm border-start-danger h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-danger fw-bold text-xs mb-1">Throttle</div> <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 id="obd-throttle" class="fw-bold h5 mb-0 text-dark">—</div>
</div> </div>
</div> </div>
</div> </div>
<div class="col-6 col-lg-4 col-xl-2"> <div class="col-6 col-sm-4 col-xl-2">
<div class="card shadow-sm border-start-primary h-100"> <div class="card shadow-sm border-start-primary h-100">
<div class="card-body py-3"> <div class="card-body py-2 px-3">
<div class="text-uppercase text-primary fw-bold text-xs mb-1">Fuel level</div> <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 id="obd-fuel" class="fw-bold h5 mb-0 text-dark">—</div>
</div> </div>
</div> </div>
@@ -62,71 +62,70 @@
</div> </div>
{# ── Pi health ───────────────────────────────────────────────────────── #} {# ── Pi health ───────────────────────────────────────────────────────── #}
<div class="card shadow-sm mb-4" id="pi-health-card"> <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"> <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> <h6 class="text-primary fw-bold m-0">Pi health</h6>
<span id="pi-health-updated" class="small text-muted">Loading…</span> <span id="pi-health-updated" class="small text-muted">Loading…</span>
</div> </div>
<div class="card-body"> <div class="card-body py-2">
<div id="pi-health-warning" class="alert alert-warning" role="alert" hidden></div> <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" 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-3"> <div class="row g-2">
<div class="col-6 col-lg-3"> <div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">CPU temperature</div> <div class="text-uppercase text-muted fw-bold text-xs mb-1">CPU temp</div>
<div id="pi-temperature" class="h5 text-dark fw-bold mb-0">--</div> <div id="pi-temperature" class="h6 text-dark fw-bold mb-0">--</div>
</div> </div>
<div class="col-6 col-lg-3"> <div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Memory used</div> <div class="text-uppercase text-muted fw-bold text-xs mb-1">Memory</div>
<div id="pi-memory" class="h5 text-dark fw-bold mb-0">--</div> <div id="pi-memory" class="h6 text-dark fw-bold mb-0">--</div>
</div> </div>
<div class="col-6 col-lg-3"> <div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Disk used</div> <div class="text-uppercase text-muted fw-bold text-xs mb-1">Disk</div>
<div id="pi-disk" class="h5 text-dark fw-bold mb-0">--</div> <div id="pi-disk" class="h6 text-dark fw-bold mb-0">--</div>
</div> </div>
<div class="col-6 col-lg-3"> <div class="col-6 col-lg-3">
<div class="text-uppercase text-muted fw-bold text-xs mb-1">Uptime</div> <div class="text-uppercase text-muted fw-bold text-xs mb-1">Uptime</div>
<div id="pi-uptime" class="h5 text-dark fw-bold mb-0">--</div> <div id="pi-uptime" class="h6 text-dark fw-bold mb-0">--</div>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
{# ── Speed graph + GPS ───────────────────────────────────────────────── #} {# ── GPS map (with inline coords footer) ─────────────────────────────── #}
<div class="row g-3"> <div class="row g-3 mb-3">
<div class="col-lg-7 col-xl-8">
<div class="card shadow-sm mb-4">
<div class="card-header">
<h6 class="text-primary fw-bold m-0">Speed Graph</h6>
</div>
<div class="card-body">
<div class="chart-container" style="position:relative;height:40vh;text-align:center;">
<canvas id="speedGraph"></canvas>
</div>
</div>
</div>
</div>
<div class="col-lg-5 col-xl-4"> <div class="col-lg-5 col-xl-4">
<div class="card shadow-sm mb-3"> <div class="card shadow-sm h-100">
<div class="card-header"> <div class="card-header py-2">
<h6 class="text-primary fw-bold m-0">GPS</h6> <h6 class="text-primary fw-bold m-0">Live GPS</h6>
</div> </div>
<div class="card-body p-0"> <div class="card-body p-0">
<div id="map"></div> <div id="map"></div>
</div> </div>
</div> <div class="card-footer py-2 d-flex gap-4 bg-white border-top">
<div class="card shadow-sm mb-4">
<div class="card-header">
<h6 class="text-primary fw-bold m-0">GPS coordinates</h6>
</div>
<div class="card-body py-2">
<div class="d-flex gap-4">
<div> <div>
<div class="text-xs text-muted fw-bold text-uppercase mb-1">Latitude</div> <div class="text-xs text-muted fw-bold text-uppercase">Lat</div>
<div id="gpsLocationX" class="fw-bold">—</div> <div id="gpsLocationX" class="fw-semibold small">—</div>
</div> </div>
<div> <div>
<div class="text-xs text-muted fw-bold text-uppercase mb-1">Longitude</div> <div class="text-xs text-muted fw-bold text-uppercase">Lon</div>
<div id="gpsLocationY" class="fw-bold">—</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>
@@ -140,4 +139,22 @@
<script src="{{ url_for('static', filename='vendor/socketio/socket.io.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='vendor/leaflet/leaflet.js') }}"></script>
<script src="{{ url_for('static', filename='js/yaris.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 %} {% endblock %}
+139 -93
View File
@@ -3,166 +3,212 @@
{% block title %}Settings - Yaris OBD{% endblock %} {% block title %}Settings - Yaris OBD{% endblock %}
{% block content %} {% block content %}
<div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-4"> <div class="d-flex flex-wrap align-items-center justify-content-between gap-2 mb-3">
<div> <div>
<h3 class="text-dark mb-1">Settings</h3> <h3 class="text-dark mb-0 fw-bold">Settings</h3>
<p class="text-muted mb-0">Configuration stored locally on this Pi.</p> <p class="text-muted small mb-0">Stored locally on this Pi.</p>
</div> </div>
<button class="btn btn-primary d-none d-md-inline-block settings-save" type="submit" form="settings-form" disabled> <button class="btn btn-primary btn-sm d-none d-md-inline-flex align-items-center gap-1 settings-save"
<i class="fas fa-save me-1"></i>Save settings type="submit" form="settings-form" disabled>
<i class="fas fa-save"></i> Save settings
</button> </button>
</div> </div>
<div id="settings-message" class="alert" role="status" hidden></div> <div id="settings-message" class="alert" role="status" hidden></div>
<form id="settings-form"> <form id="settings-form">
<div class="card shadow mb-4">
<div class="card-header py-3"> {# ── Upload & retention ──────────────────────────────────────────── #}
<p class="text-primary m-0 fw-bold">Uploads and local video</p> <div class="card shadow-sm mb-3">
<div class="card-header py-2">
<p class="text-primary m-0 fw-bold small">Uploads &amp; local video</p>
</div> </div>
<div class="card-body"> <div class="card-body py-3">
<div class="form-check form-switch mb-3"> <div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="dashcam-upload-enabled"> <input class="form-check-input" type="checkbox" role="switch" id="dashcam-upload-enabled">
<label class="form-check-label" for="dashcam-upload-enabled">Upload dashcam videos to the remote server</label> <label class="form-check-label" for="dashcam-upload-enabled">Upload dashcam videos to server</label>
</div> </div>
<p class="text-muted small">Trip/GPS uploads remain enabled. Dashcam video only uploads over WiFi/Ethernet.</p> <p class="text-muted small mb-2">Trip/GPS always uploads. Dashcam video only over WiFi/Ethernet.</p>
<p id="upload-health" class="small mb-3">Checking remote upload status...</p> <p id="upload-health" class="small text-muted mb-3">Checking…</p>
<label class="form-label" for="retention-days">Delete uploaded local videos after</label> <div class="d-flex align-items-center gap-2">
<div class="input-group settings-number"> <label class="form-label mb-0 text-nowrap" for="retention-days">Delete after</label>
<div class="input-group input-group-sm" style="max-width:10rem;">
<input class="form-control" id="retention-days" type="number" min="0" max="3650" step="1" required> <input class="form-control" id="retention-days" type="number" min="0" max="3650" step="1" required>
<span class="input-group-text">days</span> <span class="input-group-text">days</span>
</div> </div>
<div class="form-text">Use 0 to keep uploaded local copies until manually deleted.</div> <span class="small text-muted">(0 = keep forever)</span>
</div>
<div class="invalid-feedback" data-error-for="local_video_retention_days"></div> <div class="invalid-feedback" data-error-for="local_video_retention_days"></div>
</div> </div>
</div> </div>
<div class="card shadow mb-4"> {# ── Phone hotspot ───────────────────────────────────────────────── #}
<div class="card-header py-3"> <div class="card shadow-sm mb-3">
<p class="text-primary m-0 fw-bold">Phone hotspot internet</p> <div class="card-header py-2">
<p class="text-primary m-0 fw-bold small">Phone hotspot internet</p>
</div> </div>
<div class="card-body"> <div class="card-body py-3">
<p id="uplink-status" class="mb-3">Checking network mode...</p> <p id="uplink-status" class="mb-2 small fw-semibold">Checking network mode…</p>
<p id="last-phone-address" class="small mb-3" hidden> <p id="last-phone-address" class="small mb-3" hidden>
Last phone-network address: Last phone IP: <a id="last-phone-address-link" href="#"></a>
<a id="last-phone-address-link" href="#"></a> <span class="text-muted">(may change after reconnecting)</span>
<span class="text-muted">(DHCP may change it after reconnecting.)</span>
</p> </p>
<div class="row g-3"> <div class="row g-2 mb-3">
<div class="col-md-6"> <div class="col-sm-6">
<label class="form-label" for="phone-hotspot-ssid">Phone hotspot name</label> <label class="form-label form-label-sm" for="phone-hotspot-ssid">Hotspot name</label>
<input class="form-control" id="phone-hotspot-ssid" maxlength="32" autocomplete="off"> <input class="form-control form-control-sm" id="phone-hotspot-ssid" maxlength="32" autocomplete="off">
</div> </div>
<div class="col-md-6"> <div class="col-sm-6">
<label class="form-label" for="phone-hotspot-password">Phone hotspot password</label> <label class="form-label form-label-sm" for="phone-hotspot-password">Password</label>
<input class="form-control" id="phone-hotspot-password" type="password" minlength="8" maxlength="63" autocomplete="new-password"> <input class="form-control form-control-sm" id="phone-hotspot-password" type="password"
minlength="8" maxlength="63" autocomplete="new-password">
</div> </div>
</div> </div>
<div id="uplink-message" class="alert mt-3 mb-0" role="status" hidden></div> <div id="uplink-message" class="alert py-2 mt-2 mb-0" role="status" hidden></div>
<div class="d-flex flex-wrap gap-2 mt-3"> <div class="d-flex flex-wrap gap-2 mb-2">
<button class="btn btn-primary" id="phone-hotspot-save" type="button">Save hotspot</button> <button class="btn btn-sm btn-primary" id="phone-hotspot-save" type="button">Save</button>
<button class="btn btn-outline-primary" id="phone-hotspot-connect" type="button" disabled>Wait for hotspot</button> <button class="btn btn-sm btn-outline-primary" id="phone-hotspot-connect" type="button" disabled>Wait for hotspot</button>
<button class="btn btn-outline-danger" id="phone-hotspot-remove" type="button" disabled>Remove hotspot</button> <button class="btn btn-sm btn-outline-danger" id="phone-hotspot-remove" type="button" disabled>Remove</button>
</div> </div>
<p class="form-text mb-0 mt-3"> <p class="form-text small mb-0">
Save while the phone is still connected to the Pi/home WiFi. Then select Save while connected to home WiFi, then tap <strong>Wait for hotspot</strong> and enable the phone hotspot within 2 min.
<strong>Wait for hotspot</strong> and enable the phone hotspot within two minutes. Password is write-only. If the Pi hotspot doesn't appear via <strong>yaris.local</strong>, use the last phone IP above.
The password is write-only and is never returned here. This page may briefly close
while networks switch. Some phones do not resolve <strong>yaris.local</strong> for
tethered clients; use the last direct address shown above when needed. If the phone
hotspot never appears, the Pi restores home WiFi or its local hotspot.
</p> </p>
</div> </div>
</div> </div>
<div class="card shadow mb-4"> {# ── Cellular + ntfy (collapsible together) ─────────────────────── #}
<div class="card-header py-3"> <div class="card shadow-sm mb-3">
<p class="text-primary m-0 fw-bold">Cellular trip-log fallback</p> <div class="card-header py-2 d-flex align-items-center justify-content-between"
style="cursor:pointer;" data-bs-toggle="collapse" data-bs-target="#connectivity-body"
aria-expanded="false" aria-controls="connectivity-body">
<p class="text-primary m-0 fw-bold small">Cellular &amp; notifications</p>
<i class="fas fa-chevron-down text-muted small collapse-chevron"></i>
</div> </div>
<div class="card-body"> <div class="collapse" id="connectivity-body">
<div class="form-check form-switch mb-3"> <div class="card-body py-3">
{# Cellular #}
<p class="fw-semibold small text-secondary text-uppercase mb-2">SIM868 Cellular</p>
<div class="form-check form-switch mb-2">
<input class="form-check-input" type="checkbox" role="switch" id="cellular-enabled"> <input class="form-check-input" type="checkbox" role="switch" id="cellular-enabled">
<label class="form-check-label" for="cellular-enabled">Enable SIM868 cellular fallback</label> <label class="form-check-label" for="cellular-enabled">Enable SIM868 cellular fallback</label>
</div> </div>
<label class="form-label" for="cellular-apn">Carrier APN</label> <div class="mb-3">
<input class="form-control" id="cellular-apn" maxlength="100" autocomplete="off" placeholder="example.apn"> <label class="form-label form-label-sm" for="cellular-apn">Carrier APN</label>
<input class="form-control form-control-sm" id="cellular-apn" maxlength="100"
autocomplete="off" placeholder="example.apn">
<div class="invalid-feedback" data-error-for="cellular_apn"></div> <div class="invalid-feedback" data-error-for="cellular_apn"></div>
<div class="form-text">Used only for small trip-log batches when WiFi/Ethernet is unavailable. Dashcam video never uses cellular.</div> <div class="form-text">Small trip-log batches only. Dashcam video never uses cellular.</div>
</div> </div>
</div> <hr class="my-3">
{# ntfy #}
<div class="card shadow mb-4"> <p class="fw-semibold small text-secondary text-uppercase mb-2">ntfy push notifications</p>
<div class="card-header py-3"> <div class="form-check form-switch mb-2">
<p class="text-primary m-0 fw-bold">Optional ntfy notifications</p>
</div>
<div class="card-body">
<div class="form-check form-switch mb-3">
<input class="form-check-input" type="checkbox" role="switch" id="ntfy-enabled"> <input class="form-check-input" type="checkbox" role="switch" id="ntfy-enabled">
<label class="form-check-label" for="ntfy-enabled">Send alerts through ntfy</label> <label class="form-check-label" for="ntfy-enabled">Send alerts via ntfy</label>
</div> </div>
<label class="form-label" for="ntfy-url">ntfy topic URL</label> <div class="mb-2">
<input class="form-control" id="ntfy-url" type="url" maxlength="2048" autocomplete="off" placeholder="https://ntfy.sh/private-topic"> <label class="form-label form-label-sm" for="ntfy-url">Topic URL</label>
<input class="form-control form-control-sm" id="ntfy-url" type="url" maxlength="2048"
autocomplete="off" placeholder="https://ntfy.sh/my-topic">
<div class="invalid-feedback" data-error-for="ntfy_url"></div> <div class="invalid-feedback" data-error-for="ntfy_url"></div>
<div class="form-text" id="ntfy-url-state">Leave blank to keep the saved URL unchanged.</div> <div class="form-text" id="ntfy-url-state">Leave blank to keep saved URL.</div>
<div class="form-check mt-2"> <div class="form-check mt-1">
<input class="form-check-input" type="checkbox" id="clear-ntfy-url"> <input class="form-check-input" type="checkbox" id="clear-ntfy-url">
<label class="form-check-label" for="clear-ntfy-url">Remove saved ntfy URL</label> <label class="form-check-label small" for="clear-ntfy-url">Remove saved URL</label>
</div> </div>
<label class="form-label mt-3" for="ntfy-token">Access token</label> </div>
<input class="form-control" id="ntfy-token" type="password" maxlength="512" autocomplete="new-password" placeholder="Optional"> <div class="mb-0">
<label class="form-label form-label-sm" for="ntfy-token">Access token</label>
<input class="form-control form-control-sm" id="ntfy-token" type="password"
maxlength="512" autocomplete="new-password" placeholder="Optional">
<div class="invalid-feedback" data-error-for="ntfy_token"></div> <div class="invalid-feedback" data-error-for="ntfy_token"></div>
<div class="form-text" id="ntfy-token-state">Leave blank to keep the saved token unchanged.</div> <div class="form-text" id="ntfy-token-state">Leave blank to keep saved token.</div>
<div class="form-check mt-2"> <div class="form-check mt-1">
<input class="form-check-input" type="checkbox" id="clear-ntfy-token"> <input class="form-check-input" type="checkbox" id="clear-ntfy-token">
<label class="form-check-label" for="clear-ntfy-token">Remove saved ntfy token</label> <label class="form-check-label small" for="clear-ntfy-token">Remove saved token</label>
</div>
</div>
</div> </div>
</div> </div>
</div> </div>
<div class="card shadow mb-4"> {# ── Alert thresholds (collapsible) ──────────────────────────────── #}
<div class="card-header py-3"> <div class="card shadow-sm mb-3">
<p class="text-primary m-0 fw-bold">Alert thresholds and repeat interval</p> <div class="card-header py-2 d-flex align-items-center justify-content-between"
style="cursor:pointer;" data-bs-toggle="collapse" data-bs-target="#thresholds-body"
aria-expanded="false" aria-controls="thresholds-body">
<p class="text-primary m-0 fw-bold small">Alert thresholds</p>
<i class="fas fa-chevron-down text-muted small collapse-chevron"></i>
</div> </div>
<div class="card-body"> <div class="collapse" id="thresholds-body">
<div class="card-body py-3">
<div class="row g-3"> <div class="row g-3">
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="temperature-c">Pi temperature</label> <label class="form-label form-label-sm" for="temperature-c">Pi temp</label>
<div class="input-group"><input class="form-control" id="temperature-c" type="number" min="40" max="100" step="0.1" required><span class="input-group-text">°C</span></div> <div class="input-group input-group-sm">
<input class="form-control" id="temperature-c" type="number" min="40" max="100" step="0.1" required>
<span class="input-group-text">°C</span>
</div>
<div class="invalid-feedback" data-error-for="temperature_c"></div> <div class="invalid-feedback" data-error-for="temperature_c"></div>
</div> </div>
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="disk-percent">Pi/dashcam disk usage</label> <label class="form-label form-label-sm" for="disk-percent">Disk usage</label>
<div class="input-group"><input class="form-control" id="disk-percent" type="number" min="50" max="100" step="0.1" required><span class="input-group-text">%</span></div> <div class="input-group input-group-sm">
<input class="form-control" id="disk-percent" type="number" min="50" max="100" step="0.1" required>
<span class="input-group-text">%</span>
</div>
<div class="invalid-feedback" data-error-for="disk_percent"></div> <div class="invalid-feedback" data-error-for="disk_percent"></div>
</div> </div>
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="tracking-backlog">Pending tracking rows</label> <label class="form-label form-label-sm" for="tracking-backlog">Tracking backlog</label>
<input class="form-control" id="tracking-backlog" type="number" min="1" max="1000000" step="1" required> <input class="form-control form-control-sm" id="tracking-backlog" type="number" min="1" max="1000000" step="1" required>
<div class="invalid-feedback" data-error-for="tracking_backlog"></div> <div class="invalid-feedback" data-error-for="tracking_backlog"></div>
</div> </div>
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="video-backlog">Pending videos</label> <label class="form-label form-label-sm" for="video-backlog">Video backlog</label>
<input class="form-control" id="video-backlog" type="number" min="1" max="100000" step="1" required> <input class="form-control form-control-sm" id="video-backlog" type="number" min="1" max="100000" step="1" required>
<div class="invalid-feedback" data-error-for="video_backlog"></div> <div class="invalid-feedback" data-error-for="video_backlog"></div>
</div> </div>
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="gps-loss-seconds">GPS loss while moving</label> <label class="form-label form-label-sm" for="gps-loss-seconds">GPS loss</label>
<div class="input-group"><input class="form-control" id="gps-loss-seconds" type="number" min="10" max="3600" step="1" required><span class="input-group-text">seconds</span></div> <div class="input-group input-group-sm">
<input class="form-control" id="gps-loss-seconds" type="number" min="10" max="3600" step="1" required>
<span class="input-group-text">s</span>
</div>
<div class="invalid-feedback" data-error-for="gps_loss_seconds"></div> <div class="invalid-feedback" data-error-for="gps_loss_seconds"></div>
</div> </div>
<div class="col-md-6"> <div class="col-6">
<label class="form-label" for="repeat-seconds">Repeat active notifications</label> <label class="form-label form-label-sm" for="repeat-seconds">Repeat interval</label>
<div class="input-group"><input class="form-control" id="repeat-seconds" type="number" min="60" max="604800" step="1" required><span class="input-group-text">seconds</span></div> <div class="input-group input-group-sm">
<input class="form-control" id="repeat-seconds" type="number" min="60" max="604800" step="1" required>
<span class="input-group-text">s</span>
</div>
<div class="invalid-feedback" data-error-for="repeat_seconds"></div> <div class="invalid-feedback" data-error-for="repeat_seconds"></div>
</div> </div>
</div> </div>
<p class="text-muted small mt-3 mb-0">Local Web UI alerts remain available even when ntfy is disabled.</p> <p class="text-muted small mt-3 mb-0">Web UI alerts are always shown regardless of ntfy.</p>
</div> </div>
</div> </div>
</div>
<button class="btn btn-primary w-100 d-md-none settings-save mb-4" type="submit" disabled> <button class="btn btn-primary w-100 d-md-none settings-save mb-4" type="submit" disabled>
<i class="fas fa-save me-1"></i>Save settings <i class="fas fa-save me-1"></i>Save settings
</button> </button>
</form> </form>
<script>
// Rotate chevrons on collapsible card headers
document.querySelectorAll('[data-bs-toggle="collapse"]').forEach(function (trigger) {
const targetId = trigger.getAttribute('data-bs-target');
const target = document.querySelector(targetId);
if (!target) return;
const chevron = trigger.querySelector('.collapse-chevron');
if (!chevron) return;
target.addEventListener('show.bs.collapse', function () { chevron.style.transform = 'rotate(180deg)'; });
target.addEventListener('hide.bs.collapse', function () { chevron.style.transform = ''; });
});
</script>
{% endblock %} {% endblock %}
{% block scripts %} {% block scripts %}