From a02579d6dd92c392ce96475251e1e5656d5f31d4 Mon Sep 17 00:00:00 2001 From: philon- Date: Sat, 3 May 2025 00:27:12 +0200 Subject: [PATCH] Minor style fixes --- src/components/Sidebar.tsx | 233 ++++++++++--------- src/components/UI/Checkbox/index.tsx | 14 +- src/components/UI/Sidebar/SidebarSection.tsx | 38 +-- 3 files changed, 154 insertions(+), 131 deletions(-) diff --git a/src/components/Sidebar.tsx b/src/components/Sidebar.tsx index caa541f48..ec41c2934 100644 --- a/src/components/Sidebar.tsx +++ b/src/components/Sidebar.tsx @@ -46,26 +46,34 @@ const CollapseToggleButton = () => { aria-label={buttonLabel} onClick={toggleSidebar} className={cn( - 'absolute top-20 right-0 z-10 p-0.5 rounded-full transform translate-x-1/2', - 'transition-colors duration-300 ease-in-out', - 'border border-slate-300 dark:border-slate-200', - 'text-slate-500 dark:text-slate-200 hover:text-slate-400 dark:hover:text-slate-400', - 'focus:outline-none focus:ring-2 focus:ring-accent transition-transform' + "absolute top-20 right-0 z-10 p-0.5 rounded-full transform translate-x-1/2", + "transition-colors duration-300 ease-in-out", + "border border-slate-300 dark:border-slate-200", + "text-slate-500 dark:text-slate-200 hover:text-slate-400 dark:hover:text-slate-400", + "focus:outline-none focus:ring-2 focus:ring-accent transition-transform bg-background-primary", )} > ); -} +}; export const Sidebar = ({ children }: SidebarProps) => { - const { hardware, getNode, getNodesLength, metadata, activePage, setActivePage, setDialogOpen } = useDevice(); + const { + hardware, + getNode, + getNodesLength, + metadata, + activePage, + setActivePage, + setDialogOpen, + } = useDevice(); const { setCommandPaletteOpen } = useAppStore(); const myNode = getNode(hardware.myNodeNum); const { isCollapsed } = useSidebar(); @@ -86,19 +94,18 @@ export const Sidebar = ({ children }: SidebarProps) => { return (
{ />

Meshtastic @@ -136,106 +143,116 @@ export const Sidebar = ({ children }: SidebarProps) => { ))} -
{children}
- {myNode === undefined ? ( -
- - - Loading... - -
- ) : ( - <> -
- -

+ + - {myNode.user?.longName} -

+ Loading... +
- -
-
- -
-
- - {myNode.deviceMetrics?.voltage?.toPrecision(3) ?? "UNK"} volts -
-
- - v{myMetadata?.firmwareVersion ?? "UNK"} + ) + : ( + <> +
+ +

+ {myNode.user?.longName} +

-
-
- - -
+
- - -
- - - )} + + + +
+ + )}

); -}; \ No newline at end of file +}; diff --git a/src/components/UI/Checkbox/index.tsx b/src/components/UI/Checkbox/index.tsx index ac6ff4419..3c673c68b 100644 --- a/src/components/UI/Checkbox/index.tsx +++ b/src/components/UI/Checkbox/index.tsx @@ -1,4 +1,4 @@ -import { useState, useEffect, useId } from "react"; +import { useEffect, useId, useState } from "react"; import { Check } from "lucide-react"; import { Label } from "@components/UI/Label.tsx"; import { cn } from "@core/utils/cn.ts"; @@ -65,13 +65,15 @@ export function Checkbox({ role="presentation" className={cn( "w-6 h-6 border-2 border-gray-500 rounded-md flex items-center justify-center", - disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", - isChecked ? "" : "" + disabled + ? "opacity-50 cursor-not-allowed" + : "cursor-pointer focus:outline-none focus:ring-2 focus:ring-blue-500 focus:ring-offset-2", + isChecked ? "" : "", )} > {isChecked && (
- +
)}
@@ -85,7 +87,7 @@ export function Checkbox({ className={cn( "text-gray-900 dark:text-gray-900", disabled ? "opacity-50 cursor-not-allowed" : "cursor-pointer", - labelClassName + labelClassName, )} > {children} @@ -95,4 +97,4 @@ export function Checkbox({ ); -} \ No newline at end of file +} diff --git a/src/components/UI/Sidebar/SidebarSection.tsx b/src/components/UI/Sidebar/SidebarSection.tsx index 1453ee2c1..7c6b9e4a7 100644 --- a/src/components/UI/Sidebar/SidebarSection.tsx +++ b/src/components/UI/Sidebar/SidebarSection.tsx @@ -16,27 +16,31 @@ export const SidebarSection = ({ }: SidebarSectionProps) => { const { isCollapsed } = useSidebar(); return ( -
- - +
+ {label} -
+
{children}
); -}; \ No newline at end of file +};