Skip to content

Commit e255ff2

Browse files
committed
feat: make cases cards links and create new case buttons too
1 parent 71ac556 commit e255ff2

File tree

4 files changed

+30
-26
lines changed

4 files changed

+30
-26
lines changed

web/src/components/CasesDisplay/index.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import styled from "styled-components";
33

4-
import { useLocation, useNavigate } from "react-router-dom";
4+
import { Link, useLocation } from "react-router-dom";
55

66
import ArrowIcon from "svgs/icons/arrow.svg";
77

@@ -53,14 +53,15 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
5353
className,
5454
totalPages,
5555
}) => {
56-
const navigate = useNavigate();
5756
const location = useLocation();
5857
return (
5958
<div {...{ className }}>
6059
<TitleContainer className="title">
6160
<StyledTitle>{title}</StyledTitle>
6261
{location.pathname.startsWith("/cases/display/1/desc/all") ? (
63-
<StyledButton onClick={() => navigate(`/resolver`)} text="Create a case" Icon={ArrowIcon} />
62+
<Link to={"/resolver"}>
63+
<StyledButton text="Create a case" Icon={ArrowIcon} />
64+
</Link>
6465
) : null}
6566
</TitleContainer>
6667
<Search />

web/src/components/DisputeView/DisputeCardView.tsx

+10-9
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import styled from "styled-components";
33

4-
import { useNavigate } from "react-router-dom";
4+
import { Link } from "react-router-dom";
55

66
import { Card } from "@kleros/ui-components-library";
77

@@ -54,15 +54,16 @@ interface IDisputeCardView {
5454
}
5555

5656
const DisputeCardView: React.FC<IDisputeCardView> = ({ isLoading, ...props }) => {
57-
const navigate = useNavigate();
5857
return (
59-
<StyledCard hover onClick={() => navigate(`/cases/${props?.disputeID?.toString()}`)}>
60-
<PeriodBanner id={parseInt(props?.disputeID)} period={props?.period} />
61-
<CardContainer>
62-
{isLoading ? <StyledCaseCardTitleSkeleton /> : <TruncatedTitle text={props?.title} maxLength={100} />}
63-
<DisputeInfo {...props} />
64-
</CardContainer>
65-
</StyledCard>
58+
<Link to={`/cases/${props?.disputeID?.toString()}`}>
59+
<StyledCard hover>
60+
<PeriodBanner id={parseInt(props?.disputeID)} period={props?.period} />
61+
<CardContainer>
62+
{isLoading ? <StyledCaseCardTitleSkeleton /> : <TruncatedTitle text={props?.title} maxLength={100} />}
63+
<DisputeInfo {...props} />
64+
</CardContainer>
65+
</StyledCard>
66+
</Link>
6667
);
6768
};
6869

web/src/components/DisputeView/DisputeListView.tsx

+12-11
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from "react";
22
import styled from "styled-components";
33

4-
import { useNavigate } from "react-router-dom";
4+
import { Link } from "react-router-dom";
55
import { useAccount } from "wagmi";
66

77
import { Card } from "@kleros/ui-components-library";
@@ -56,17 +56,18 @@ interface IDisputeListView {
5656
}
5757
const DisputeListView: React.FC<IDisputeListView> = (props) => {
5858
const { isDisconnected } = useAccount();
59-
const navigate = useNavigate();
6059
return (
61-
<StyledListItem hover onClick={() => navigate(`/cases/${props?.disputeID?.toString()}`)}>
62-
<PeriodBanner isCard={false} id={parseInt(props?.disputeID ?? "0")} period={props.period} />
63-
<ListContainer>
64-
<TitleContainer isLabel={!isDisconnected}>
65-
<TruncatedTitle text={props?.title} maxLength={50} />
66-
</TitleContainer>
67-
<DisputeInfo {...props} />
68-
</ListContainer>
69-
</StyledListItem>
60+
<Link to={`/cases/${props?.disputeID?.toString()}`}>
61+
<StyledListItem hover>
62+
<PeriodBanner isCard={false} id={parseInt(props?.disputeID ?? "0")} period={props.period} />
63+
<ListContainer>
64+
<TitleContainer isLabel={!isDisconnected}>
65+
<TruncatedTitle text={props?.title} maxLength={50} />
66+
</TitleContainer>
67+
<DisputeInfo {...props} />
68+
</ListContainer>
69+
</StyledListItem>
70+
</Link>
7071
);
7172
};
7273

web/src/pages/Home/CourtOverview/Header.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import styled from "styled-components";
33

44
import { responsiveSize } from "styles/responsiveSize";
55

6-
import { useNavigate } from "react-router-dom";
6+
import { Link } from "react-router-dom";
77

88
import { Button } from "@kleros/ui-components-library";
99

@@ -22,11 +22,12 @@ const StyledH1 = styled.h1`
2222
`;
2323

2424
const Header: React.FC = () => {
25-
const navigate = useNavigate();
2625
return (
2726
<StyledHeader>
2827
<StyledH1>Court Overview</StyledH1>
29-
<Button small Icon={Bookmark} text="Create a Case" onClick={() => navigate("/resolver")} />
28+
<Link to={"/resolver"}>
29+
<Button small Icon={Bookmark} text="Create a Case" />
30+
</Link>
3031
</StyledHeader>
3132
);
3233
};

0 commit comments

Comments
 (0)