Skip to content

Commit 5c54f15

Browse files
authored
Merge pull request #1525 from kleros/fix(web)/add-create-case-button-and-fix-toast
Fix(web)/add create case button and fix toast
2 parents 9a07fee + 322fbef commit 5c54f15

File tree

3 files changed

+31
-4
lines changed

3 files changed

+31
-4
lines changed

web/src/components/CasesDisplay/index.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import Search from "./Search";
44
import StatsAndFilters from "./StatsAndFilters";
55
import CasesGrid, { ICasesGrid } from "./CasesGrid";
66
import { responsiveSize } from "styles/responsiveSize";
7+
import LightButton from "../LightButton";
8+
import ArrowIcon from "assets/svgs/icons/arrow.svg";
9+
import { useLocation, useNavigate } from "react-router-dom";
710

811
const Divider = styled.hr`
912
display: flex;
@@ -12,9 +15,26 @@ const Divider = styled.hr`
1215
background-color: ${({ theme }) => theme.stroke};
1316
margin: ${responsiveSize(20, 24)};
1417
`;
18+
const TitleContainer = styled.div`
19+
display: flex;
20+
justify-content: space-between;
21+
align-items: center;
22+
flex-wrap: wrap;
23+
margin-bottom: ${responsiveSize(32, 48)};
24+
`;
1525

1626
const StyledTitle = styled.h1`
17-
margin-bottom: ${responsiveSize(32, 48)};
27+
margin: 0px;
28+
`;
29+
30+
const StyledButton = styled(LightButton)`
31+
display: flex;
32+
flex-direction: row-reverse;
33+
gap: 8px;
34+
> .button-text {
35+
color: ${({ theme }) => theme.primaryBlue};
36+
}
37+
padding: 0px;
1838
`;
1939

2040
interface ICasesDisplay extends ICasesGrid {
@@ -35,9 +55,16 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
3555
className,
3656
totalPages,
3757
}) => {
58+
const navigate = useNavigate();
59+
const location = useLocation();
3860
return (
3961
<div {...{ className }}>
40-
<StyledTitle>{title}</StyledTitle>
62+
<TitleContainer className="title">
63+
<StyledTitle>{title}</StyledTitle>
64+
{location.pathname.startsWith("/cases/display/1/desc/all") ? (
65+
<StyledButton onClick={() => navigate(`/resolver`)} text="Create a case" Icon={ArrowIcon} />
66+
) : null}
67+
</TitleContainer>
4168
<Search />
4269
<StatsAndFilters totalDisputes={numberDisputes ?? 0} closedDisputes={numberClosedDisputes ?? 0} />
4370
<Divider />

web/src/pages/Dashboard/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const Container = styled.div`
2424
const StyledCasesDisplay = styled(CasesDisplay)`
2525
margin-top: 64px;
2626
27-
h1 {
27+
.title {
2828
margin-bottom: ${responsiveSize(16, 48)};
2929
}
3030
`;

web/src/pages/Resolver/Policy/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ const Policy: React.FC = () => {
4747
const fileFormData = new FormData();
4848
fileFormData.append("data", file, file.name);
4949

50-
uploadFormDataToIPFS(fileFormData)
50+
uploadFormDataToIPFS(fileFormData, "policy")
5151
.then(async (res) => {
5252
const response = await res.json();
5353
const policyURI = response["cids"][0];

0 commit comments

Comments
 (0)