Add monoline icons to the topbar coordinates/sun readout
CI / check (push) Successful in 18s
CI / deploy (push) Successful in 13s

WAYPOINT_ICON (coords) and PENDING_ICON (countdown) reused as-is; two new
hand-drawn SUNRISE_ICON/SUNSET_ICON since NPS's symbol set has no match —
same currentColor stroke style as the rest of icons.js, so they render
monochrome in the dark topbar rather than colored emoji.

sun.js's formatSunInfo now returns {sunrise, sunset, countdown} instead of
one joined string, so map.js can place its own icon in front of each
piece instead of the module owning any markup.
This commit is contained in:
randy committed 2026-09-10 22:54:18 +02:00
1 parent b5466b53e4
commit a5adb39770
4 files changed
+63 -6

No files matched your search

+8 -3
View File
@@ -45,7 +45,9 @@ const DAY_MS = 24 * 60 * 60 * 1000;
// null when there's no sunrise/sunset to show at all — getTimes returns
// null (not Invalid Date) for both on a polar day/night, per its own
// comment in suncalc.js — the caller just hides the readout in that case
// rather than showing something misleading.
// rather than showing something misleading. Returns the three pieces
// separately (not one joined string) so the caller can put its own icon in
// front of each rather than this module owning any markup.
export function formatSunInfo(lat, lng, now = new Date()) {
const today = getTimes(now, lat, lng);
if (today.sunrise === null || today.sunset === null) return null;
@@ -61,6 +63,9 @@ export function formatSunInfo(lat, lng, now = new Date()) {
next = tomorrow.sunrise === null ? null : { label: "sunrise", at: tomorrow.sunrise };
}
const countdown = next ? ` · ${formatCountdown(next.at - now)} to ${next.label}` : "";
return `${formatTime(today.sunrise)}–${formatTime(today.sunset)}${countdown}`;
return {
sunrise: formatTime(today.sunrise),
sunset: formatTime(today.sunset),
countdown: next ? `${formatCountdown(next.at - now)} to ${next.label}` : null,
};
}