Skip to content

Commit 69ff44d

Browse files
authored
Merge pull request #1786 from kleros/feat/ui-improvements
chore: ui improvements (detailed inside)
2 parents 4d7f96c + c65acd9 commit 69ff44d

File tree

26 files changed

+138
-99
lines changed

26 files changed

+138
-99
lines changed
Loading
Loading

web/src/components/DisputePreview/DisputeContext.tsx

+17-31
Original file line numberDiff line numberDiff line change
@@ -14,24 +14,20 @@ import { StyledSkeleton } from "components/StyledSkeleton";
1414

1515
import AliasDisplay from "./Alias";
1616
import { Divider } from "../Divider";
17+
import { ExternalLink } from "../ExternalLink";
1718

1819
const StyledH1 = styled.h1`
1920
margin: 0;
2021
word-wrap: break-word;
2122
`;
2223

23-
const QuestionAndDescription = styled.div`
24-
display: flex;
25-
flex-direction: column;
26-
word-wrap: break-word;
27-
div:first-child p:first-of-type {
28-
font-size: 16px;
29-
font-weight: 400;
24+
const ReactMarkdownWrapper = styled.div`
25+
& p:first-of-type {
3026
margin: 0;
3127
}
3228
`;
3329

34-
const VotingOptions = styled(QuestionAndDescription)`
30+
const VotingOptions = styled.div`
3531
display: flex;
3632
flex-direction: column;
3733
gap: 8px;
@@ -51,19 +47,6 @@ const Answer = styled.div`
5147
display: flex;
5248
flex-wrap: wrap;
5349
gap: 6px;
54-
> label {
55-
max-width: 100%;
56-
}
57-
`;
58-
59-
const StyledSmall = styled.small`
60-
color: ${({ theme }) => theme.secondaryText};
61-
font-weight: 400;
62-
`;
63-
64-
const StyledLabel = styled.label`
65-
color: ${({ theme }) => theme.primaryText};
66-
font-weight: 600;
6750
`;
6851

6952
const AliasesContainer = styled.div`
@@ -83,26 +66,29 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
8366
<>
8467
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}</StyledH1>
8568
{!isUndefined(disputeDetails) && (
86-
<QuestionAndDescription>
87-
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
88-
<ReactMarkdown>{disputeDetails?.description}</ReactMarkdown>
89-
</QuestionAndDescription>
69+
<>
70+
<ReactMarkdownWrapper>
71+
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
72+
</ReactMarkdownWrapper>
73+
<ReactMarkdownWrapper>
74+
<ReactMarkdown>{disputeDetails?.description}</ReactMarkdown>
75+
</ReactMarkdownWrapper>
76+
</>
9077
)}
9178
{isUndefined(disputeDetails?.frontendUrl) ? null : (
92-
<a href={disputeDetails?.frontendUrl} target="_blank" rel="noreferrer">
79+
<ExternalLink href={disputeDetails?.frontendUrl} target="_blank" rel="noreferrer">
9380
Go to arbitrable
94-
</a>
81+
</ExternalLink>
9582
)}
9683
<VotingOptions>
9784
{isUndefined(disputeDetails) ? null : <AnswersHeader>Voting Options</AnswersHeader>}
9885
<AnswersContainer>
9986
{disputeDetails?.answers?.map((answer: IAnswer, i: number) => (
10087
<Answer key={answer.title}>
101-
<StyledSmall>{i + 1 + `.`}</StyledSmall>
102-
<StyledLabel>
103-
{answer.title}
88+
<small>
89+
<label>{i + 1}.</label> {answer.title}
10490
{answer.description.trim() ? ` - ${answer.description}` : null}
105-
</StyledLabel>
91+
</small>
10692
</Answer>
10793
))}
10894
</AnswersContainer>

web/src/components/ErrorFallback.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,23 @@
11
import React from "react";
22
import styled, { css } from "styled-components";
33

4+
import { MAX_WIDTH_LANDSCAPE, landscapeStyle } from "styles/landscapeStyle";
5+
import { responsiveSize } from "styles/responsiveSize";
6+
47
import { FallbackProps } from "react-error-boundary";
58

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

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

10-
import { landscapeStyle } from "styles/landscapeStyle";
11-
import { responsiveSize } from "styles/responsiveSize";
12-
1313
import HeroImage from "./HeroImage";
1414

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

web/src/components/ExtraStatsDisplay.tsx

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

44
import { StyledSkeleton } from "components/StyledSkeleton";
55
import { isUndefined } from "utils/index";
6+
import { InternalLink } from "./InternalLink";
67

78
const Container = styled.div`
89
display: flex;
@@ -30,10 +31,8 @@ const TextContainer = styled.div`
3031
justify-content: center;
3132
`;
3233

33-
const StyledP = styled.p`
34-
font-size: 14px;
34+
const StyledInternalLink = styled(InternalLink)`
3535
font-weight: 600;
36-
margin: 0;
3736
`;
3837

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

4342
export interface IExtraStatsDisplay {
4443
title: string;
44+
courtId?: string;
4545
icon: React.FunctionComponent<React.SVGAttributes<SVGElement>>;
4646
content?: React.ReactNode;
4747
text?: string;
4848
}
4949

50-
const ExtraStatsDisplay: React.FC<IExtraStatsDisplay> = ({ title, text, content, icon: Icon, ...props }) => {
50+
const ExtraStatsDisplay: React.FC<IExtraStatsDisplay> = ({ title, courtId, text, content, icon: Icon, ...props }) => {
5151
return (
5252
<Container {...props}>
5353
<SVGContainer>{<Icon />}</SVGContainer>
5454
<TextContainer>
5555
<label>{title}:</label>
56-
{content ? content : <StyledP>{!isUndefined(text) ? text : <StyledExtraStatTitleSkeleton />}</StyledP>}
56+
{content ? (
57+
content
58+
) : (
59+
<StyledInternalLink to={`/courts/${courtId?.toString()}`}>
60+
{!isUndefined(text) ? text : <StyledExtraStatTitleSkeleton />}
61+
</StyledInternalLink>
62+
)}
5763
</TextContainer>
5864
</Container>
5965
);

web/src/components/StyledIcons/ClosedCircleIcon.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import React from "react";
22
import styled from "styled-components";
33
import ClosedCircle from "svgs/icons/close-circle.svg";
44

5-
const StyledClosedCircle = styled(ClosedCircle)`
5+
export const StyledClosedCircle = styled(ClosedCircle)`
66
path {
77
fill: ${({ theme }) => theme.error};
88
}
@@ -11,4 +11,5 @@ const StyledClosedCircle = styled(ClosedCircle)`
1111
const ClosedCircleIcon: React.FC = () => {
1212
return <StyledClosedCircle />;
1313
};
14+
1415
export default ClosedCircleIcon;

web/src/components/Verdict/DisputeTimeline.tsx

+4-3
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
import React, { useMemo } from "react";
22
import styled, { useTheme } from "styled-components";
33

4+
import { responsiveSize } from "styles/responsiveSize";
5+
46
import { useParams } from "react-router-dom";
57

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

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

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

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

22-
import { responsiveSize } from "styles/responsiveSize";
23+
import { StyledClosedCircle } from "components/StyledIcons/ClosedCircleIcon";
2324

2425
const Container = styled.div`
2526
display: flex;
@@ -101,7 +102,7 @@ const useItems = (disputeDetails?: DisputeDetailsQuery, arbitrable?: `0x${string
101102
party: "",
102103
subtitle: formatDate(roundTimeline?.[Periods.appeal]),
103104
rightSided: true,
104-
Icon: AppealedCaseIcon,
105+
Icon: StyledClosedCircle,
105106
});
106107
} else if (rulingOverride && parsedDisputeFinalRuling !== parsedRoundChoice) {
107108
acc.push({

web/src/hooks/queries/usePopulatedDisputeData.ts

+2
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { DisputeDetails } from "@kleros/kleros-sdk/src/dataMappings/utils/disput
66
import { populateTemplate } from "@kleros/kleros-sdk/src/dataMappings/utils/populateTemplate";
77

88
import { useGraphqlBatcher } from "context/GraphqlBatcher";
9+
import { DEFAULT_CHAIN } from "consts/chains";
910
import { debounceErrorToast } from "utils/debounceErrorToast";
1011
import { isUndefined } from "utils/index";
1112

@@ -47,6 +48,7 @@ export const usePopulatedDisputeData = (disputeID?: string, arbitrableAddress?:
4748
document: disputeTemplateQuery,
4849
variables: { id: disputeData.dispute?.templateId.toString() },
4950
isDisputeTemplate: true,
51+
chainId: DEFAULT_CHAIN,
5052
});
5153

5254
const templateData = disputeTemplate?.templateData;

web/src/layout/Header/DesktopHeader.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import Settings from "./navbar/Menu/Settings";
3434
const Container = styled.div`
3535
display: none;
3636
position: absolute;
37+
height: 64px;
3738
3839
${landscapeStyle(
3940
() => css`

web/src/layout/Header/Logo.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,19 @@ import styled, { Theme } from "styled-components";
33

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

6-
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
7-
86
import { ArbitratorTypes, getArbitratorType } from "consts/index";
7+
98
import { isUndefined } from "utils/index";
109

10+
import KlerosCourtLogo from "svgs/header/kleros-court.svg";
11+
1112
const Container = styled.div`
1213
display: flex;
1314
flex-direction: row;
1415
align-items: center;
1516
gap: 16px;
1617
`;
1718

18-
const StyledLink = styled(Link)`
19-
min-height: 48px;
20-
`;
21-
2219
const BadgeContainer = styled.div<{ backgroundColor: keyof Theme }>`
2320
transform: skewX(-15deg);
2421
background-color: ${({ theme, backgroundColor }) => theme[backgroundColor]};
@@ -32,6 +29,9 @@ const BadgeText = styled.label`
3229
`;
3330

3431
const StyledKlerosCourtLogo = styled(KlerosCourtLogo)`
32+
max-height: 40px;
33+
width: auto;
34+
3535
&:hover {
3636
path {
3737
fill: ${({ theme }) => theme.white}BF;
@@ -61,9 +61,9 @@ const CourtBadge: React.FC = () => {
6161
const Logo: React.FC = () => (
6262
<Container>
6363
{" "}
64-
<StyledLink to={"/"}>
64+
<Link to={"/"}>
6565
<StyledKlerosCourtLogo />
66-
</StyledLink>
66+
</Link>
6767
<CourtBadge />
6868
</Container>
6969
);

web/src/layout/Header/MobileHeader.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ const Container = styled.div`
1717
align-items: center;
1818
justify-content: space-between;
1919
width: 100%;
20+
height: 64px;
2021
2122
${landscapeStyle(
2223
() => css`

web/src/layout/Header/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Container = styled.div`
1717

1818
const HeaderContainer = styled.div`
1919
width: 100%;
20-
padding: 8px 24px;
20+
padding: 0 24px;
2121
`;
2222

2323
const Header: React.FC = () => {

web/src/pages/Cases/CaseDetails/Evidence/EvidenceSearch.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ const EvidenceSearch: React.FC<IEvidenceSearch> = ({ search, setSearch, evidence
4848

4949
<SearchContainer>
5050
<StyledSearchBar
51-
placeholder="Search evidence by number, word, or submitter."
51+
placeholder="Search evidence by number, word, or submitter"
5252
onChange={(e) => setSearch(e.target.value)}
5353
value={search}
5454
/>

web/src/pages/Cases/index.tsx

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import React from "react";
22
import styled from "styled-components";
3+
import { MAX_WIDTH_LANDSCAPE } from "styles/landscapeStyle";
34

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

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

web/src/pages/Courts/CourtDetails/StakePanel/Simulator/Header.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const Container = styled.div`
1414

1515
const PNKLogoAndTitle = styled.div`
1616
display: flex;
17-
gap: 0 16px;
17+
gap: 0 12px;
1818
align-items: center;
1919
`;
2020

0 commit comments

Comments
 (0)