Skip to content

Commit

Permalink
Update os icon to match existing one and hide serial if it does not e…
Browse files Browse the repository at this point in the history
…xist
  • Loading branch information
heisbrot authored and EdouardVanbelle committed Jan 29, 2025
1 parent b3db19e commit 1c97224
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
23 changes: 12 additions & 11 deletions src/app/(dashboard)/peer/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ import useFetchApi from "@utils/api";
import dayjs from "dayjs";
import { isEmpty, trim } from "lodash";
import {
Cpu,
Barcode,
Cpu,
FlagIcon,
Globe,
History,
Expand Down Expand Up @@ -431,15 +431,17 @@ function PeerInformationCard({ peer }: { peer: Peer }) {
value={peer.os}
/>

<Card.ListItem
label={
<>
<Barcode size={16} />
Serial Number
</>
}
value={peer.serial_number}
/>
{peer.serial_number && peer.serial_number !== "" && (
<Card.ListItem
label={
<>
<Barcode size={16} />
Serial Number
</>
}
value={peer.serial_number}
/>
)}

<Card.ListItem
label={
Expand Down Expand Up @@ -477,7 +479,6 @@ function PeerInformationCard({ peer }: { peer: Peer }) {
}
value={peer.ui_version?.replace("netbird-desktop-ui/", "")}
/>

</Card.List>
</Card>
);
Expand Down
34 changes: 17 additions & 17 deletions src/modules/peers/PeerOSCell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
TooltipProvider,
TooltipTrigger,
} from "@components/Tooltip";
import { Barcode, Laptop } from "lucide-react";
import { Barcode, CpuIcon } from "lucide-react";
import Image from "next/image";
import React, { useMemo } from "react";
import { FaWindows } from "react-icons/fa6";
Expand All @@ -15,7 +15,11 @@ import FreeBSDLogo from "@/assets/os-icons/FreeBSD.png";
import { getOperatingSystem } from "@/hooks/useOperatingSystem";
import { OperatingSystem } from "@/interfaces/OperatingSystem";

export function PeerOSCell({ os, serial }: { os: string, serial?: string }) {
type Props = {
os: string;
serial?: string;
};
export function PeerOSCell({ os, serial }: Readonly<Props>) {
return (
<TooltipProvider>
<Tooltip delayDuration={1}>
Expand All @@ -34,20 +38,17 @@ export function PeerOSCell({ os, serial }: { os: string, serial?: string }) {
</div>
</div>
</TooltipTrigger>
<TooltipContent>
<ListItem
icon={<Laptop size={14} />}
label={"OS"}
value={os}
/>
{ (serial !== undefined) &&
<ListItem

icon={<Barcode size={14} />}
label={"Serial"}
value={serial}
/>
}
<TooltipContent className={"!p-0"}>
<div>
<ListItem icon={<CpuIcon size={14} />} label={"OS"} value={os} />
{serial && serial !== "" && (
<ListItem
icon={<Barcode size={14} />}
label={"Serial Number"}
value={serial}
/>
)}
</div>
</TooltipContent>
</Tooltip>
</TooltipProvider>
Expand Down Expand Up @@ -78,7 +79,6 @@ const ListItem = ({
);
};


export function OSLogo({ os }: { os: string }) {
const icon = useMemo(() => {
return getOperatingSystem(os);
Expand Down

0 comments on commit 1c97224

Please sign in to comment.