aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/client/components/OfflineBanner.tsx
diff options
context:
space:
mode:
authornsfisis <nsfisis@gmail.com>2025-12-07 23:41:28 +0900
committernsfisis <nsfisis@gmail.com>2025-12-07 23:41:28 +0900
commitf0635f9beb0ff85bbea2264a1b19160f0beed257 (patch)
tree8e7be36100a8de5dcd7301c5e7be91f2ddfdbc0c /src/client/components/OfflineBanner.tsx
parent445781bc40afee2c64f645abcfa2575b4218aa08 (diff)
downloadkioku-f0635f9beb0ff85bbea2264a1b19160f0beed257.tar.gz
kioku-f0635f9beb0ff85bbea2264a1b19160f0beed257.tar.zst
kioku-f0635f9beb0ff85bbea2264a1b19160f0beed257.zip
feat(client): add offline mode banner indicator
Displays a prominent banner at the top of all pages when the user is offline, informing them that changes will sync when reconnected. Shows pending change count when applicable. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Diffstat (limited to 'src/client/components/OfflineBanner.tsx')
-rw-r--r--src/client/components/OfflineBanner.tsx39
1 files changed, 39 insertions, 0 deletions
diff --git a/src/client/components/OfflineBanner.tsx b/src/client/components/OfflineBanner.tsx
new file mode 100644
index 0000000..357db33
--- /dev/null
+++ b/src/client/components/OfflineBanner.tsx
@@ -0,0 +1,39 @@
+import { useSync } from "../stores";
+
+export function OfflineBanner() {
+ const { isOnline, pendingCount } = useSync();
+
+ if (isOnline) {
+ return null;
+ }
+
+ return (
+ <div
+ data-testid="offline-banner"
+ role="status"
+ aria-live="polite"
+ style={{
+ backgroundColor: "#6c757d",
+ color: "white",
+ padding: "0.5rem 1rem",
+ textAlign: "center",
+ fontSize: "0.875rem",
+ display: "flex",
+ alignItems: "center",
+ justifyContent: "center",
+ gap: "0.5rem",
+ }}
+ >
+ <span aria-hidden="true">âš¡</span>
+ <span>
+ You're offline. Changes will sync when you reconnect.
+ {pendingCount > 0 && (
+ <span data-testid="offline-pending-count">
+ {" "}
+ ({pendingCount} pending)
+ </span>
+ )}
+ </span>
+ </div>
+ );
+}