Skip to content

Commit 9354549

Browse files
fix(web): put device version details behind a compact control
1 parent 544eaf3 commit 9354549

1 file changed

Lines changed: 35 additions & 6 deletions

File tree

Lines changed: 35 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,41 @@
11
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";
33

44
export function DeviceToolVersions({ tools }: { tools: ToolVersions | undefined }) {
55
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>
1140
);
1241
}

0 commit comments

Comments
 (0)