Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: UX improvements #1760

Merged
merged 7 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions web/src/components/CasesDisplay/index.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -53,14 +53,15 @@ const CasesDisplay: React.FC<ICasesDisplay> = ({
className,
totalPages,
}) => {
const navigate = useNavigate();
const location = useLocation();
return (
<div {...{ className }}>
<TitleContainer className="title">
<StyledTitle>{title}</StyledTitle>
{location.pathname.startsWith("/cases/display/1/desc/all") ? (
<StyledButton onClick={() => navigate(`/resolver`)} text="Create a case" Icon={ArrowIcon} />
<Link to={"/resolver"}>
<StyledButton text="Create a case" Icon={ArrowIcon} />
</Link>
) : null}
</TitleContainer>
<Search />
Expand Down
19 changes: 10 additions & 9 deletions web/src/components/DisputeView/DisputeCardView.tsx
Original file line number Diff line number Diff line change
@@ -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";

Expand Down Expand Up @@ -54,15 +54,16 @@ interface IDisputeCardView {
}

const DisputeCardView: React.FC<IDisputeCardView> = ({ isLoading, ...props }) => {
const navigate = useNavigate();
return (
<StyledCard hover onClick={() => navigate(`/cases/${props?.disputeID?.toString()}`)}>
<PeriodBanner id={parseInt(props?.disputeID)} period={props?.period} />
<CardContainer>
{isLoading ? <StyledCaseCardTitleSkeleton /> : <TruncatedTitle text={props?.title} maxLength={100} />}
<DisputeInfo {...props} />
</CardContainer>
</StyledCard>
<Link to={`/cases/${props?.disputeID?.toString()}`}>
<StyledCard hover>
<PeriodBanner id={parseInt(props?.disputeID)} period={props?.period} />
<CardContainer>
{isLoading ? <StyledCaseCardTitleSkeleton /> : <TruncatedTitle text={props?.title} maxLength={100} />}
<DisputeInfo {...props} />
</CardContainer>
</StyledCard>
</Link>
kemuru marked this conversation as resolved.
Show resolved Hide resolved
);
};

Expand Down
23 changes: 12 additions & 11 deletions web/src/components/DisputeView/DisputeListView.tsx
Original file line number Diff line number Diff line change
@@ -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";
Expand Down Expand Up @@ -56,17 +56,18 @@ interface IDisputeListView {
}
const DisputeListView: React.FC<IDisputeListView> = (props) => {
const { isDisconnected } = useAccount();
const navigate = useNavigate();
return (
<StyledListItem hover onClick={() => navigate(`/cases/${props?.disputeID?.toString()}`)}>
<PeriodBanner isCard={false} id={parseInt(props?.disputeID ?? "0")} period={props.period} />
<ListContainer>
<TitleContainer isLabel={!isDisconnected}>
<TruncatedTitle text={props?.title} maxLength={50} />
</TitleContainer>
<DisputeInfo {...props} />
</ListContainer>
</StyledListItem>
<Link to={`/cases/${props?.disputeID?.toString()}`}>
<StyledListItem hover>
<PeriodBanner isCard={false} id={parseInt(props?.disputeID ?? "0")} period={props.period} />
<ListContainer>
<TitleContainer isLabel={!isDisconnected}>
<TruncatedTitle text={props?.title} maxLength={50} />
</TitleContainer>
<DisputeInfo {...props} />
</ListContainer>
</StyledListItem>
</Link>
kemuru marked this conversation as resolved.
Show resolved Hide resolved
);
};

Expand Down
8 changes: 7 additions & 1 deletion web/src/pages/Cases/CaseDetails/Overview/index.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import React, { useMemo } from "react";
import React, { useEffect, useMemo } from "react";
import styled from "styled-components";

import { useParams } from "react-router-dom";
import { formatEther } from "viem";

import { usePopulatedDisputeData } from "hooks/queries/usePopulatedDisputeData";
import { useVotingHistory } from "hooks/queries/useVotingHistory";
import { useScrollTop } from "hooks/useScrollTop";
import { getLocalRounds } from "utils/getLocalRounds";

import { useCourtPolicy } from "queries/useCourtPolicy";
Expand Down Expand Up @@ -40,12 +41,17 @@ const Overview: React.FC<IOverview> = ({ arbitrable, courtID, currentPeriodIndex
const { data: dispute } = useDisputeDetailsQuery(id);
const { data: courtPolicy } = useCourtPolicy(courtID);
const { data: votingHistory } = useVotingHistory(id);
const scrollTop = useScrollTop();
const localRounds = getLocalRounds(votingHistory?.dispute?.disputeKitDispute);
const courtName = courtPolicy?.name;
const court = dispute?.dispute?.court;
const rewards = useMemo(() => (court ? `≥ ${formatEther(court.feeForJuror)} ETH` : undefined), [court]);
const category = disputeDetails?.category;

useEffect(() => {
scrollTop();
}, [scrollTop]);

return (
<>
<Container>
Expand Down
7 changes: 4 additions & 3 deletions web/src/pages/Home/CourtOverview/Header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -22,11 +22,12 @@ const StyledH1 = styled.h1`
`;

const Header: React.FC = () => {
const navigate = useNavigate();
return (
<StyledHeader>
<StyledH1>Court Overview</StyledH1>
<Button small Icon={Bookmark} text="Create a Case" onClick={() => navigate("/resolver")} />
<Link to={"/resolver"}>
<Button small Icon={Bookmark} text="Create a Case" />
</Link>
</StyledHeader>
);
};
Expand Down