Files
storybid/packages/client/src/components/ConnectivityBanner.tsx
T

27 lines
799 B
TypeScript
Raw Normal View History

2026-05-02 20:14:15 -05:00
/**
* Thin connectivity banner — used on pages outside the BidderLayout shell
* (auth pages, staff tools, display board).
*
* Hidden when fully connected.
*/
2026-05-02 19:46:42 -05:00
import { useConnectivityStore } from "../store/connectivity.js";
2026-05-02 20:14:15 -05:00
const CONFIGS = {
local: { bg: "bg-gold-500", text: "Local network — offline-capable" },
offline: { bg: "bg-red-500", text: "Offline — bids will sync when reconnected" },
} as const;
2026-05-02 19:46:42 -05:00
export function ConnectivityBanner() {
const status = useConnectivityStore((s) => s.status);
if (status === "connected") return null;
2026-05-02 20:14:15 -05:00
const cfg = CONFIGS[status as keyof typeof CONFIGS];
if (!cfg) return null;
2026-05-02 19:46:42 -05:00
return (
2026-05-02 20:14:15 -05:00
<div className={`${cfg.bg} text-white text-center text-xs py-1.5 px-4 font-semibold tracking-wide`}>
{cfg.text}
2026-05-02 19:46:42 -05:00
</div>
);
}