Files
yaris-obd/templates/base.html
T
Mathieu MoranandCopilot c65a635906 implement: Phase 25.5 device config from JSON file
- Create config/device.json with owner_name, car_model, device_name, avatar_path
- Update app_account.py to load owner_name and avatar_path from config
- Update app_car.py to load car_model and device_name from config
- Update base.html template to use avatar_path from config instead of hardcoded
- Add graceful fallback to hardcoded defaults if config file missing
- Document in deploy/readme.md and readme.md how to customize device identity
- Update PLAN.md Phase 25.5 to reflect current implementation and future server sync

Benefits:
- No code edits needed to customize Pi (edit JSON file only)
- Offline-first: all values loaded from local file at startup
- Connection-driven sync planned for Phase 25.5a (sync when internet available, not on timer)
- Server becomes source of truth after Phase 25.5a implementation

All 63 tests passing. Database filename still based on owner_name, with migration warning in docs.

Co-authored-by: Copilot <[email protected]>
2026-08-10 16:31:59 -04:00

129 lines
6.8 KiB
HTML

<!DOCTYPE html>
<html data-bs-theme="light" lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
<title>{% block title %}Yaris OBD{% endblock %}</title>
<link rel="stylesheet" href="{{ url_for('static', filename='bootstrap/css/bootstrap.min.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='yaris.css') }}">
<link rel="stylesheet" href="{{ url_for('static', filename='fonts/fontawesome-all.min.css') }}">
{% block styles %}{% endblock %}
</head>
<body id="page-top">
{# ── 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>
</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 badge rounded-pill bg-danger" style="top:2px;right:2px;font-size:.6rem;min-width:1.1em;padding:.2em .35em;" 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=account.avatar_path) }}" alt="">
</div>
</div>
</nav>
<main class="container-fluid 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; vroom vroom yaris de course 2023
</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>
<script src="{{ url_for('static', filename='js/data-list.js') }}"></script>
<script src="{{ url_for('static', filename='js/alerts.js') }}"></script>
{% block scripts %}{% endblock %}
</body>
</html>