From b6005332e8c4de426214ee44ac3b290f6e5379fd Mon Sep 17 00:00:00 2001 From: Adam Shiervani Date: Tue, 20 May 2025 13:50:00 +0200 Subject: [PATCH] style(ui): refine component styling and layout - Add padding to AutoHeight component - Improve lifetime label display format - Enhance network information card layouts --- ui/src/components/AutoHeight.tsx | 2 +- .../routes/devices.$id.settings.network.tsx | 362 +++--------------- 2 files changed, 63 insertions(+), 301 deletions(-) diff --git a/ui/src/components/AutoHeight.tsx b/ui/src/components/AutoHeight.tsx index fbcf9cf..75fda8a 100644 --- a/ui/src/components/AutoHeight.tsx +++ b/ui/src/components/AutoHeight.tsx @@ -22,7 +22,7 @@ const AutoHeight = ({ children, ...props }: { children: React.ReactNode }) => { {...props} height={height} duration={300} - contentClassName="h-fit" + contentClassName="h-fit p-px" contentRef={contentDiv} disableDisplayNone > diff --git a/ui/src/routes/devices.$id.settings.network.tsx b/ui/src/routes/devices.$id.settings.network.tsx index aebcd03..b15b029 100644 --- a/ui/src/routes/devices.$id.settings.network.tsx +++ b/ui/src/routes/devices.$id.settings.network.tsx @@ -1,7 +1,7 @@ import { useCallback, useEffect, useRef, useState } from "react"; import dayjs from "dayjs"; import relativeTime from "dayjs/plugin/relativeTime"; -import { ArrowPathIcon } from "@heroicons/react/24/outline"; +import { LuEthernetPort } from "react-icons/lu"; import { IPv4Mode, @@ -23,6 +23,11 @@ import Fieldset from "@/components/Fieldset"; import { ConfirmDialog } from "@/components/ConfirmDialog"; import notifications from "@/notifications"; +import Ipv6NetworkCard from "../components/Ipv6NetworkCard"; +import EmptyCard from "../components/EmptyCard"; +import AutoHeight from "../components/AutoHeight"; +import DhcpLeaseCard from "../components/DhcpLeaseCard"; + import { SettingsItem } from "./devices.$id.settings"; dayjs.extend(relativeTime); @@ -56,15 +61,11 @@ export function LifeTimeLabel({ lifetime }: { lifetime: string }) { return ( <> - {dayjs(lifetime).format("YYYY-MM-DD HH:mm")} - {remaining && ( - <> - {" "} - - ({remaining}) - - - )} + {remaining && <> {remaining}} + + {" "} + ({dayjs(lifetime).format("YYYY-MM-DD HH:mm")}) + ); } @@ -171,10 +172,6 @@ export default function SettingsNetworkRoute() { setNetworkSettings({ ...networkSettings, lldp_mode: value as LLDPMode }); }; - // const handleLldpTxTlvsChange = (value: string[]) => { - // setNetworkSettings({ ...networkSettings, lldp_tx_tlvs: value }); - // }; - const handleMdnsModeChange = (value: mDNSMode | string) => { setNetworkSettings({ ...networkSettings, mdns_mode: value as mDNSMode }); }; @@ -288,7 +285,7 @@ export default function SettingsNetworkRoute() {