Skip to content

Commit

Permalink
Merge pull request #1786 from kleros/feat/ui-improvements
Browse files Browse the repository at this point in the history
chore: ui improvements (detailed inside)
  • Loading branch information
alcercu authored Dec 13, 2024
2 parents 4d7f96c + c65acd9 commit 69ff44d
Show file tree
Hide file tree
Showing 26 changed files with 138 additions and 99 deletions.
3 changes: 3 additions & 0 deletions web/src/assets/svgs/icons/ethereum-vote.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions web/src/assets/svgs/icons/law-balance-hourglass.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
48 changes: 17 additions & 31 deletions web/src/components/DisputePreview/DisputeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,24 +14,20 @@ import { StyledSkeleton } from "components/StyledSkeleton";

import AliasDisplay from "./Alias";
import { Divider } from "../Divider";
import { ExternalLink } from "../ExternalLink";

const StyledH1 = styled.h1`
margin: 0;
word-wrap: break-word;
`;

const QuestionAndDescription = styled.div`
display: flex;
flex-direction: column;
word-wrap: break-word;
div:first-child p:first-of-type {
font-size: 16px;
font-weight: 400;
const ReactMarkdownWrapper = styled.div`
& p:first-of-type {
margin: 0;
}
`;

const VotingOptions = styled(QuestionAndDescription)`
const VotingOptions = styled.div`
display: flex;
flex-direction: column;
gap: 8px;
Expand All @@ -51,19 +47,6 @@ const Answer = styled.div`
display: flex;
flex-wrap: wrap;
gap: 6px;
> label {
max-width: 100%;
}
`;

const StyledSmall = styled.small`
color: ${({ theme }) => theme.secondaryText};
font-weight: 400;
`;

const StyledLabel = styled.label`
color: ${({ theme }) => theme.primaryText};
font-weight: 600;
`;

const AliasesContainer = styled.div`
Expand All @@ -83,26 +66,29 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
<>
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}</StyledH1>
{!isUndefined(disputeDetails) && (
<QuestionAndDescription>
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
<ReactMarkdown>{disputeDetails?.description}</ReactMarkdown>
</QuestionAndDescription>
<>
<ReactMarkdownWrapper>
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
</ReactMarkdownWrapper>
<ReactMarkdownWrapper>
<ReactMarkdown>{disputeDetails?.description}</ReactMarkdown>
</ReactMarkdownWrapper>
</>
)}
{isUndefined(disputeDetails?.frontendUrl) ? null : (
<a href={disputeDetails?.frontendUrl} target="_blank" rel="noreferrer">
<ExternalLink href={disputeDetails?.frontendUrl} target="_blank" rel="noreferrer">
Go to arbitrable
</a>
</ExternalLink>
)}
<VotingOptions>
{isUndefined(disputeDetails) ? null : <AnswersHeader>Voting Options</AnswersHeader>}
<AnswersContainer>
{disputeDetails?.answers?.map((answer: IAnswer, i: number) => (
<Answer key={answer.title}>
<StyledSmall>{i + 1 + `.`}</StyledSmall>
<StyledLabel>
{answer.title}
<small>
<label>{i + 1}.</label> {answer.title}
{answer.description.trim() ? ` - ${answer.description}` : null}
</StyledLabel>
</small>
</Answer>
))}
</AnswersContainer>
Expand Down
8 changes: 4 additions & 4 deletions web/src/components/ErrorFallback.tsx
Original file line number Diff line number Diff line change
@@ -1,23 +1,23 @@
import React from "react";
import styled, { css } from "styled-components";

import { MAX_WIDTH_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";

import { FallbackProps } from "react-error-boundary";

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

import ErrorIcon from "svgs/icons/warning-outline.svg";

import { landscapeStyle } from "styles/landscapeStyle";
import { responsiveSize } from "styles/responsiveSize";

import HeroImage from "./HeroImage";

const Container = styled.div`
width: 100%;
height: 100vh;
background-color: ${({ theme }) => theme.lightBackground};
padding: ${responsiveSize(32, 80)} ${responsiveSize(24, 136)} ${responsiveSize(76, 96)};
max-width: 1780px;
max-width: ${MAX_WIDTH_LANDSCAPE};
margin: 0 auto;
`;

Expand Down
16 changes: 11 additions & 5 deletions web/src/components/ExtraStatsDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import styled from "styled-components";

import { StyledSkeleton } from "components/StyledSkeleton";
import { isUndefined } from "utils/index";
import { InternalLink } from "./InternalLink";

const Container = styled.div`
display: flex;
Expand Down Expand Up @@ -30,10 +31,8 @@ const TextContainer = styled.div`
justify-content: center;
`;

const StyledP = styled.p`
font-size: 14px;
const StyledInternalLink = styled(InternalLink)`
font-weight: 600;
margin: 0;
`;

const StyledExtraStatTitleSkeleton = styled(StyledSkeleton)`
Expand All @@ -42,18 +41,25 @@ const StyledExtraStatTitleSkeleton = styled(StyledSkeleton)`

export interface IExtraStatsDisplay {
title: string;
courtId?: string;
icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
content?: React.ReactNode;
text?: string;
}

const ExtraStatsDisplay: React.FC<IExtraStatsDisplay> = ({ title, text, content, icon: Icon, ...props }) => {
const ExtraStatsDisplay: React.FC<IExtraStatsDisplay> = ({ title, courtId, text, content, icon: Icon, ...props }) => {
return (
<Container {...props}>
<SVGContainer>{<Icon />}</SVGContainer>
<TextContainer>
<label>{title}:</label>
{content ? content : <StyledP>{!isUndefined(text) ? text : <StyledExtraStatTitleSkeleton />}</StyledP>}
{content ? (
content
) : (
<StyledInternalLink to={`/courts/${courtId?.toString()}`}>
{!isUndefined(text) ? text : <StyledExtraStatTitleSkeleton />}
</StyledInternalLink>
)}
</TextContainer>
</Container>
);
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/StyledIcons/ClosedCircleIcon.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import styled from "styled-components";
import ClosedCircle from "svgs/icons/close-circle.svg";

const StyledClosedCircle = styled(ClosedCircle)`
export const StyledClosedCircle = styled(ClosedCircle)`
path {
fill: ${({ theme }) => theme.error};
}
Expand All @@ -11,4 +11,5 @@ const StyledClosedCircle = styled(ClosedCircle)`
const ClosedCircleIcon: React.FC = () => {
return <StyledClosedCircle />;
};

export default ClosedCircleIcon;
7 changes: 4 additions & 3 deletions web/src/components/Verdict/DisputeTimeline.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import React, { useMemo } from "react";
import styled, { useTheme } from "styled-components";

import { responsiveSize } from "styles/responsiveSize";

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

import { _TimelineItem1, CustomTimeline } from "@kleros/ui-components-library";

import CalendarIcon from "svgs/icons/calendar.svg";
import ClosedCaseIcon from "svgs/icons/check-circle-outline.svg";
import AppealedCaseIcon from "svgs/icons/close-circle.svg";

import { Periods } from "consts/periods";
import { usePopulatedDisputeData } from "hooks/queries/usePopulatedDisputeData";
Expand All @@ -19,7 +20,7 @@ import { useVotingHistory } from "queries/useVotingHistory";

import { ClassicRound } from "src/graphql/graphql";

import { responsiveSize } from "styles/responsiveSize";
import { StyledClosedCircle } from "components/StyledIcons/ClosedCircleIcon";

const Container = styled.div`
display: flex;
Expand Down Expand Up @@ -101,7 +102,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
party: "",
subtitle: formatDate(roundTimeline?.[Periods.appeal]),
rightSided: true,
Icon: AppealedCaseIcon,
Icon: StyledClosedCircle,
});
} else if (rulingOverride && parsedDisputeFinalRuling !== parsedRoundChoice) {
acc.push({
Expand Down
2 changes: 2 additions & 0 deletions web/src/hooks/queries/usePopulatedDisputeData.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { DisputeDetails } from "@kleros/kleros-sdk/src/dataMappings/utils/disput
import { populateTemplate } from "@kleros/kleros-sdk/src/dataMappings/utils/populateTemplate";

import { useGraphqlBatcher } from "context/GraphqlBatcher";
import { DEFAULT_CHAIN } from "consts/chains";
import { debounceErrorToast } from "utils/debounceErrorToast";
import { isUndefined } from "utils/index";

Expand Down Expand Up @@ -47,6 +48,7 @@ export const usePopulatedDisputeData = (disputeID?: string, arbitrableAddress?:
document: disputeTemplateQuery,
variables: { id: disputeData.dispute?.templateId.toString() },
isDisputeTemplate: true,
chainId: DEFAULT_CHAIN,
});

const templateData = disputeTemplate?.templateData;
Expand Down
1 change: 1 addition & 0 deletions web/src/layout/Header/DesktopHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ import Settings from "./navbar/Menu/Settings";
const Container = styled.div`
display: none;
position: absolute;
height: 64px;
${landscapeStyle(
() => css`
Expand Down
16 changes: 8 additions & 8 deletions web/src/layout/Header/Logo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,19 @@ import styled, { Theme } from "styled-components";

import { Link } from "react-router-dom";

import KlerosCourtLogo from "svgs/header/kleros-court.svg";

import { ArbitratorTypes, getArbitratorType } from "consts/index";

import { isUndefined } from "utils/index";

import KlerosCourtLogo from "svgs/header/kleros-court.svg";

const Container = styled.div`
display: flex;
flex-direction: row;
align-items: center;
gap: 16px;
`;

const StyledLink = styled(Link)`
min-height: 48px;
`;

const BadgeContainer = styled.div<{ backgroundColor: keyof Theme }>`
transform: skewX(-15deg);
background-color: ${({ theme, backgroundColor }) => theme[backgroundColor]};
Expand All @@ -32,6 +29,9 @@ const BadgeText = styled.label`
`;

const StyledKlerosCourtLogo = styled(KlerosCourtLogo)`
max-height: 40px;
width: auto;
&:hover {
path {
fill: ${({ theme }) => theme.white}BF;
Expand Down Expand Up @@ -61,9 +61,9 @@ const CourtBadge: React.FC = () => {
const Logo: React.FC = () => (
<Container>
{" "}
<StyledLink to={"/"}>
<Link to={"/"}>
<StyledKlerosCourtLogo />
</StyledLink>
</Link>
<CourtBadge />
</Container>
);
Expand Down
1 change: 1 addition & 0 deletions web/src/layout/Header/MobileHeader.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ const Container = styled.div`
align-items: center;
justify-content: space-between;
width: 100%;
height: 64px;
${landscapeStyle(
() => css`
Expand Down
2 changes: 1 addition & 1 deletion web/src/layout/Header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Container = styled.div`

const HeaderContainer = styled.div`
width: 100%;
padding: 8px 24px;
padding: 0 24px;
`;

const Header: React.FC = () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ const EvidenceSearch: React.FC<IEvidenceSearch> = ({ search, setSearch, evidence

<SearchContainer>
<StyledSearchBar
placeholder="Search evidence by number, word, or submitter."
placeholder="Search evidence by number, word, or submitter"
onChange={(e) => setSearch(e.target.value)}
value={search}
/>
Expand Down
3 changes: 2 additions & 1 deletion web/src/pages/Cases/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import React from "react";
import styled from "styled-components";
import { MAX_WIDTH_LANDSCAPE } from "styles/landscapeStyle";

import { Routes, Route } from "react-router-dom";

Expand All @@ -13,7 +14,7 @@ const Container = styled.div`
width: 100%;
background-color: ${({ theme }) => theme.lightBackground};
padding: ${responsiveSize(32, 80)} ${responsiveSize(24, 136)} ${responsiveSize(76, 96)};
max-width: 1780px;
max-width: ${MAX_WIDTH_LANDSCAPE};
margin: 0 auto;
`;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ const Container = styled.div`

const PNKLogoAndTitle = styled.div`
display: flex;
gap: 0 16px;
gap: 0 12px;
align-items: center;
`;

Expand Down
Loading

0 comments on commit 69ff44d

Please sign in to comment.