From 05a9f2e461e8c0201fedb81583fd86e426010fd2 Mon Sep 17 00:00:00 2001 From: Daniel Pupius Date: Tue, 22 Apr 2025 22:08:49 -0700 Subject: [PATCH] More UI tweaks --- web/src/components/PageWrapper.tsx | 25 +++++++++++++++++++++++ web/src/components/index.ts | 3 ++- web/src/components/packets/PacketCard.tsx | 20 ++++++++---------- web/src/routes/home.tsx | 13 +++++------- web/src/routes/packets.tsx | 11 ++++------ web/src/styles/index.css | 20 +++++++++++++----- 6 files changed, 59 insertions(+), 33 deletions(-) create mode 100644 web/src/components/PageWrapper.tsx diff --git a/web/src/components/PageWrapper.tsx b/web/src/components/PageWrapper.tsx new file mode 100644 index 0000000..941076e --- /dev/null +++ b/web/src/components/PageWrapper.tsx @@ -0,0 +1,25 @@ +import React, { ReactNode } from "react"; + +interface PageWrapperProps { + children: ReactNode; + title?: string; +} + +/** + * A consistent page wrapper component for all leaf routes + */ +export const PageWrapper: React.FC = ({ + children, + title, +}) => { + return ( +
+ {title && ( +

{title}

+ )} +
+ {children} +
+
+ ); +}; diff --git a/web/src/components/index.ts b/web/src/components/index.ts index 3d4bc43..eb0cb6c 100644 --- a/web/src/components/index.ts +++ b/web/src/components/index.ts @@ -6,4 +6,5 @@ export * from './InfoMessage'; export * from './ConnectionStatus'; export * from './Nav'; export * from './Separator'; -export * from './StreamControl'; \ No newline at end of file +export * from './StreamControl'; +export * from './PageWrapper'; \ No newline at end of file diff --git a/web/src/components/packets/PacketCard.tsx b/web/src/components/packets/PacketCard.tsx index f96ac75..2f28d60 100644 --- a/web/src/components/packets/PacketCard.tsx +++ b/web/src/components/packets/PacketCard.tsx @@ -1,6 +1,5 @@ import React, { ReactNode } from "react"; import { Packet } from "../../lib/types"; -import { LucideIcon } from "lucide-react"; interface PacketCardProps { packet: Packet; @@ -20,29 +19,26 @@ export const PacketCard: React.FC = ({ const { data } = packet; return ( -
+
-
- {icon} -
+
{icon}
- From: {data.from ? `!${data.from.toString(16).toLowerCase()}` : "Unknown"} + From:{" "} + {data.from ? `!${data.from.toString(16).toLowerCase()}` : "Unknown"}
ID: {data.id || "No ID"}
- -
- {children} -
- + +
{children}
+
Channel: {packet.info.channel} {label}
); -}; \ No newline at end of file +}; diff --git a/web/src/routes/home.tsx b/web/src/routes/home.tsx index 0ca2975..28ed040 100644 --- a/web/src/routes/home.tsx +++ b/web/src/routes/home.tsx @@ -1,13 +1,10 @@ -import { InfoMessage, Separator } from "../components"; +import { InfoMessage, Separator, PageWrapper } from "../components"; import { SITE_TITLE } from "../lib/config"; export function IndexPage() { return ( -
-
-

- Welcome to {SITE_TITLE} -

+ +

This application provides a real-time view of Meshtastic network traffic. @@ -21,7 +18,7 @@ export function IndexPage() { -

+

About Meshtastic @@ -43,6 +40,6 @@ export function IndexPage() {

-
+ ); } \ No newline at end of file diff --git a/web/src/routes/packets.tsx b/web/src/routes/packets.tsx index ff229dd..ddf7f4f 100644 --- a/web/src/routes/packets.tsx +++ b/web/src/routes/packets.tsx @@ -1,7 +1,6 @@ import { useEffect } from "react"; import { useAppDispatch } from "../hooks"; -import { PacketList } from "../components/PacketList"; -import { InfoMessage, Separator } from "../components"; +import { PacketList, PageWrapper } from "../components"; import { addPacket } from "../store/slices/packetSlice"; import { streamPackets, StreamEvent } from "../lib/api"; @@ -25,10 +24,8 @@ export function PacketsRoute() { }, [dispatch]); return ( -
-
- -
-
+ + + ); } diff --git a/web/src/styles/index.css b/web/src/styles/index.css index 115ddec..63cdc7e 100644 --- a/web/src/styles/index.css +++ b/web/src/styles/index.css @@ -22,10 +22,20 @@ @layer utilities { .border-inset { @apply border-1; - @apply border-b-neutral-700; - @apply border-r-neutral-700; - @apply border-t-neutral-950; - @apply border-l-neutral-950; - @apply rounded-sm; + @apply border-b-neutral-400/30; + @apply border-r-neutral-400/30; + @apply border-t-neutral-950/60; + @apply border-l-neutral-950/60; + @apply rounded-md; + @apply shadow-md; + } + .border-outset { + @apply border-1; + @apply border-t-neutral-300/30; + @apply border-l-neutral-300/30; + @apply border-b-neutral-950/60; + @apply border-r-neutral-950/60; + @apply rounded-md; + @apply shadow-md; } } \ No newline at end of file