Skip to content

Commit f1535de

Browse files
committedDec 19, 2024··
feat(web): lang-direction
1 parent a744c1f commit f1535de

File tree

21 files changed

+81
-40
lines changed

21 files changed

+81
-40
lines changed
 

‎web/src/components/CasesDisplay/Search.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ const Search: React.FC = () => {
9090
)}
9191
<SearchBarContainer>
9292
<StyledSearchbar
93+
dir="auto"
9394
type="text"
9495
placeholder="Search By ID"
9596
value={search}

‎web/src/components/DisputePreview/Alias.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ const AliasDisplay: React.FC<IAlias> = ({ name, address }) => {
4646
const resolvedAddress = addressFromENS ?? (address as `0x${string}`);
4747

4848
return (
49-
<AliasContainer>
49+
<AliasContainer dir="auto">
5050
{isLoading ? <Skeleton width={30} height={24} /> : <IdenticonOrAvatar address={resolvedAddress} size="24" />}
5151
<TextContainer>
5252
{isLoading ? <Skeleton width={30} height={24} /> : <AddressOrName address={resolvedAddress} />}&nbsp;

‎web/src/components/DisputePreview/DisputeContext.tsx

+8-5
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import { responsiveSize } from "styles/responsiveSize";
1212
import ReactMarkdown from "components/ReactMarkdown";
1313
import { StyledSkeleton } from "components/StyledSkeleton";
1414

15-
import AliasDisplay from "./Alias";
1615
import { Divider } from "../Divider";
1716
import { ExternalLink } from "../ExternalLink";
1817

18+
import AliasDisplay from "./Alias";
19+
1920
const StyledH1 = styled.h1`
2021
margin: 0;
2122
word-wrap: break-word;
@@ -75,16 +76,18 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
7576

7677
return (
7778
<>
78-
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}</StyledH1>
79+
<StyledH1 dir="auto">
80+
{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}
81+
</StyledH1>
7982
{disputeDetails?.question?.trim() || disputeDetails?.description?.trim() ? (
8083
<div>
8184
{disputeDetails?.question?.trim() ? (
82-
<ReactMarkdownWrapper>
85+
<ReactMarkdownWrapper dir="auto">
8386
<ReactMarkdown>{disputeDetails.question}</ReactMarkdown>
8487
</ReactMarkdownWrapper>
8588
) : null}
8689
{disputeDetails?.description?.trim() ? (
87-
<ReactMarkdownWrapper>
90+
<ReactMarkdownWrapper dir="auto">
8891
<ReactMarkdown>{disputeDetails.description}</ReactMarkdown>
8992
</ReactMarkdownWrapper>
9093
) : null}
@@ -100,7 +103,7 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
100103
{isUndefined(disputeDetails) ? null : <AnswersHeader>Voting Options</AnswersHeader>}
101104
<AnswersContainer>
102105
{disputeDetails?.answers?.map((answer: IAnswer, i: number) => (
103-
<AnswerTitleAndDescription key={answer.title}>
106+
<AnswerTitleAndDescription dir="auto" key={answer.title}>
104107
<label>{i + 1}. </label>
105108
<AnswerTitle>{answer.title}</AnswerTitle>
106109
<AnswerDescription>{answer.description.trim() ? ` - ${answer.description}` : null}</AnswerDescription>

‎web/src/components/DisputeView/DisputeCardView.tsx

+2-2
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@ import { Card } from "@kleros/ui-components-library";
77

88
import { Periods } from "consts/periods";
99

10-
import { responsiveSize } from "styles/responsiveSize";
1110
import { hoverShortTransitionTiming } from "styles/commonStyles";
11+
import { responsiveSize } from "styles/responsiveSize";
1212

1313
import { StyledSkeleton } from "components/StyledSkeleton";
1414

@@ -37,7 +37,7 @@ const StyledCaseCardTitleSkeleton = styled(StyledSkeleton)`
3737

3838
const TruncatedTitle = ({ text, maxLength }) => {
3939
const truncatedText = text.length <= maxLength ? text : text.slice(0, maxLength) + "…";
40-
return <h3>{truncatedText}</h3>;
40+
return <h3 dir="auto">{truncatedText}</h3>;
4141
};
4242
interface IDisputeCardView {
4343
title: string;

‎web/src/components/DisputeView/DisputeListView.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import { Card } from "@kleros/ui-components-library";
88

99
import { Periods } from "consts/periods";
1010

11-
import { responsiveSize } from "styles/responsiveSize";
1211
import { hoverShortTransitionTiming } from "styles/commonStyles";
12+
import { responsiveSize } from "styles/responsiveSize";
1313

1414
import DisputeInfo from "./DisputeInfo";
1515
import PeriodBanner from "./PeriodBanner";
@@ -37,11 +37,12 @@ const TitleContainer = styled.div<{ isLabel?: boolean }>`
3737
width: ${({ isLabel }) => (isLabel ? responsiveSize(150, 340, 900) : "fit-content")};
3838
h3 {
3939
margin: 0;
40+
flex: 1;
4041
}
4142
`;
4243
const TruncatedTitle = ({ text, maxLength }) => {
4344
const truncatedText = text.length <= maxLength ? text : text.slice(0, maxLength) + "…";
44-
return <h3>{truncatedText}</h3>;
45+
return <h3 dir="auto">{truncatedText}</h3>;
4546
};
4647
interface IDisputeListView {
4748
title: string;

‎web/src/components/EvidenceCard.tsx

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

4-
import { landscapeStyle } from "styles/landscapeStyle";
5-
import { responsiveSize } from "styles/responsiveSize";
6-
import { hoverShortTransitionTiming } from "styles/commonStyles";
7-
84
import Identicon from "react-identicons";
95
import ReactMarkdown from "react-markdown";
106

@@ -19,6 +15,10 @@ import { shortenAddress } from "utils/shortenAddress";
1915

2016
import { type Evidence } from "src/graphql/graphql";
2117

18+
import { hoverShortTransitionTiming } from "styles/commonStyles";
19+
import { landscapeStyle } from "styles/landscapeStyle";
20+
import { responsiveSize } from "styles/responsiveSize";
21+
2222
import { ExternalLink } from "./ExternalLink";
2323
import { InternalLink } from "./InternalLink";
2424

@@ -58,6 +58,7 @@ const Index = styled.p`
5858
display: inline-block;
5959
`;
6060

61+
const ReactMarkdownWrapper = styled.div``;
6162
const StyledReactMarkdown = styled(ReactMarkdown)`
6263
a {
6364
font-size: 16px;
@@ -216,12 +217,18 @@ const EvidenceCard: React.FC<IEvidenceCard> = ({
216217

217218
return (
218219
<StyledCard>
219-
<TopContent>
220+
<TopContent dir="auto">
220221
<IndexAndName>
221222
<Index>#{index}: </Index>
222223
<h3>{name}</h3>
223224
</IndexAndName>
224-
{name && description ? <StyledReactMarkdown>{description}</StyledReactMarkdown> : <p>{evidence}</p>}
225+
{name && description ? (
226+
<ReactMarkdownWrapper dir="auto">
227+
<StyledReactMarkdown>{description}</StyledReactMarkdown>
228+
</ReactMarkdownWrapper>
229+
) : (
230+
<p>{evidence}</p>
231+
)}
225232
</TopContent>
226233
<BottomShade>
227234
<BottomLeftContent>

‎web/src/components/Field.tsx

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

56
import { InternalLink } from "./InternalLink";
@@ -99,7 +100,7 @@ const Field: React.FC<IField> = ({
99100
className,
100101
}) => {
101102
return (
102-
<FieldContainer isList={displayAsList} {...{ isOverview, isJurorBalance, width, className }}>
103+
<FieldContainer dir="auto" isList={displayAsList} {...{ isOverview, isJurorBalance, width, className }}>
103104
<Icon />
104105
{(!displayAsList || isOverview || isJurorBalance) && <label>{name}:</label>}
105106
{link ? (

‎web/src/components/LabeledInput.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const LabeledInput: React.FC<ILabeledInput> = (props) => {
3030
return (
3131
<Container>
3232
{!isUndefined(props.label) ? <StyledLabel id={props.label}>{props.label}</StyledLabel> : null}
33-
<StyledField {...props} id={props?.label} />
33+
<StyledField dir="auto" {...props} id={props?.label} />
3434
</Container>
3535
);
3636
};

‎web/src/components/Verdict/Answer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ const AnswerDisplay: React.FC<IAnswer> = ({ answer, currentRuling }) => {
2222
return (
2323
<>
2424
{answer ? (
25-
<AnswerTitleAndDescription>
25+
<AnswerTitleAndDescription dir="auto">
2626
<AnswerTitle>{answer.title}</AnswerTitle>
2727
<AnswerDescription>{answer.description.trim() ? ` - ${answer.description}` : null}</AnswerDescription>
2828
</AnswerTitleAndDescription>

‎web/src/components/Verdict/FinalDecision.tsx

+9-5
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ import { useAccount } from "wagmi";
77

88
import ArrowIcon from "svgs/icons/arrow.svg";
99

10+
import { DEFAULT_CHAIN } from "consts/chains";
1011
import { REFETCH_INTERVAL } from "consts/index";
1112
import { Periods } from "consts/periods";
12-
import { DEFAULT_CHAIN } from "consts/chains";
1313
import { useReadKlerosCoreCurrentRuling } from "hooks/contracts/generated";
1414
import { usePopulatedDisputeData } from "hooks/queries/usePopulatedDisputeData";
1515
import { useVotingHistory } from "hooks/queries/useVotingHistory";
@@ -21,11 +21,12 @@ import { useDisputeDetailsQuery } from "queries/useDisputeDetailsQuery";
2121

2222
import { responsiveSize } from "styles/responsiveSize";
2323

24-
import RulingAndRewardsIndicators from "./RulingAndRewardsIndicators";
25-
import AnswerDisplay from "./Answer";
2624
import { Divider } from "../Divider";
2725
import { StyledArrowLink } from "../StyledArrowLink";
2826

27+
import AnswerDisplay from "./Answer";
28+
import RulingAndRewardsIndicators from "./RulingAndRewardsIndicators";
29+
2930
const Container = styled.div`
3031
width: 100%;
3132
`;
@@ -36,11 +37,14 @@ const JuryContainer = styled.div`
3637
flex-wrap: wrap;
3738
align-items: center;
3839
gap: 4px 7px;
39-
40+
flex: 1;
4041
h3 {
4142
line-height: 21px;
4243
margin-bottom: 0px;
4344
}
45+
> div {
46+
flex: 1;
47+
}
4448
`;
4549

4650
const VerdictContainer = styled.div`
@@ -98,7 +102,7 @@ const FinalDecision: React.FC<IFinalDecision> = ({ arbitrable }) => {
98102
if (isVotingPeriod && isHiddenVotes && commited && !hasVoted) return "Reveal your vote";
99103
if (isVotingPeriod && !isHiddenVotes && !hasVoted) return "Cast your vote";
100104
return "Check how the jury voted";
101-
}, [wasDrawn, hasVoted, isCommitPeriod, isVotingPeriod, commited, isHiddenVotes]);
105+
}, [wasDrawn, hasVoted, isCommitPeriod, isVotingPeriod, commited, isHiddenVotes, isDisconnected]);
102106

103107
return (
104108
<Container>

‎web/src/layout/Header/navbar/Menu/Settings/Notifications/FormContactDetails/FormContact.tsx

+2
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import React, { Dispatch, SetStateAction, useMemo, useEffect } from "react";
22
import styled from "styled-components";
33

44
import { Field } from "@kleros/ui-components-library";
5+
56
import { isEmpty } from "src/utils";
67

78
const StyledLabel = styled.label`
@@ -58,6 +59,7 @@ const FormContact: React.FC<IForm> = ({
5859
<>
5960
<StyledLabel>{contactLabel}</StyledLabel>
6061
<StyledField
62+
dir="auto"
6163
variant={fieldVariant}
6264
value={contactInput}
6365
onChange={handleInputChange}

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

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

4949
<SearchContainer>
5050
<StyledSearchBar
51+
dir="auto"
5152
placeholder="Search evidence by number, word, or submitter"
5253
onChange={(e) => setSearch(e.target.value)}
5354
value={search}

‎web/src/pages/Cases/CaseDetails/Evidence/SubmitEvidenceModal.tsx

+9-3
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,16 @@ import styled from "styled-components";
44
import Modal from "react-modal";
55
import { useWalletClient, usePublicClient, useConfig } from "wagmi";
66

7+
import { useAtlasProvider, Roles } from "@kleros/kleros-app";
78
import { Textarea, Button, FileUploader } from "@kleros/ui-components-library";
89

9-
import { useAtlasProvider, Roles } from "@kleros/kleros-app";
1010
import { simulateEvidenceModuleSubmitEvidence } from "hooks/contracts/generated";
1111
import { wrapWithToast, errorToast, infoToast, successToast } from "utils/wrapWithToast";
1212

13+
import { isEmpty } from "src/utils";
14+
1315
import EnsureAuth from "components/EnsureAuth";
1416
import { EnsureChain } from "components/EnsureChain";
15-
import { isEmpty } from "src/utils";
1617

1718
const StyledModal = styled(Modal)`
1819
position: absolute;
@@ -91,7 +92,12 @@ const SubmitEvidenceModal: React.FC<{
9192
return (
9293
<StyledModal {...{ isOpen }} shouldCloseOnEsc shouldCloseOnOverlayClick onRequestClose={close}>
9394
<h1>Submit New Evidence</h1>
94-
<StyledTextArea value={message} onChange={(e) => setMessage(e.target.value)} placeholder="Your Arguments" />
95+
<StyledTextArea
96+
dir="auto"
97+
value={message}
98+
onChange={(e) => setMessage(e.target.value)}
99+
placeholder="Your Arguments"
100+
/>
95101
<StyledFileUploader callback={(file: File) => setFile(file)} />
96102
<ButtonArea>
97103
<Button variant="secondary" disabled={isSending} text="Return" onClick={close} />

‎web/src/pages/Cases/CaseDetails/Voting/Classic/JustificationArea.tsx

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ interface IJustificationArea {
2323

2424
const JustificationArea: React.FC<IJustificationArea> = ({ justification, setJustification }) => (
2525
<StyledTextarea
26+
dir="auto"
2627
value={justification}
2728
onChange={(e) => setJustification(e.target.value)}
2829
placeholder="Justify your vote..."

‎web/src/pages/Cases/CaseDetails/Voting/Classic/OptionsContainer.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ const Options: React.FC<IOptions> = ({ arbitrable, handleSelection, justificatio
6565

6666
return id ? (
6767
<>
68-
<MainContainer>
68+
<MainContainer dir="auto">
6969
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
7070
{!isUndefined(justification) && !isUndefined(setJustification) ? (
7171
<JustificationArea {...{ justification, setJustification }} />

‎web/src/pages/Cases/CaseDetails/Voting/Classic/Reveal.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ const StyledButton = styled(Button)`
3434
margin: 16px auto;
3535
`;
3636

37+
const ReactMarkdownWrapper = styled.div``;
3738
interface IReveal {
3839
arbitrable: `0x${string}`;
3940
voteIDs: string[];
@@ -100,7 +101,9 @@ const Reveal: React.FC<IReveal> = ({ arbitrable, voteIDs, setIsOpen, commit, isR
100101
<StyledInfoCard msg="Failed to commit on time." />
101102
) : isRevealPeriod ? (
102103
<>
103-
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
104+
<ReactMarkdownWrapper dir="auto">
105+
<ReactMarkdown>{disputeDetails?.question}</ReactMarkdown>
106+
</ReactMarkdownWrapper>
104107
<JustificationArea {...{ justification, setJustification }} />
105108
<StyledButton
106109
variant="secondary"

‎web/src/pages/Cases/CaseDetails/Voting/VotesDetails/index.tsx

+15-9
Original file line numberDiff line numberDiff line change
@@ -50,14 +50,16 @@ const AccordionContentContainer = styled.div`
5050
gap: 12px;
5151
`;
5252

53-
const JustificationText = styled.div`
53+
const LabelWrapper = styled.div`
54+
display: flex;
55+
gap: 4px;
56+
`;
57+
58+
const JustificationText = styled.label`
5459
color: ${({ theme }) => theme.secondaryText};
5560
font-size: 16px;
5661
line-height: 1.2;
57-
&:before {
58-
content: "Justification: ";
59-
color: ${({ theme }) => theme.primaryText};
60-
}
62+
flex: 1;
6163
`;
6264

6365
const StyledLabel = styled.label`
@@ -68,6 +70,7 @@ const StyledLabel = styled.label`
6870
const SecondaryTextLabel = styled.label`
6971
color: ${({ theme }) => theme.secondaryText};
7072
font-size: 16px;
73+
flex: 1;
7174
`;
7275

7376
const AccordionContent: React.FC<{
@@ -77,13 +80,16 @@ const AccordionContent: React.FC<{
7780
}> = ({ justification, choice, answers }) => (
7881
<AccordionContentContainer>
7982
{!isUndefined(choice) && (
80-
<div>
83+
<LabelWrapper>
8184
<StyledLabel>Voted:&nbsp;</StyledLabel>
82-
<SecondaryTextLabel>{getVoteChoice(parseInt(choice), answers)}</SecondaryTextLabel>
83-
</div>
85+
<SecondaryTextLabel dir="auto">{getVoteChoice(parseInt(choice), answers)}</SecondaryTextLabel>
86+
</LabelWrapper>
8487
)}
8588
{justification ? (
86-
<JustificationText>{justification}</JustificationText>
89+
<LabelWrapper>
90+
<StyledLabel>Justification:&nbsp;</StyledLabel>
91+
<JustificationText dir="auto">{justification}</JustificationText>
92+
</LabelWrapper>
8793
) : (
8894
<SecondaryTextLabel>No justification provided</SecondaryTextLabel>
8995
)}

0 commit comments

Comments
 (0)
Please sign in to comment.