From f8fb6d93774e96ab87d33cccd4954168796ff821 Mon Sep 17 00:00:00 2001 From: Olawale880 Date: Thu, 25 Jun 2026 13:27:27 +0100 Subject: [PATCH] feat: issue has been solved --- app/frontend/src/components/PreviewBanner.tsx | 275 ++++++++++++++++++ app/frontend/src/hooks/usePreviewMetadata.ts | 170 +++++++++++ 2 files changed, 445 insertions(+) create mode 100644 app/frontend/src/components/PreviewBanner.tsx create mode 100644 app/frontend/src/hooks/usePreviewMetadata.ts diff --git a/app/frontend/src/components/PreviewBanner.tsx b/app/frontend/src/components/PreviewBanner.tsx new file mode 100644 index 000000000..22db2db38 --- /dev/null +++ b/app/frontend/src/components/PreviewBanner.tsx @@ -0,0 +1,275 @@ +"use client"; + +/** + * PreviewBanner + * + * Renders a sticky top banner that informs contributors which preview / + * testnet environment they are currently using. + * + * ┌─────────────────────────────────────────────────────────────────────────┐ + * │ 🔬 PREVIEW ENVIRONMENT — staging │ branch: feat/FE-38 │ sha: a1b2c3d │ + * └─────────────────────────────────────────────────────────────────────────┘ + * + * Guarantees: + * • Never renders in production (isPreviewEnvironment() === false). + * • Degrades gracefully — if the backend is unavailable the banner still + * shows static environment metadata resolved from env vars. + * • Accessible: uses role="banner", aria-label, and a dismiss button with + * an aria-label. + * • Respects prefers-reduced-motion via a CSS media query on the shimmer. + */ + +import { useState } from "react"; +import { usePreviewMetadata, isPreviewEnvironment } from "@/hooks/usePreviewMetadata"; + +// ─── sub-components ────────────────────────────────────────────────────────── + +function Chip({ children }: { children: React.ReactNode }) { + return ( + + {children} + + ); +} + +function Skeleton() { + return ( +