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

Release v2-testnet-4.0.3 #1803

Merged
merged 11 commits into from
Dec 18, 2024
2 changes: 1 addition & 1 deletion web-devtools/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
},
"dependencies": {
"@kleros/kleros-sdk": "workspace:^",
"@kleros/ui-components-library": "^2.15.0",
"@kleros/ui-components-library": "^2.19.0",
"@tanstack/react-query": "^5.61.0",
"@wagmi/connectors": "^5.5.0",
"@wagmi/core": "^2.15.0",
Expand Down
2 changes: 1 addition & 1 deletion web-devtools/src/app/(main)/(homepage)/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import Tools from "./Tools";
const Container = styled.div`
width: 100%;
background-color: ${({ theme }) => theme.klerosUIComponentsLightBackground};
padding: ${responsiveSize(32, 72)} ${responsiveSize(24, 132)} ${responsiveSize(76, 96)};
padding: ${responsiveSize(32, 72)} ${responsiveSize(8, 132)} ${responsiveSize(76, 96)};
max-width: 1780px;
margin: 0 auto;
`;
Expand Down
2 changes: 1 addition & 1 deletion web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
"@kleros/kleros-app": "^2.0.1",
"@kleros/kleros-sdk": "workspace:^",
"@kleros/kleros-v2-contracts": "workspace:^",
"@kleros/ui-components-library": "^2.18.0",
"@kleros/ui-components-library": "^2.19.0",
"@lifi/wallet-management": "^3.4.6",
"@lifi/widget": "^3.12.3",
"@sentry/react": "^7.120.0",
Expand Down
83 changes: 41 additions & 42 deletions web/src/assets/svgs/hero/hero-darkmode-desktop.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
8 changes: 4 additions & 4 deletions web/src/assets/svgs/hero/hero-darkmode-mobile.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: 2 additions & 1 deletion web/src/components/CasesDisplay/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,11 @@ const TitleContainer = styled.div`

const StyledTitle = styled.h1`
margin: 0px;
font-size: ${responsiveSize(20, 24)};
`;

const StyledLabel = styled.label`
font-size: 16px;
font-size: ${responsiveSize(14, 16)};
`;

interface ICasesDisplay extends ICasesGrid {
Expand Down
40 changes: 25 additions & 15 deletions web/src/components/DisputePreview/DisputeContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ import { ExternalLink } from "../ExternalLink";
const StyledH1 = styled.h1`
margin: 0;
word-wrap: break-word;
font-size: ${responsiveSize(18, 24)};
line-height: 24px;
`;

const ReactMarkdownWrapper = styled.div`
Expand All @@ -36,17 +38,25 @@ const VotingOptions = styled.div`
const AnswersContainer = styled.div`
display: flex;
flex-direction: column;
gap: ${responsiveSize(4, 2)};
`;

const AnswersHeader = styled.h3`
const AnswersHeader = styled.small`
margin: 0;
`;
Comment on lines +44 to 46
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Consider semantic HTML implications

Changing from h3 to small reduces the semantic importance of the "Voting Options" header. Consider using a proper heading element with styled size instead to maintain semantic structure.

-const AnswersHeader = styled.small`
+const AnswersHeader = styled.h3`
  margin: 0;
+  font-size: 0.875rem;
`;
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const AnswersHeader = styled.small`
margin: 0;
`;
const AnswersHeader = styled.h3`
margin: 0;
font-size: 0.875rem;
`;


const Answer = styled.div`
margin: 0px;
display: flex;
flex-wrap: wrap;
gap: 6px;
export const AnswerTitleAndDescription = styled.div`
display: block;
`;

export const AnswerTitle = styled.small`
display: inline;
`;

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

const AliasesContainer = styled.div`
Expand All @@ -62,11 +72,12 @@ interface IDisputeContext {

export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRpcError = false }) => {
const errMsg = isRpcError ? RPC_ERROR : INVALID_DISPUTE_DATA_ERROR;

return (
<>
<StyledH1>{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}</StyledH1>
{!isUndefined(disputeDetails) ? (
<>
{disputeDetails?.question?.trim() || disputeDetails?.description?.trim() ? (
<div>
{disputeDetails?.question?.trim() ? (
<ReactMarkdownWrapper>
<ReactMarkdown>{disputeDetails.question}</ReactMarkdown>
Expand All @@ -77,7 +88,7 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
<ReactMarkdown>{disputeDetails.description}</ReactMarkdown>
</ReactMarkdownWrapper>
) : null}
</>
</div>
) : null}

{isUndefined(disputeDetails?.frontendUrl) ? null : (
Expand All @@ -89,12 +100,11 @@ export const DisputeContext: React.FC<IDisputeContext> = ({ disputeDetails, isRp
{isUndefined(disputeDetails) ? null : <AnswersHeader>Voting Options</AnswersHeader>}
<AnswersContainer>
{disputeDetails?.answers?.map((answer: IAnswer, i: number) => (
<Answer key={answer.title}>
<small>
<label>{i + 1}.</label> {answer.title}
{answer.description.trim() ? ` - ${answer.description}` : null}
</small>
</Answer>
<AnswerTitleAndDescription key={answer.title}>
<label>{i + 1}. </label>
<AnswerTitle>{answer.title}</AnswerTitle>
<AnswerDescription>{answer.description.trim() ? ` - ${answer.description}` : null}</AnswerDescription>
</AnswerTitleAndDescription>
))}
</AnswersContainer>
</VotingOptions>
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/DisputePreview/Policies.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const Container = styled.div`
flex-direction: row;
flex-wrap: wrap;
gap: 8px 16px;
padding: ${responsiveSize(16, 20)} ${responsiveSize(16, 32)};
padding: ${responsiveSize(12, 20)} ${responsiveSize(8, 32)};
background-color: ${({ theme }) => theme.mediumBlue};
`;

Expand Down
2 changes: 1 addition & 1 deletion web/src/components/DisputeView/DisputeCardView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ const StyledCard = styled(Card)`

const CardContainer = styled.div`
height: calc(100% - 45px);
padding: ${responsiveSize(20, 24)};
padding: ${responsiveSize(20, 24)} ${responsiveSize(8, 24)};
display: flex;
flex-direction: column;
justify-content: space-between;
Expand Down
2 changes: 1 addition & 1 deletion web/src/components/DisputeView/PeriodBanner.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ const Container = styled.div<IContainer>`
align-items: center;
gap: 8px;
justify-content: space-between;
padding: 0 ${({ isCard }) => (isCard ? "24px" : responsiveSize(8, 24, 900))};
padding: 0 ${({ isCard }) => (isCard ? responsiveSize(8, 24) : responsiveSize(8, 24, 900))};
flex-shrink: 0;
${({ frontColor, backgroundColor, isCard }) => {
return `
Expand Down
4 changes: 2 additions & 2 deletions web/src/components/EvidenceCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ const StyledCard = styled(Card)`
const TopContent = styled.div`
display: flex;
flex-direction: column;
padding: ${responsiveSize(8, 24)};
gap: ${responsiveSize(4, 8)};
padding: ${responsiveSize(8, 20)} ${responsiveSize(8, 24)};
gap: 4px;
overflow-wrap: break-word;

> * {
Expand Down
3 changes: 2 additions & 1 deletion web/src/components/FavoriteCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@ import DisputeView from "components/DisputeView";
import { SkeletonDisputeCard } from "components/StyledSkeleton";

const Container = styled.div`
margin-top: ${responsiveSize(48, 80)};
margin-top: ${responsiveSize(24, 48)};
`;

const Title = styled.h1`
margin-bottom: 4px;
font-size: ${responsiveSize(20, 24)};
`;

const DisputeContainer = styled.div`
Expand Down
1 change: 1 addition & 0 deletions web/src/components/LatestCases.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ const Container = styled.div`

const Title = styled.h1`
margin-bottom: ${responsiveSize(12, 24)};
font-size: ${responsiveSize(20, 24)};
`;

const DisputeContainer = styled.div`
Expand Down
18 changes: 18 additions & 0 deletions web/src/components/OverlayPortal.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from "react";
import ReactDOM from "react-dom";
import styled from "styled-components";

const PortalContainer = styled.div`
position: fixed;
top: 0;
left: 0;
z-index: 9999;
width: 100%;
height: 100%;
`;

const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body);
};
Comment on lines +14 to +16
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Add cleanup handling for portal.

Consider adding cleanup handling using useEffect to prevent potential memory leaks.

 const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
-  return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body);
+  const portalRoot = document.body;
+  const el = document.createElement('div');
+  
+  React.useEffect(() => {
+    portalRoot.appendChild(el);
+    return () => {
+      portalRoot.removeChild(el);
+    };
+  }, []);
+  
+  return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, el);
 };
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, document.body);
};
const OverlayPortal: React.FC<{ children: React.ReactNode }> = ({ children }) => {
const portalRoot = document.body;
const el = document.createElement('div');
React.useEffect(() => {
portalRoot.appendChild(el);
return () => {
portalRoot.removeChild(el);
};
}, []);
return ReactDOM.createPortal(<PortalContainer>{children}</PortalContainer>, el);
};


export default OverlayPortal;
13 changes: 6 additions & 7 deletions web/src/components/Verdict/Answer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import styled from "styled-components";

import { Answer } from "@kleros/kleros-sdk/src/dataMappings/utils/disputeDetailsTypes";

import { AnswerDescription, AnswerTitle, AnswerTitleAndDescription } from "../DisputePreview/DisputeContext";

const Container = styled.div`
display: flex;
flex-direction: row;
Expand All @@ -20,13 +22,10 @@ const AnswerDisplay: React.FC<IAnswer> = ({ answer, currentRuling }) => {
return (
<>
{answer ? (
<Container>
<small>
{answer.title}
{answer.description.trim() ? " -" : null}
</small>
<small>{answer.description.trim()}</small>
</Container>
<AnswerTitleAndDescription>
<AnswerTitle>{answer.title}</AnswerTitle>
<AnswerDescription>{answer.description.trim() ? ` - ${answer.description}` : null}</AnswerDescription>
</AnswerTitleAndDescription>
) : (
<Container>
{currentRuling !== 0 ? <small>Answer 0x{currentRuling}</small> : <small>Refuse to Arbitrate</small>}
Expand Down
1 change: 0 additions & 1 deletion web/src/components/Verdict/FinalDecision.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ const VerdictContainer = styled.div`

const JuryDecisionTag = styled.small`
font-weight: 400;
line-height: 19px;
color: ${({ theme }) => theme.secondaryText};
`;

Expand Down
4 changes: 3 additions & 1 deletion web/src/components/Verdict/index.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
import React from "react";
import styled from "styled-components";

import { responsiveSize } from "styles/responsiveSize";

import DisputeTimeline from "./DisputeTimeline";
import FinalDecision from "./FinalDecision";

const Container = styled.div`
display: flex;
flex-wrap: wrap;
gap: 24px;
gap: ${responsiveSize(16, 24)};
`;

interface IVerdict {
Expand Down
2 changes: 1 addition & 1 deletion web/src/layout/Footer/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { ExternalLink } from "components/ExternalLink";
const Container = styled.div`
height: 122px;
width: 100%;
background-color: ${({ theme }) => theme.primaryPurple};
background-color: ${({ theme }) => (theme.name === "dark" ? theme.lightBlue : theme.primaryPurple)};
display: flex;
flex-direction: column;
justify-content: center;
Expand Down
Loading
Loading