Skip to content

Commit

Permalink
Merge pull request #1525 from kleros/fix(web)/add-create-case-button-…
Browse files Browse the repository at this point in the history
…and-fix-toast

Fix(web)/add create case button and fix toast
  • Loading branch information
alcercu authored Feb 26, 2024
2 parents 9a07fee + 322fbef commit 5c54f15
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
31 changes: 29 additions & 2 deletions web/src/components/CasesDisplay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import Search from "./Search";
import StatsAndFilters from "./StatsAndFilters";
import CasesGrid, { ICasesGrid } from "./CasesGrid";
import { responsiveSize } from "styles/responsiveSize";
import LightButton from "../LightButton";
import ArrowIcon from "assets/svgs/icons/arrow.svg";
import { useLocation, useNavigate } from "react-router-dom";

const Divider = styled.hr`
display: flex;
Expand All @@ -12,9 +15,26 @@ const Divider = styled.hr`
background-color: ${({ theme }) => theme.stroke};
margin: ${responsiveSize(20, 24)};
`;
const TitleContainer = styled.div`
display: flex;
justify-content: space-between;
align-items: center;
flex-wrap: wrap;
margin-bottom: ${responsiveSize(32, 48)};
`;

const StyledTitle = styled.h1`
margin-bottom: ${responsiveSize(32, 48)};
margin: 0px;
`;

const StyledButton = styled(LightButton)`
display: flex;
flex-direction: row-reverse;
gap: 8px;
> .button-text {
color: ${({ theme }) => theme.primaryBlue};
}
padding: 0px;
`;

interface ICasesDisplay extends ICasesGrid {
Expand All @@ -35,9 +55,16 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
className,
totalPages,
}) => {
const navigate = useNavigate();
const location = useLocation();
return (
<div {...{ className }}>
<StyledTitle>{title}</StyledTitle>
<TitleContainer className="title">
<StyledTitle>{title}</StyledTitle>
{location.pathname.startsWith("/cases/display/1/desc/all") ? (
<StyledButton onClick={() => navigate(`/resolver`)} text="Create a case" Icon={ArrowIcon} />
) : null}
</TitleContainer>
<Search />
<StatsAndFilters totalDisputes={numberDisputes ?? 0} closedDisputes={numberClosedDisputes ?? 0} />
<Divider />
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Dashboard/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ const Container = styled.div`
const StyledCasesDisplay = styled(CasesDisplay)`
margin-top: 64px;
h1 {
.title {
margin-bottom: ${responsiveSize(16, 48)};
}
`;
Expand Down
2 changes: 1 addition & 1 deletion web/src/pages/Resolver/Policy/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const Policy: React.FC = () => {
const fileFormData = new FormData();
fileFormData.append("data", file, file.name);

uploadFormDataToIPFS(fileFormData)
uploadFormDataToIPFS(fileFormData, "policy")
.then(async (res) => {
const response = await res.json();
const policyURI = response["cids"][0];
Expand Down

0 comments on commit 5c54f15

Please sign in to comment.