From 1c9722411f36f4d5702e16a40022e1d78aabbff3 Mon Sep 17 00:00:00 2001 From: Eduard Gert Date: Fri, 17 Jan 2025 17:07:50 +0100 Subject: [PATCH] Update os icon to match existing one and hide serial if it does not exist --- src/app/(dashboard)/peer/page.tsx | 23 +++++++++++---------- src/modules/peers/PeerOSCell.tsx | 34 +++++++++++++++---------------- 2 files changed, 29 insertions(+), 28 deletions(-) diff --git a/src/app/(dashboard)/peer/page.tsx b/src/app/(dashboard)/peer/page.tsx index 2f885a63..490d8dca 100644 --- a/src/app/(dashboard)/peer/page.tsx +++ b/src/app/(dashboard)/peer/page.tsx @@ -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, @@ -431,15 +431,17 @@ function PeerInformationCard({ peer }: { peer: Peer }) { value={peer.os} /> - - - Serial Number - - } - value={peer.serial_number} - /> + {peer.serial_number && peer.serial_number !== "" && ( + + + Serial Number + + } + value={peer.serial_number} + /> + )} - ); diff --git a/src/modules/peers/PeerOSCell.tsx b/src/modules/peers/PeerOSCell.tsx index 9daf2cb5..598d4d85 100644 --- a/src/modules/peers/PeerOSCell.tsx +++ b/src/modules/peers/PeerOSCell.tsx @@ -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"; @@ -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) { return ( @@ -34,20 +38,17 @@ export function PeerOSCell({ os, serial }: { os: string, serial?: string }) { - - } - label={"OS"} - value={os} - /> - { (serial !== undefined) && - } - label={"Serial"} - value={serial} - /> - } + +
+ } label={"OS"} value={os} /> + {serial && serial !== "" && ( + } + label={"Serial Number"} + value={serial} + /> + )} +
@@ -78,7 +79,6 @@ const ListItem = ({ ); }; - export function OSLogo({ os }: { os: string }) { const icon = useMemo(() => { return getOperatingSystem(os);