Add version and about modal to test-track #57
Labels
No labels
Compat/Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Reference
gtfs.zone/deploy-gtfs-rt#57
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Add an "About" button to the navbar that opens a modal showing the app version (from git) and links to the source repo and changelog. Pattern is copied directly from coloring-book.
Relevant Context
modal-utils.ts(programmaticshowModal()) andabout-modal.ts— both get copied verbatim or with minor edits__APP_VERSION__at build time viavite.config.jsdefine, using thegit-describenpm packagegit-describein its dependencies; we'll useexecSync('git describe ...')directly (same fallback coloring-book already has), so no new dependency needednavbar-endwith room for another button, matching the pattern of the alerts button next to it<dialog>elements; the about modal will use the JS-drivenshowModal()approach from coloring-book (no conflict)Phases
Phase 1 — Wire up
__APP_VERSION__in the buildEdit
vite.config.jsto inject the app version at build time and add a TypeScript declaration for the global.vite.config.js: addimport { execSync } from 'child_process', compute version withexecSync('git describe --tags --long --always')+ fallback to'0.0.0-development', inject viadefine: { __APP_VERSION__: JSON.stringify(version) }declare const __APP_VERSION__: stringto a new filesrc/env.d.tsGotchas:
git describewill fail if there are no tags — the fallback handles thisgit describe --tags --long --alwaysoutput (trimmed) as-is; it produces a human-readable string likev0.1.0-3-gabc1234Phase 2 — Add modal infrastructure
Copy the modal utilities from coloring-book and create an adapted about modal.
src/modules/modal-utils.ts— copy verbatim from~/Documents/coloring-book/src/modules/modal-utils.tssrc/modules/about-modal.ts— adapted from coloring-book:shortcutsparameter entirelyhttps://git.kcfam.us/gtfs.zone/test-track)Gotchas:
about-modal.tsin coloring-book accepts ashortcutsarg — drop that parameter entirelyPhase 3 — Add the About button to the navbar and wire it up
src/index.htmlnavbar-end (before the theme toggle),id="about-btn",title="About"src/index.ts, importshowAboutModaland add a click listener on#about-btnthat callsshowAboutModal(__APP_VERSION__)