Connection status in the top bar, as SilverBullet does

- The top bar (and the phone's status bar) turns red when the server
  can't be reached: the device is offline, or a request failed (signal
  but no internet, or the proxy answering for the app). While red it
  checks /up every 15 seconds and turns back on its own.
- A ring fills while pages are saved for offline use or flights and
  squawks logged offline are sent, with the percentage in its middle,
  and hides when done. While some wait to send, it's amber with how many.

Checked on an Android 14 emulator: airplane mode on and off, saving for
offline, and a flight logged offline then sent.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
rickyandClaude Opus 5.5 committed 2026-11-15 13:15:50 -05:00
1 parent 66fa5f4423
commit d9de1be562
7 files changed
+220 -13

No files matched your search

+31
View File
@@ -5,6 +5,7 @@
--color-page: oklch(96.8% 0.007 247.896); /* slate-100 */
--color-surface: oklch(100% 0 0); /* white: cards, inputs, menus */
--color-header: oklch(20.8% 0.042 265.755); /* slate-900: top bar, dark in both themes */
--color-header-offline: oklch(50.5% 0.213 27.518); /* red-700: top bar when the server can't be reached */
--color-accent: oklch(50% 0.134 242.749); /* sky-700: primary buttons */
--color-accent-hover: oklch(44.3% 0.11 240.79); /* sky-800 */
}
@@ -62,6 +63,7 @@
--color-page: oklch(15.5% 0.035 264);
--color-surface: oklch(20.8% 0.042 265.755);
--color-header: oklch(12.9% 0.042 264.695);
--color-header-offline: oklch(44.4% 0.177 26.899); /* red-800 */
--color-accent: oklch(50% 0.134 242.749); /* same blue: white text stays ≥ 4.5:1 */
--color-accent-hover: oklch(54% 0.15 242);
@@ -190,3 +192,32 @@
@apply grid grid-cols-[6.5rem_minmax(0,1fr)] items-baseline gap-x-3;
& > dt { @apply text-slate-500; }
}
/* The top bar's connection status (connection_controller.js, after
SilverBullet): red when the server can't be reached, and a ring that fills
with the percentage in its hole while saving for offline or sending. Amber
and full while flights or squawks wait to send, with how many. */
header.is-offline { --color-header: var(--color-header-offline); }
.sync-ring {
position: relative;
display: inline-block;
flex: none;
width: 24px;
height: 24px;
border-radius: 9999px;
background: conic-gradient(var(--ring-color, white) var(--progress, 0%), rgb(255 255 255 / 0.25) 0);
}
.sync-ring[hidden] { display: none; }
.sync-ring.is-waiting { --ring-color: oklch(87.9% 0.169 91.605); } /* amber-300 */
.sync-ring > span {
position: absolute;
inset: 2.5px;
display: flex;
align-items: center;
justify-content: center;
border-radius: 9999px;
background-color: var(--color-header);
font-size: 9px;
font-variant-numeric: tabular-nums;
line-height: 1;
}