Files
maptool/views/index.erb
T
randy dce5fd87da Add a Locus Pro-style toolbar readout: DMS coords + sunrise/sunset
The topbar's coordinate display was plain decimal degrees ("48.14611,
17.17722") — switched to DMS (48°08'46"N 17°10'38"E), the more
GPS-unit-like format Locus Pro itself uses, and made it click-to-copy
(plain decimal, since that's what pastes cleanly into another map/GPS
app — not the DMS text actually shown).

Added sunrise/sunset + a countdown to whichever's next, for the same
map-center point the coordinates already describe. Vendored SunCalc
(BSD-2-Clause, github.com/mourner/suncalc) rather than hand-rolling
the astronomical math — small, dependency-free, and correctness here
has real pitfalls (equation of time, refraction, polar day/night) a
first-pass reimplementation would risk getting subtly wrong.

Also added a test asserting every public/js/*.js module has a
versioned importmap entry in layout.erb — caught that overlays.js
(from the previous commit) was missing one, which would have quietly
skipped ASSET_VERSION's cache-busting for that file after every
deploy.
2026-09-10 21:08:02 +02:00

94 lines
3.3 KiB
ERB

<div id="app">
<header class="topbar">
<span class="topbar__brand" title="rev <%= revision %>">MapTool</span>
<span class="topbar__center">
<span class="topbar__coords"></span>
<span class="topbar__sun" hidden></span>
</span>
<span class="topbar__offline-status" hidden></span>
<div class="topbar__auth">
<% if logged_in %>
<span><%= user %></span>
<a href="/logout">Log out</a>
<% else %>
<a href="/login">Log in</a>
<% end %>
</div>
</header>
<div class="app-body">
<nav id="sidebar" class="sidebar"></nav>
<div id="map"></div>
</div>
</div>
<div id="profile-panel" class="profile-panel" hidden>
<div class="profile-panel__header">
<strong class="profile-panel__title"></strong>
<span class="profile-panel__stats"></span>
<button type="button" class="profile-panel__close" aria-label="Close">&times;</button>
</div>
<div class="profile-panel__charts"></div>
</div>
<div id="basemap-panel" class="basemap-panel" hidden>
<div class="basemap-panel__header">
<strong>Base map</strong>
<button type="button" class="basemap-panel__close" aria-label="Close">&times;</button>
</div>
<div class="basemap-panel__list">
<button type="button" class="basemap-panel__option" data-style="online">
<span>Online</span>
<span class="basemap-panel__check">&check;</span>
</button>
<button type="button" class="basemap-panel__option" data-style="offline">
<span>Offline</span>
<span class="basemap-panel__check">&check;</span>
</button>
</div>
</div>
<div id="gpx-panel" class="gpx-panel" hidden>
<div class="gpx-panel__header">
<strong>Tracks &amp; Points</strong>
<div class="gpx-panel__actions">
<button type="button" class="gpx-panel__action" data-action="new-folder" title="New folder" aria-label="New folder"></button>
<button type="button" class="gpx-panel__action" data-action="upload" title="Upload GPX/FIT/GeoJSON file" aria-label="Upload GPX/FIT/GeoJSON file"></button>
<button type="button" class="gpx-panel__close" aria-label="Close">&times;</button>
</div>
</div>
<input type="file" class="gpx-file-input" accept=".gpx,.fit,.geojson,.zip" multiple hidden>
<p class="gpx-upload__status" hidden></p>
<div class="gpx-tree"></div>
<div class="gpx-legend" hidden></div>
</div>
<div id="overlays-panel" class="basemap-panel" hidden>
<div class="basemap-panel__header">
<strong>Overlays</strong>
<button type="button" class="basemap-panel__close" aria-label="Close">&times;</button>
</div>
<!-- Each item is a live layer refetched from its own source as the map
moves, not a file to add/remove/reorder — a plain on/off list, no
upload/new-folder actions the way Tracks & Points has. Wikipedia is
the first; see public/js/overlays.js for how one of these works. -->
<ul class="overlays-panel__list">
<li class="overlays-panel__item">
<label>
<input type="checkbox" class="overlays-panel__wiki-toggle">
<span>Wikipedia</span>
</label>
</li>
</ul>
</div>
<div id="livetrack-panel" class="basemap-panel" hidden>
<div class="basemap-panel__header">
<strong>LiveTrack sessions</strong>
<button type="button" class="basemap-panel__close" aria-label="Close">&times;</button>
</div>
<ul class="livetrack-panel__list"></ul>
</div>