Skip to content

Commit 1c97224

Browse files
heisbrotEdouardVanbelle
authored andcommitted
Update os icon to match existing one and hide serial if it does not exist
1 parent b3db19e commit 1c97224

File tree

2 files changed

+29
-28
lines changed

2 files changed

+29
-28
lines changed

src/app/(dashboard)/peer/page.tsx

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ import useFetchApi from "@utils/api";
3030
import dayjs from "dayjs";
3131
import { isEmpty, trim } from "lodash";
3232
import {
33-
Cpu,
3433
Barcode,
34+
Cpu,
3535
FlagIcon,
3636
Globe,
3737
History,
@@ -431,15 +431,17 @@ function PeerInformationCard({ peer }: { peer: Peer }) {
431431
value={peer.os}
432432
/>
433433

434-
<Card.ListItem
435-
label={
436-
<>
437-
<Barcode size={16} />
438-
Serial Number
439-
</>
440-
}
441-
value={peer.serial_number}
442-
/>
434+
{peer.serial_number && peer.serial_number !== "" && (
435+
<Card.ListItem
436+
label={
437+
<>
438+
<Barcode size={16} />
439+
Serial Number
440+
</>
441+
}
442+
value={peer.serial_number}
443+
/>
444+
)}
443445

444446
<Card.ListItem
445447
label={
@@ -477,7 +479,6 @@ function PeerInformationCard({ peer }: { peer: Peer }) {
477479
}
478480
value={peer.ui_version?.replace("netbird-desktop-ui/", "")}
479481
/>
480-
481482
</Card.List>
482483
</Card>
483484
);

src/modules/peers/PeerOSCell.tsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import {
44
TooltipProvider,
55
TooltipTrigger,
66
} from "@components/Tooltip";
7-
import { Barcode, Laptop } from "lucide-react";
7+
import { Barcode, CpuIcon } from "lucide-react";
88
import Image from "next/image";
99
import React, { useMemo } from "react";
1010
import { FaWindows } from "react-icons/fa6";
@@ -15,7 +15,11 @@ import FreeBSDLogo from "@/assets/os-icons/FreeBSD.png";
1515
import { getOperatingSystem } from "@/hooks/useOperatingSystem";
1616
import { OperatingSystem } from "@/interfaces/OperatingSystem";
1717

18-
export function PeerOSCell({ os, serial }: { os: string, serial?: string }) {
18+
type Props = {
19+
os: string;
20+
serial?: string;
21+
};
22+
export function PeerOSCell({ os, serial }: Readonly<Props>) {
1923
return (
2024
<TooltipProvider>
2125
<Tooltip delayDuration={1}>
@@ -34,20 +38,17 @@ export function PeerOSCell({ os, serial }: { os: string, serial?: string }) {
3438
</div>
3539
</div>
3640
</TooltipTrigger>
37-
<TooltipContent>
38-
<ListItem
39-
icon={<Laptop size={14} />}
40-
label={"OS"}
41-
value={os}
42-
/>
43-
{ (serial !== undefined) &&
44-
<ListItem
45-
46-
icon={<Barcode size={14} />}
47-
label={"Serial"}
48-
value={serial}
49-
/>
50-
}
41+
<TooltipContent className={"!p-0"}>
42+
<div>
43+
<ListItem icon={<CpuIcon size={14} />} label={"OS"} value={os} />
44+
{serial && serial !== "" && (
45+
<ListItem
46+
icon={<Barcode size={14} />}
47+
label={"Serial Number"}
48+
value={serial}
49+
/>
50+
)}
51+
</div>
5152
</TooltipContent>
5253
</Tooltip>
5354
</TooltipProvider>
@@ -78,7 +79,6 @@ const ListItem = ({
7879
);
7980
};
8081

81-
8282
export function OSLogo({ os }: { os: string }) {
8383
const icon = useMemo(() => {
8484
return getOperatingSystem(os);

0 commit comments

Comments
 (0)