improve UI

This commit is contained in:
SowinskiBraeden committed 2026-11-12 21:57:23 -07:00
1 parent 8a23655524
commit 4dbac4b824
4 files changed
+33 -7

No files matched your search

+3 -1
View File
@@ -83,7 +83,8 @@ function render() {
const seconds = controller.time();
byId('clock').textContent = `${String(Math.floor(seconds / 60)).padStart(2, '0')}:${String(seconds % 60).padStart(2, '0')}`;
byId('controller-screen').textContent = controller.render();
const screenView = document.querySelector('input[name="screen-view"]:checked').value;
byId('controller-screen').textContent = screenView === 'configured' ? controller.render_timing() : controller.render();
byId('signal-summary').textContent = green.length ? `Green: ${green.join(' / ')}`
: yellow.length ? `Yellow: ${yellow.join(' / ')}`
: clearing ? 'Red clearance · all red' : 'Startup · all red';
@@ -172,6 +173,7 @@ try {
byId('lcd-toggle').addEventListener('change', () => {
byId('controller-screen').classList.toggle('lcd-mode', byId('lcd-toggle').checked);
});
for (const el of document.querySelectorAll('input[name="screen-view"]')) el.addEventListener('change', render);
for (const phase of phases) {
document.querySelector(`[data-call="${phase.id}"]`).addEventListener('click', () => {
controller.call(phase.id);
+12
View File
@@ -0,0 +1,12 @@
<svg xmlns="http://www.w3.org/2000/svg" style="display:none">
<symbol id="chip" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<rect x="6" y="6" width="12" height="12" rx="1"/>
<path d="M9 1v3M12 1v3M15 1v3M9 20v3M12 20v3M15 20v3M1 9h3M1 12h3M1 15h3M20 9h3M20 12h3M20 15h3"/>
</symbol>
<symbol id="gitea" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round">
<circle cx="6" cy="6" r="2.5"/>
<circle cx="6" cy="18" r="2.5"/>
<circle cx="18" cy="12" r="2.5"/>
<path d="M6 8.5v7M8.3 7.3 15.7 10.7M8.3 16.7 15.7 13.3"/>
</symbol>
</svg>

After

Width:  |  Height:  |  Size: 702 B

+14 -6
View File
@@ -101,7 +101,13 @@
<details class="panel mb-3" open>
<summary class="h6 mb-0">Controller display</summary>
<div class="d-flex justify-content-end mt-2">
<div class="d-flex align-items-center justify-content-between flex-wrap gap-2 mt-2">
<div class="btn-group btn-group-sm" role="group" aria-label="Controller display view">
<input type="radio" class="btn-check" name="screen-view" id="view-live" value="live" autocomplete="off" checked>
<label class="btn btn-outline-secondary" for="view-live">Live</label>
<input type="radio" class="btn-check" name="screen-view" id="view-configured" value="configured" autocomplete="off">
<label class="btn btn-outline-secondary" for="view-configured">Configured</label>
</div>
<div class="form-check form-switch mb-0">
<input class="form-check-input" type="checkbox" role="switch" id="lcd-toggle">
<label class="form-check-label small" for="lcd-toggle">LCD display</label>
@@ -129,15 +135,17 @@
</form>
</details>
<footer class="d-flex justify-content-between gap-3 small text-secondary pb-2">
<footer class="d-flex align-items-center justify-content-between gap-3 small text-secondary pb-2">
<span>Fixed pairs: 1/5 → 2/6 → 3/7 → 4/8</span>
<svg class="icon" aria-hidden="true"><use href="/icons.svg#chip" /></svg>
<div class="d-flex align-items-center gap-2">
<svg class="icon" aria-hidden="true"><use href="./icons.svg#chip" /></svg>
<span>Rust/WebAssembly demo</span>
<span class="dot">&middot;</span>
<a href="https://git.sowinski.dev/SowinskiBraeden/traffic-lights" target="_blank" rel="noreferrer">
<svg class="icon" aria-hidden="true"><use href="/icons.svg#gitea" /></svg>
<span class="dot" aria-hidden="true">&middot;</span>
<a class="d-inline-flex align-items-center gap-1" href="https://git.sowinski.dev/SowinskiBraeden/traffic-lights" target="_blank" rel="noreferrer">
<svg class="icon" aria-hidden="true"><use href="./icons.svg#gitea" /></svg>
Source
</a>
</div>
</footer>
</main>
<script type="module" src="./app.js"></script>
+4
View File
@@ -39,6 +39,10 @@ body { background: #f5f5f5; color: #212529; }
.timing-table input { width: 84px; }
.clearance-input { width: 110px; }
summary { cursor: pointer; }
.icon { width: 14px; height: 14px; flex: none; }
.dot { opacity: .5; }
footer a { color: inherit; text-decoration: none; }
footer a:hover { color: #212529; text-decoration: underline; }
#controller-screen { background: #f3f4f5; border: 1px solid #ced4da; padding: 1rem; font-size: .8rem; line-height: 1.6; white-space: pre; overflow-x: auto; }
#controller-screen.lcd-mode {
Reference in new issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.