From 87495cf7fb508240a00b19a215f1a043c61fbff5 Mon Sep 17 00:00:00 2001 From: Ian Paschal Date: Sun, 3 Aug 2025 17:03:21 +0200 Subject: [PATCH] fix: Dashboard match results card create button --- .../MatchResultsCard/MatchResultsCard.tsx | 79 ++++++++++--------- 1 file changed, 42 insertions(+), 37 deletions(-) diff --git a/src/pages/DashboardPage/components/MatchResultsCard/MatchResultsCard.tsx b/src/pages/DashboardPage/components/MatchResultsCard/MatchResultsCard.tsx index 9c95dfa5..8566df14 100644 --- a/src/pages/DashboardPage/components/MatchResultsCard/MatchResultsCard.tsx +++ b/src/pages/DashboardPage/components/MatchResultsCard/MatchResultsCard.tsx @@ -7,6 +7,7 @@ import { ScrollArea } from '~/components/generic/ScrollArea'; import { Separator } from '~/components/generic/Separator'; import { Spinner } from '~/components/generic/Spinner'; import { MatchResultCard } from '~/components/MatchResultCard'; +import { MatchResultCreateDialog, useMatchResultCreateDialog } from '~/components/MatchResultCreateDialog'; import { useGetMatchResults } from '~/services/matchResults'; import { PATHS } from '~/settings'; @@ -21,54 +22,58 @@ export const MatchResultsCard = ({ }: MatchResultsCardProps): JSX.Element => { const navigate = useNavigate(); const { data: matchResults, loading } = useGetMatchResults({}); + const { open } = useMatchResultCreateDialog(); const handleViewMore = (): void => { navigate(PATHS.matchResults); }; const handleCreate = (): void => { - navigate(PATHS.tournamentCreate); + open(); }; return ( -
- {loading ? ( -
- Loading... -
- ) : ( - <> -
-

- Recent Matches -

-
- -
+ <> +
+ {loading ? ( +
+ Loading...
- - {(matchResults ?? []).length ? ( - -
- {(matchResults ?? []).map((matchResult) => ( - - ))} -
- -
+ ) : ( + <> +
+

+ Recent Matches +

+
+
- - ) : ( -
-
- )} - - )} -
+ + {(matchResults ?? []).length ? ( + +
+ {(matchResults ?? []).map((matchResult) => ( + + ))} +
+ +
+
+
+ ) : ( +
+ +
+ )} + + )} +
+ + ); };