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
+120 -93
View File
@@ -4,102 +4,129 @@
{% block title %}Dashcam - Yaris OBD{% endblock %}
{% block content %}
<h3 class="text-dark mb-4">Dashcam</h3>
<div class="card shadow mb-4">
<div class="card-header py-3">
<p class="text-primary m-0 fw-bold">Detected device</p>
</div>
<div class="card-body">
<p id="dash-device-status">Checking for a USB dashcam...</p>
<button id="dash-scan-btn" class="btn btn-secondary" type="button">Scan for dashcam</button>
<button id="dash-import-btn" class="btn btn-primary" type="button" disabled>Import videos</button>
</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 id="dash-select-all-btn" class="btn btn-sm btn-outline-secondary" type="button" disabled>
Select all
</button>
<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
</button>
<button id="dash-delete-all-btn" class="btn btn-sm btn-danger" type="button"
data-confirm="Permanently delete every video from the dashcam? This cannot be undone." disabled>
<i class="fas fa-trash me-1"></i>Delete all
</button>
</div>
</div>
<div class="card-body p-0">
{{ data_table(
"dashcam-file-list",
[
{"key": "selected", "label": "Select", "sortable": false},
{"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Modified", "sortable": true},
{"key": "actions", "label": "Actions", "sortable": false}
],
"No videos found",
"Connect the dashcam in USB storage mode, then refresh this list."
) }}
</div>
</div>
<div class="card shadow mb-4">
<div class="card-header py-3">
<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 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 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">Imported videos on Pi</p>
<small id="local-video-summary" class="text-muted">Loading...</small>
</div>
<button id="local-videos-refresh-btn" class="btn btn-sm btn-secondary" type="button">
<i class="fas fa-sync-alt me-1"></i>Refresh
</button>
</div>
<div class="card-body p-0">
{{ data_table(
"local-video-list",
[
{"key": "thumbnail", "label": "Preview", "sortable": false},
{"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Modified", "sortable": true},
{"key": "uploaded", "label": "Upload", "sortable": true},
{"key": "actions", "label": "Actions", "sortable": false}
],
"No imported videos",
"Import videos from the connected dashcam to browse and play them here."
) }}
</div>
</div>
<h3 class="text-dark mb-3 fw-bold">Dashcam</h3>
{# ── Device status bar ───────────────────────────────────────────────── #}
<div class="card shadow-sm mb-3">
<div class="card-body py-2 d-flex flex-wrap align-items-center gap-2">
<i class="fas fa-usb text-muted"></i>
<span id="dash-device-status" class="me-auto small">Checking for a USB dashcam…</span>
<button id="dash-scan-btn" class="btn btn-sm btn-secondary" type="button">
<i class="fas fa-search me-1"></i>Scan
</button>
<button id="dash-import-btn" class="btn btn-sm btn-primary" type="button" disabled>
<i class="fas fa-download me-1"></i>Import all
</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>
<i class="fas fa-download me-1"></i>Import
</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>
<i class="fas fa-trash"></i>
</button>
</div>
</div>
<div class="collapse" id="dashcam-files-body">
<div class="card-body p-0">
{{ data_table(
"dashcam-file-list",
[
{"key": "selected", "label": "", "sortable": false},
{"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Modified", "sortable": true},
{"key": "actions", "label": "", "sortable": false}
],
"No videos found",
"Connect the dashcam in USB storage mode, then refresh this list."
) }}
</div>
<div class="card-footer py-2 d-flex align-items-center gap-2">
<i class="fas fa-info-circle text-muted small"></i>
<span id="dash-import-status" class="small text-muted">No import has been run yet.</span>
</div>
</div>
</div>
{# ── Imported videos on Pi ───────────────────────────────────────────── #}
<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="#local-videos-body"
aria-expanded="true" aria-controls="local-videos-body" id="local-videos-toggle">
<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>
</div>
<div class="collapse show" id="local-videos-body">
<div class="card-body p-0">
{{ data_table(
"local-video-list",
[
{"key": "thumbnail", "label": "", "sortable": false},
{"key": "path", "label": "File", "sortable": true},
{"key": "size", "label": "Size", "sortable": true},
{"key": "modified", "label": "Date", "sortable": true},
{"key": "uploaded", "label": "Upload", "sortable": true},
{"key": "actions", "label": "", "sortable": false}
],
"No imported videos",
"Import videos from the connected dashcam to browse and play them here."
) }}
</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 %}
{% block scripts %}
<script src="{{ url_for('static', filename='js/dash.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 %}