Skip to content
Source
Sign inSign up
TanStack/form
Open History to see the last commit

BridgeStatusBadge.tsx

30 lines928 Bytes

1import { Match, Switch } from 'solid-js'
2import { Badge } from '../ui/badge'
3import { useFormDevtoolsStore } from '@/stores/formDevtoolsStore'
4​
5export function BridgeStatusBadge() {
6 const { bridgeStatus, bridgeMountedFormCount } =
7 useFormDevtoolsStore().formSelector
8​
9 return (
10 <Switch>
11 <Match when={bridgeStatus() === 'checking'}>
12 <Badge variant="outline" role="status" class="mt-1">
13 Checking form bridge…
14 </Badge>
15 </Match>
16 <Match when={bridgeStatus() === 'unavailable'}>
17 <Badge variant="destructive" role="status" class="mt-1">
18 Form bridge not connected
19 </Badge>
20 </Match>
21 <Match
22 when={bridgeStatus() === 'connected' && bridgeMountedFormCount() === 0}
23 >
24 <Badge variant="destructive" role="status" class="mt-1">
25 Bridge connected · no mounted forms
26 </Badge>
27 </Match>
28 </Switch>
29 )