Phase 23: UI redesign — responsive mobile + desktop layout

- Replace SB Admin 2 sidebar with a clean fixed sidebar (desktop)
  and a sticky bottom tab navigation (mobile, ≤767px)
- Sidebar collapses to icon-only mode with state persisted in localStorage
- Logo is a functional home link on all viewports
- Mobile: full-width content, bottom nav replaces sidebar
- Dashboard: 6 OBD stat cards (status, speed, RPM, coolant, throttle, fuel)
  wired to live socket events; removed all placeholder buttons/dropdowns
- GPS info section cleaned up (lat/lon display instead of X/Y paragraphs)
- DTC page: live /api/dtc wiring — MIL indicator + DTC table populated from API
- New /api/dtc route added to app.py (mil + codes)
- yaris.js: added obd_coolant_temp / obd_fuel_level / obd_throttle listeners
- yaris.css: full rewrite — layout variables, sidebar, bottom nav, OBD cards,
  border-start utilities, mobile padding for bottom nav

Co-authored-by: Copilot <[email protected]>
This commit is contained in:
Mathieu Moran
2026-08-09 22:57:12 -04:00
co-authored by Copilot
parent cdb032b888
commit 7edea446c5
7 changed files with 589 additions and 288 deletions
+100 -74
View File
@@ -12,85 +12,111 @@
</head>
<body id="page-top">
<div id="wrapper">
<nav class="navbar align-items-start sidebar sidebar-dark accordion bg-gradient-primary p-0 navbar-dark app-sidebar">
<div class="container-fluid d-flex flex-column p-0">
<a class="navbar-brand d-flex justify-content-center align-items-center sidebar-brand m-0" href="{{ url_for('index') }}">
<div class="sidebar-brand-icon rotate-n-15"><i class="fas fa-car"></i></div>
<div id="index-car-model" class="sidebar-brand-text mx-3"><span>{{ car.model }}</span></div>
{# ── Desktop sidebar ─────────────────────────────────────────────────── #}
<nav id="app-sidebar" class="app-sidebar d-none d-md-flex flex-column">
<a class="sidebar-brand" href="{{ url_for('index') }}" aria-label="Home">
<i class="fas fa-car sidebar-brand-icon"></i>
<span class="sidebar-brand-text">{{ car.model }}</span>
</a>
<hr class="sidebar-divider">
<ul class="nav flex-column flex-grow-1">
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'index' %} active{% endif %}" href="{{ url_for('index') }}">
<i class="fas fa-tachometer-alt fa-fw"></i><span>Dashboard</span>
</a>
<hr class="sidebar-divider my-0">
<ul class="navbar-nav text-light" id="accordionSidebar">
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'index' %} active{% endif %}" href="{{ url_for('index') }}">
<i class="fas fa-tachometer-alt"></i><span>Dashboard</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'dash' %} active{% endif %}" href="{{ url_for('dash') }}">
<i class="fas fa-video"></i><span>Dashcam</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'history' %} active{% endif %}" href="{{ url_for('history') }}">
<i class="fas fa-route"></i><span>Trip history</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'dtc' %} active{% endif %}" href="{{ url_for('dtc') }}">
<i class="fas fa-exclamation-triangle"></i><span>DTC</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'settings' %} active{% endif %}" href="{{ url_for('settings') }}">
<i class="fas fa-cog"></i><span>Settings</span>
</a>
</li>
</ul>
<div class="text-center d-none d-md-inline">
<button class="btn rounded-circle border-0" id="sidebarToggle" type="button" aria-label="Toggle sidebar"></button>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'dash' %} active{% endif %}" href="{{ url_for('dash') }}">
<i class="fas fa-video fa-fw"></i><span>Dashcam</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'history' %} active{% endif %}" href="{{ url_for('history') }}">
<i class="fas fa-route fa-fw"></i><span>Trip history</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'dtc' %} active{% endif %}" href="{{ url_for('dtc') }}">
<i class="fas fa-exclamation-triangle fa-fw"></i><span>DTC</span>
</a>
</li>
<li class="nav-item">
<a class="nav-link{% if request.endpoint == 'settings' %} active{% endif %}" href="{{ url_for('settings') }}">
<i class="fas fa-cog fa-fw"></i><span>Settings</span>
</a>
</li>
</ul>
<button class="sidebar-collapse-btn" id="sidebarToggle" type="button" aria-label="Collapse sidebar">
<i class="fas fa-chevron-left"></i>
</button>
</nav>
{# ── Main content area ────────────────────────────────────────────────── #}
<div id="content-wrapper">
{# Top bar #}
<nav class="topbar navbar navbar-light bg-white shadow-sm">
<div class="container-fluid px-3 gap-2">
{# Mobile: logo on left #}
<a class="navbar-brand d-flex d-md-none align-items-center gap-2 text-decoration-none" href="{{ url_for('index') }}">
<i class="fas fa-car text-primary"></i>
<span class="fw-bold text-dark">{{ car.model }}</span>
</a>
<div class="ms-auto d-flex align-items-center gap-2">
<div class="dropdown">
<button class="btn btn-link position-relative p-2" id="alert-toggle" type="button"
data-bs-toggle="dropdown" aria-expanded="false" aria-label="System alerts">
<i class="fas fa-bell fa-fw text-secondary"></i>
<span id="alert-count" class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" hidden></span>
</button>
<div class="dropdown-menu dropdown-menu-end shadow" id="alert-menu" aria-labelledby="alert-toggle">
<h6 class="dropdown-header">System alerts</h6>
<div id="alert-notifications">
<div class="dropdown-item-text text-muted small">Loading…</div>
</div>
</div>
</div>
<span class="text-muted small d-none d-sm-inline">{{ account.name }}</span>
<img class="rounded-circle border" style="width:2rem;height:2rem;object-fit:cover;"
src="{{ url_for('static', filename='img/yaris.png') }}" alt="">
</div>
</div>
</nav>
<div class="d-flex flex-column" id="content-wrapper">
<div id="content">
<nav class="navbar navbar-expand bg-white shadow mb-4 topbar static-top navbar-light">
<div class="container-fluid">
<button class="btn btn-link d-md-none rounded-circle me-3" id="sidebarToggleTop" type="button" aria-label="Toggle sidebar">
<i class="fas fa-bars"></i>
</button>
<div class="ms-auto d-flex align-items-center">
<div class="dropdown me-3">
<button class="btn btn-link position-relative p-1" id="alert-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false" aria-label="System alerts">
<i class="fas fa-bell fa-fw"></i>
<span id="alert-count" class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger" hidden></span>
</button>
<div class="dropdown-menu dropdown-menu-end shadow" id="alert-menu" aria-labelledby="alert-toggle">
<h6 class="dropdown-header">System alerts</h6>
<div id="alert-notifications">
<div class="dropdown-item-text text-muted small">Loading...</div>
</div>
</div>
</div>
<span id="index-pp" class="d-none d-sm-inline me-2 text-gray-600 small">{{ account.name }}</span>
<img class="border rounded-circle img-profile" src="{{ url_for('static', filename='img/yaris.png') }}" alt="">
</div>
</div>
</nav>
<main class="container-fluid">
{% block content %}{% endblock %}
</main>
</div>
<footer class="bg-white sticky-footer">
<div class="container my-auto">
<div class="text-center my-auto copyright"><span>Copyright © yaris vroom vroom de course 2023</span></div>
</div>
</footer>
</div>
<a class="border rounded d-inline scroll-to-top" href="#page-top" aria-label="Back to top">
<i class="fas fa-angle-up"></i>
</a>
<main class="container-fluid py-4 px-3 px-md-4 main-content">
{% block content %}{% endblock %}
</main>
<footer class="bg-white border-top text-center py-3 small text-muted d-none d-md-block">
&copy; Yaris OBD {{ car.model }}
</footer>
</div>
{# ── Mobile bottom navigation bar ─────────────────────────────────────── #}
<nav class="mobile-bottom-nav d-flex d-md-none" aria-label="Main navigation">
<a class="mobile-nav-item{% if request.endpoint == 'index' %} active{% endif %}" href="{{ url_for('index') }}">
<i class="fas fa-tachometer-alt"></i>
<span>Dashboard</span>
</a>
<a class="mobile-nav-item{% if request.endpoint == 'dash' %} active{% endif %}" href="{{ url_for('dash') }}">
<i class="fas fa-video"></i>
<span>Dashcam</span>
</a>
<a class="mobile-nav-item{% if request.endpoint == 'history' %} active{% endif %}" href="{{ url_for('history') }}">
<i class="fas fa-route"></i>
<span>History</span>
</a>
<a class="mobile-nav-item{% if request.endpoint == 'dtc' %} active{% endif %}" href="{{ url_for('dtc') }}">
<i class="fas fa-exclamation-triangle"></i>
<span>DTC</span>
</a>
<a class="mobile-nav-item{% if request.endpoint == 'settings' %} active{% endif %}" href="{{ url_for('settings') }}">
<i class="fas fa-cog"></i>
<span>Settings</span>
</a>
</nav>
<script src="{{ url_for('static', filename='bootstrap/js/bootstrap.min.js') }}"></script>
<script src="{{ url_for('static', filename='js/bs-init.js') }}"></script>
<script src="{{ url_for('static', filename='js/theme.js') }}"></script>