diff --git a/apps/web/src/components/layout/FoundationStatus.tsx b/apps/web/src/components/layout/FoundationStatus.tsx new file mode 100644 index 0000000..dbcb6b2 --- /dev/null +++ b/apps/web/src/components/layout/FoundationStatus.tsx @@ -0,0 +1,122 @@ +import { Badge, Tooltip, Typography } from 'antd'; +import { ApiError } from '../../lib/api-client'; +import { useApiPing } from '../../lib/queries/ping'; +import { brandTokens } from '../../lib/theme'; + +const { Text } = Typography; + +// Pill discreto de "fundação viva" — prova que API↔Web↔contrato Zod funcionam. +// Conscientemente mantido na Topbar enquanto o produto está em foundation; +// quando virar normal, vira indicador só em /health (Sandra/Daniel). +export function FoundationStatus() { + const { data, error, isPending, isFetching } = useApiPing(); + + if (isPending) { + return ( + + ); + } + + if (error) { + const detail = + error instanceof ApiError + ? `${error.problem.title}${error.problem.detail ? ` — ${error.problem.detail}` : ''}` + : error.message; + return ( + + } + /> + ); + } + + return ( + + } + /> + ); +} + +function Pill({ + color, + label, + tooltip, + pulse, +}: { + color: string; + label: string; + tooltip: React.ReactNode; + pulse?: boolean; +}) { + return ( + + + + {label} + + + ); +} + +function TooltipLines({ lines }: { lines: ReadonlyArray }) { + return ( +
+ {lines.map(([label, value]) => ( + + ))} +
+ ); +} + +function FragmentRow({ label, value }: { label: string; value: string }) { + return ( + <> + {label} + + {value} + + + ); +} diff --git a/apps/web/src/components/layout/Topbar.tsx b/apps/web/src/components/layout/Topbar.tsx index 9cab670..f0048a0 100644 --- a/apps/web/src/components/layout/Topbar.tsx +++ b/apps/web/src/components/layout/Topbar.tsx @@ -2,6 +2,7 @@ import { Avatar, Badge, Button, Flex, Input } from 'antd'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBell, faMagnifyingGlass, faBars } from '@fortawesome/free-solid-svg-icons'; import { brandTokens } from '../../lib/theme'; +import { FoundationStatus } from './FoundationStatus'; interface TopbarProps { onToggleSidebar?: () => void; @@ -84,8 +85,9 @@ export function Topbar({ onToggleSidebar }: TopbarProps) { /> - {/* Lado direito: notificações + perfil */} + {/* Lado direito: status fundação + notificações + perfil */} +