|
1 | 1 | import type { DeviceToolVersions as ToolVersions } from "@t3tools/contracts"; |
2 | | -import { deviceToolVersionLabels } from "@t3tools/client-runtime/state/device"; |
| 2 | +import { Popover, PopoverPopup, PopoverTitle, PopoverTrigger } from "~/components/ui/popover"; |
3 | 3 |
|
4 | 4 | export function DeviceToolVersions({ tools }: { tools: ToolVersions | undefined }) { |
5 | 5 | return ( |
6 | | - <div className="space-y-1 text-xs text-muted-foreground"> |
7 | | - {deviceToolVersionLabels(tools).map((label) => ( |
8 | | - <p key={label}>{label}</p> |
9 | | - ))} |
10 | | - </div> |
| 6 | + <Popover> |
| 7 | + <PopoverTrigger className="rounded text-xs text-muted-foreground underline decoration-muted-foreground/40 underline-offset-4 hover:text-foreground focus-visible:outline-2 focus-visible:outline-ring"> |
| 8 | + Versions |
| 9 | + </PopoverTrigger> |
| 10 | + <PopoverPopup align="end" className="w-80"> |
| 11 | + <PopoverTitle className="text-sm">Device tools</PopoverTitle> |
| 12 | + {tools ? ( |
| 13 | + <div className="mt-4 divide-y divide-border/50"> |
| 14 | + {( |
| 15 | + [ |
| 16 | + ["Device hub", tools.hub], |
| 17 | + ["Agent device", tools.agent], |
| 18 | + ] as const |
| 19 | + ).map(([name, tool]) => ( |
| 20 | + <div key={name} className="space-y-2 py-3 first:pt-0 last:pb-0"> |
| 21 | + <p className="text-xs font-medium">{name}</p> |
| 22 | + <dl className="grid grid-cols-[auto_1fr] gap-x-6 gap-y-1 text-xs"> |
| 23 | + <dt className="text-muted-foreground">Running</dt> |
| 24 | + <dd className="text-right font-mono">{tool.runningVersion ?? "Not running"}</dd> |
| 25 | + <dt className="text-muted-foreground">Required</dt> |
| 26 | + <dd className="text-right font-mono">{tool.requiredVersion}</dd> |
| 27 | + <dt className="text-muted-foreground">Installed</dt> |
| 28 | + <dd className="text-right font-mono break-words"> |
| 29 | + {tool.installedVersions.join(", ") || "None"} |
| 30 | + </dd> |
| 31 | + </dl> |
| 32 | + </div> |
| 33 | + ))} |
| 34 | + </div> |
| 35 | + ) : ( |
| 36 | + <p className="mt-3 text-xs text-muted-foreground">Versions have not been checked.</p> |
| 37 | + )} |
| 38 | + </PopoverPopup> |
| 39 | + </Popover> |
11 | 40 | ); |
12 | 41 | } |
0 commit comments