From e255ff2a513901a4976fdbd49453b72e1cfdf264 Mon Sep 17 00:00:00 2001 From: kemuru <102478601+kemuru@users.noreply.github.com> Date: Thu, 28 Nov 2024 04:03:14 +0100 Subject: [PATCH 1/6] feat: make cases cards links and create new case buttons too --- web/src/components/CasesDisplay/index.tsx | 7 +++--- .../DisputeView/DisputeCardView.tsx | 19 +++++++-------- .../DisputeView/DisputeListView.tsx | 23 ++++++++++--------- web/src/pages/Home/CourtOverview/Header.tsx | 7 +++--- 4 files changed, 30 insertions(+), 26 deletions(-) diff --git a/web/src/components/CasesDisplay/index.tsx b/web/src/components/CasesDisplay/index.tsx index f9dd77b24..5fdf19a3b 100644 --- a/web/src/components/CasesDisplay/index.tsx +++ b/web/src/components/CasesDisplay/index.tsx @@ -1,7 +1,7 @@ import React from "react"; import styled from "styled-components"; -import { useLocation, useNavigate } from "react-router-dom"; +import { Link, useLocation } from "react-router-dom"; import ArrowIcon from "svgs/icons/arrow.svg"; @@ -53,14 +53,15 @@ const CasesDisplay: React.FC = ({ className, totalPages, }) => { - const navigate = useNavigate(); const location = useLocation(); return (
{title} {location.pathname.startsWith("/cases/display/1/desc/all") ? ( - navigate(`/resolver`)} text="Create a case" Icon={ArrowIcon} /> + + + ) : null} diff --git a/web/src/components/DisputeView/DisputeCardView.tsx b/web/src/components/DisputeView/DisputeCardView.tsx index ae692da31..1027b0436 100644 --- a/web/src/components/DisputeView/DisputeCardView.tsx +++ b/web/src/components/DisputeView/DisputeCardView.tsx @@ -1,7 +1,7 @@ import React from "react"; import styled from "styled-components"; -import { useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import { Card } from "@kleros/ui-components-library"; @@ -54,15 +54,16 @@ interface IDisputeCardView { } const DisputeCardView: React.FC = ({ isLoading, ...props }) => { - const navigate = useNavigate(); return ( - navigate(`/cases/${props?.disputeID?.toString()}`)}> - - - {isLoading ? : } - - - + + + + + {isLoading ? : } + + + + ); }; diff --git a/web/src/components/DisputeView/DisputeListView.tsx b/web/src/components/DisputeView/DisputeListView.tsx index 3584ba7c0..cbecdeedb 100644 --- a/web/src/components/DisputeView/DisputeListView.tsx +++ b/web/src/components/DisputeView/DisputeListView.tsx @@ -1,7 +1,7 @@ import React from "react"; import styled from "styled-components"; -import { useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import { useAccount } from "wagmi"; import { Card } from "@kleros/ui-components-library"; @@ -56,17 +56,18 @@ interface IDisputeListView { } const DisputeListView: React.FC = (props) => { const { isDisconnected } = useAccount(); - const navigate = useNavigate(); return ( - navigate(`/cases/${props?.disputeID?.toString()}`)}> - - - - - - - - + + + + + + + + + + + ); }; diff --git a/web/src/pages/Home/CourtOverview/Header.tsx b/web/src/pages/Home/CourtOverview/Header.tsx index 2f5e4d85f..fa54bf4a2 100644 --- a/web/src/pages/Home/CourtOverview/Header.tsx +++ b/web/src/pages/Home/CourtOverview/Header.tsx @@ -3,7 +3,7 @@ import styled from "styled-components"; import { responsiveSize } from "styles/responsiveSize"; -import { useNavigate } from "react-router-dom"; +import { Link } from "react-router-dom"; import { Button } from "@kleros/ui-components-library"; @@ -22,11 +22,12 @@ const StyledH1 = styled.h1` `; const Header: React.FC = () => { - const navigate = useNavigate(); return ( Court Overview -