From c08f2aa0ff16efb43d9129290984784803841750 Mon Sep 17 00:00:00 2001 From: Henrichy Date: Mon, 29 Jun 2026 18:56:36 +0100 Subject: [PATCH 1/4] fix: improve StreamDetailsModal accessibility by using useModalDialog --- .../dashboard/StreamDetailsModal.tsx | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/frontend/src/components/dashboard/StreamDetailsModal.tsx b/frontend/src/components/dashboard/StreamDetailsModal.tsx index e960fc21..999891c2 100644 --- a/frontend/src/components/dashboard/StreamDetailsModal.tsx +++ b/frontend/src/components/dashboard/StreamDetailsModal.tsx @@ -1,7 +1,8 @@ "use client"; -import React, { useEffect } from "react"; +import React from "react"; import { Button } from "@/components/ui/Button"; +import { useModalDialog } from "@/hooks/useModalDialog"; import type { Stream } from "@/lib/dashboard"; interface StreamDetailsModalProps { @@ -17,14 +18,7 @@ export const StreamDetailsModal: React.FC = ({ onCancelClick, onTopUpClick, }) => { - // Escape key support - useEffect(() => { - const handleEscape = (e: KeyboardEvent) => { - if (e.key === "Escape") onClose(); - }; - window.addEventListener("keydown", handleEscape); - return () => window.removeEventListener("keydown", handleEscape); - }, [onClose]); + const dialogRef = useModalDialog({ onClose }); const progress = stream.deposited > 0 ? Math.min(100, Math.max(0, (stream.withdrawn / stream.deposited) * 100)) : 0; const remaining = stream.deposited - stream.withdrawn; @@ -32,15 +26,21 @@ export const StreamDetailsModal: React.FC = ({ return (
{ if (e.target === e.currentTarget) onClose(); }} > -
+
{/* Header */}
-

Stream Details

+

Stream Details

ID: {stream.id}

- - {status !== "connected" && ( -

- Please connect your wallet to create a stream. -

- )} - -
-
- ); } diff --git a/frontend/src/components/dashboard/dashboard-view.tsx b/frontend/src/components/dashboard/dashboard-view.tsx index 9247431c..3bbc810c 100644 --- a/frontend/src/components/dashboard/dashboard-view.tsx +++ b/frontend/src/components/dashboard/dashboard-view.tsx @@ -108,11 +108,8 @@ const SIDEBAR_ITEMS: SidebarItem[] = [ /** Shimmer card used as a placeholder while data loads */ function SkeletonCard({ className = "" }: { className?: string }) { return ( -