From 690d4dec30b58131af02d64fb176cb62f1bcefc6 Mon Sep 17 00:00:00 2001 From: Dogukan Tatar Date: Sat, 2 May 2026 20:31:16 +0300 Subject: [PATCH] fix: polish PageSpeed accessibility warnings --- frontend/components/layout/AppShell.tsx | 15 ++++-- frontend/components/layout/TopBar.tsx | 10 ++-- frontend/components/requests/RequestList.tsx | 49 +++++------------- .../requests/RequestListClearAction.tsx | 50 +++++++++++++++++++ .../requests/RequestListEmptyState.tsx | 11 ++-- frontend/components/ui/toggle-group.tsx | 1 + nginx/hooktray.conf.template | 14 ++++++ 7 files changed, 101 insertions(+), 49 deletions(-) create mode 100644 frontend/components/requests/RequestListClearAction.tsx diff --git a/frontend/components/layout/AppShell.tsx b/frontend/components/layout/AppShell.tsx index c38751b..18884ea 100644 --- a/frontend/components/layout/AppShell.tsx +++ b/frontend/components/layout/AppShell.tsx @@ -1,13 +1,22 @@ "use client" +import dynamic from "next/dynamic" import { ChevronLeft } from "lucide-react" import { Button } from "@/components/ui/button" import { useRequestStore } from "@/store/requestStore" import { useConnectionStore } from "@/store/connectionStore" import TopBar from "./TopBar" import RequestList from "@/components/requests/RequestList" -import RequestDetail from "@/components/requests/RequestDetail" import SignalPulseEmptyState from "@/components/requests/SignalPulseEmptyState" +const RequestDetail = dynamic(() => import("@/components/requests/RequestDetail"), { + ssr: false, + loading: () => ( +
+ Loading request... +
+ ), +}) + export default function AppShell() { const { requests, selectedId, selectRequest } = useRequestStore() const { token } = useConnectionStore() @@ -17,7 +26,7 @@ export default function AppShell() {
-
+
@@ -52,7 +61,7 @@ export default function AppShell() { ) )}
-
+
) } diff --git a/frontend/components/layout/TopBar.tsx b/frontend/components/layout/TopBar.tsx index e47dd5d..d23ca31 100644 --- a/frontend/components/layout/TopBar.tsx +++ b/frontend/components/layout/TopBar.tsx @@ -14,9 +14,13 @@ import { useTheme } from "@/app/providers" import type { Theme } from "@/types" const STATUS_CONFIG = { - connected: { label: "Connected", dot: "●", color: "text-green-500" }, - reconnecting: { label: "Reconnecting", dot: "◌", color: "text-yellow-500 animate-pulse" }, - disconnected: { label: "Disconnected", dot: "○", color: "text-red-500" }, + connected: { label: "Connected", dot: "●", color: "text-green-700 dark:text-green-400" }, + reconnecting: { + label: "Reconnecting", + dot: "◌", + color: "text-amber-700 dark:text-amber-300", + }, + disconnected: { label: "Disconnected", dot: "○", color: "text-red-700 dark:text-red-400" }, } as const const GITHUB_URL = "https://github.com/dgknttr/hooktray" diff --git a/frontend/components/requests/RequestList.tsx b/frontend/components/requests/RequestList.tsx index 3e60c32..e0fcdcd 100644 --- a/frontend/components/requests/RequestList.tsx +++ b/frontend/components/requests/RequestList.tsx @@ -1,24 +1,18 @@ "use client" +import dynamic from "next/dynamic" import { useRef, useEffect } from "react" import { ToggleGroup, ToggleGroupItem } from "@/components/ui/toggle-group" -import { - AlertDialog, - AlertDialogAction, - AlertDialogCancel, - AlertDialogContent, - AlertDialogDescription, - AlertDialogFooter, - AlertDialogHeader, - AlertDialogTitle, - AlertDialogTrigger, -} from "@/components/ui/alert-dialog" -import { Button } from "@/components/ui/button" import { useRequestStore } from "@/store/requestStore" import { useConnectionStore } from "@/store/connectionStore" import RequestListItem from "./RequestListItem" import RequestListEmptyState from "./RequestListEmptyState" import type { MethodFilter } from "@/types" +const RequestListClearAction = dynamic(() => import("./RequestListClearAction"), { + ssr: false, + loading: () => null, +}) + const FILTERS: MethodFilter[] = ["ALL", "GET", "POST", "PUT", "PATCH", "DELETE"] const FILTER_LABELS: Record = { ALL: "All", @@ -30,7 +24,7 @@ const FILTER_LABELS: Record = { } export default function RequestList() { - const { requests, selectedId, filter, autoScroll, selectRequest, setFilter, setAutoScroll, clearHistory } = + const { requests, selectedId, filter, autoScroll, selectRequest, setFilter, setAutoScroll } = useRequestStore() const { token } = useConnectionStore() @@ -52,6 +46,7 @@ export default function RequestList() {
{ const last = v[v.length - 1] as MethodFilter | undefined if (last) setFilter(last) @@ -76,27 +71,7 @@ export default function RequestList() { Auto-scroll - - } - > - Clear - - - - Clear local history? - - This only clears requests stored in this browser. - - - - Cancel - token && clearHistory(token)}> - Clear - - - - + {requests.length > 0 ? : null}
@@ -123,18 +98,18 @@ export default function RequestList() {
- HookTray + HookTray
GitHub · - Open source + Open source
diff --git a/frontend/components/requests/RequestListClearAction.tsx b/frontend/components/requests/RequestListClearAction.tsx new file mode 100644 index 0000000..8cd3721 --- /dev/null +++ b/frontend/components/requests/RequestListClearAction.tsx @@ -0,0 +1,50 @@ +"use client" +import { + AlertDialog, + AlertDialogAction, + AlertDialogCancel, + AlertDialogContent, + AlertDialogDescription, + AlertDialogFooter, + AlertDialogHeader, + AlertDialogTitle, + AlertDialogTrigger, +} from "@/components/ui/alert-dialog" +import { Button } from "@/components/ui/button" +import { useConnectionStore } from "@/store/connectionStore" +import { useRequestStore } from "@/store/requestStore" + +export default function RequestListClearAction() { + const { clearHistory } = useRequestStore() + const { token } = useConnectionStore() + + return ( + + + } + > + Clear + + + + Clear local history? + + This only clears requests stored in this browser. + + + + Cancel + token && clearHistory(token)}> + Clear + + + + + ) +} diff --git a/frontend/components/requests/RequestListEmptyState.tsx b/frontend/components/requests/RequestListEmptyState.tsx index 5cd3982..3d51fba 100644 --- a/frontend/components/requests/RequestListEmptyState.tsx +++ b/frontend/components/requests/RequestListEmptyState.tsx @@ -2,9 +2,9 @@ import { Inbox, Rows3 } from "lucide-react" const PLACEHOLDER_ROWS = [ - { number: "#3", method: "POST", path: "/webhooks/order" }, - { number: "#2", method: "GET", path: "/health/check" }, - { number: "#1", method: "POST", path: "/stripe/events" }, + { number: "#3", method: "POST", path: "/webhooks/order", surface: "bg-background/90" }, + { number: "#2", method: "GET", path: "/health/check", surface: "bg-muted/30" }, + { number: "#1", method: "POST", path: "/stripe/events", surface: "bg-muted/20" }, ] export default function RequestListEmptyState() { @@ -27,11 +27,10 @@ export default function RequestListEmptyState() {