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

chore: ui improvements (detailed inside) #1786

Merged
merged 7 commits into from
Dec 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 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
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
2 changes: 1 addition & 1 deletion web/src/components/ErrorFallback.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const Container = styled.div`
height: 100vh;
background-color: ${({ theme }) => theme.lightBackground};
padding: ${responsiveSize(32, 80)} ${responsiveSize(24, 136)} ${responsiveSize(76, 96)};
max-width: 1780px;
max-width: 1400px;
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
2 changes: 1 addition & 1 deletion web/src/pages/Cases/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,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: 1400px;
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
27 changes: 14 additions & 13 deletions web/src/pages/Courts/CourtDetails/StakePanel/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,35 +15,35 @@ const Container = styled.div`
position: relative;
display: flex;
flex-direction: column;
gap: 28px;
gap: 16px;

${landscapeStyle(
() => css`
gap: 24px;
flex-direction: column;
`
)};
`;

const LeftArea = styled.div`
const StakingArea = styled.div`
display: flex;
flex-direction: column;
gap: 24px;
`;

const TagArea = styled.div`
display: flex;
gap: 10px;
`;

const StakeArea = styled(TagArea)`
margin-top: 28px;
flex-direction: column;
`;

const TextArea = styled.div`
margin-top: 32px;
color: ${({ theme }) => theme.primaryText};
`;

const InputArea = styled(TagArea)`
flex-direction: column;
`;

const StakePanel: React.FC<{ courtName: string }> = ({ courtName = "General Court" }) => {
const [amount, setAmount] = useState("");
const [isActive, setIsActive] = useState<boolean>(true);
Expand All @@ -57,19 +57,20 @@ const StakePanel: React.FC<{ courtName: string }> = ({ courtName = "General Cour
const isStaking = action === ActionType.stake;
return (
<Container>
<LeftArea>
<StakingArea>
<TagArea>
<Tag text="Stake" active={isActive} onClick={() => handleClick(ActionType.stake)} />
<Tag text="Withdraw" active={!isActive} onClick={() => handleClick(ActionType.withdraw)} />
</TagArea>
<TextArea>
<strong>{`${isStaking ? "Stake" : "Withdraw"} PNK`}</strong> {`${isStaking ? "to join the" : "from"}`}{" "}
{courtName} court
{courtName}
{courtName.toLowerCase().endsWith("court") || courtName.toLowerCase().startsWith("corte") ? null : " Court"}
</TextArea>
<StakeArea>
<InputArea>
<InputDisplay {...{ action, amount, setAmount }} />
</StakeArea>
</LeftArea>
</InputArea>
</StakingArea>
<Simulator amountToStake={amount ? Number(uncommify(amount)) : 0} {...{ isStaking }} />
</Container>
);
Expand Down
Loading
Loading