Skip to content

Commit f5f2530

Browse files
committed
chore: tweak
1 parent 78508f5 commit f5f2530

File tree

3 files changed

+24
-18
lines changed

3 files changed

+24
-18
lines changed

web/src/components/DisputePreview/DisputeContext.tsx

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import React, { useMemo } from "react";
22
import styled from "styled-components";
33

44
import { DisputeDetails } from "@kleros/kleros-sdk/src/dataMappings/utils/disputeDetailsTypes";
5-
import { useParams } from "react-router-dom";
65
import { useAccount } from "wagmi";
76

87
import { INVALID_DISPUTE_DATA_ERROR, RPC_ERROR } from "consts/index";
@@ -87,18 +86,20 @@ const RulingAndRewardsAndLabels = styled.div`
8786

8887
interface IDisputeContext {
8988
disputeDetails?: DisputeDetails;
90-
dispute: DisputeDetailsQuery | undefined;
9189
isRpcError?: boolean;
92-
votingHistory: VotingHistoryQuery | undefined;
90+
dispute?: DisputeDetailsQuery | undefined;
91+
92+
disputeId?: string;
93+
votingHistory?: VotingHistoryQuery | undefined;
9394
}
9495

9596
export const DisputeContext: React.FC<IDisputeContext> = ({
9697
disputeDetails,
97-
dispute,
9898
isRpcError = false,
99+
dispute,
100+
disputeId,
99101
votingHistory,
100102
}) => {
101-
const { id } = useParams();
102103
const { isDisconnected } = useAccount();
103104
const errMsg = isRpcError ? RPC_ERROR : INVALID_DISPUTE_DATA_ERROR;
104105
const rounds = votingHistory?.dispute?.rounds;
@@ -111,17 +112,22 @@ export const DisputeContext: React.FC<IDisputeContext> = ({
111112
<StyledH1 dir="auto">
112113
{isUndefined(disputeDetails) ? <StyledSkeleton /> : (disputeDetails?.title ?? errMsg)}
113114
</StyledH1>
114-
<RulingAndRewardsAndLabels>
115-
{!isUndefined(Boolean(dispute?.dispute?.ruled)) || jurorRewardsDispersed ? (
116-
<RulingAndRewardsIndicators
117-
ruled={Boolean(dispute?.dispute?.ruled)}
118-
jurorRewardsDispersed={jurorRewardsDispersed}
119-
/>
120-
) : null}
121-
{!isDisconnected ? (
122-
<CardLabel disputeId={id} round={rounds?.length - 1} isList={false} isOverview={true} />
123-
) : null}
124-
</RulingAndRewardsAndLabels>
115+
{!isUndefined(disputeDetails) &&
116+
!isUndefined(dispute) &&
117+
!isUndefined(disputeId) &&
118+
!isUndefined(votingHistory) ? (
119+
<RulingAndRewardsAndLabels>
120+
{!isUndefined(Boolean(dispute?.dispute?.ruled)) || jurorRewardsDispersed ? (
121+
<RulingAndRewardsIndicators
122+
ruled={Boolean(dispute?.dispute?.ruled)}
123+
jurorRewardsDispersed={jurorRewardsDispersed}
124+
/>
125+
) : null}
126+
{!isDisconnected ? (
127+
<CardLabel {...{ disputeId }} round={rounds?.length - 1} isList={false} isOverview={true} />
128+
) : null}
129+
</RulingAndRewardsAndLabels>
130+
) : null}
125131
<Divider />
126132
</TitleSection>
127133
{disputeDetails?.question?.trim() || disputeDetails?.description?.trim() ? (

web/src/components/DisputeView/DisputeInfo/DisputeInfoCard.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ const DisputeInfoCard: React.FC<IDisputeInfoCard> = ({ isOverview, showLabels, f
6060
item.display ? <StyledField key={item.name} {...(item as IField)} {...{ isOverview }} /> : null
6161
)}
6262
</RestOfFieldsContainer>
63-
{showLabels ? <CardLabel disputeId={disputeID} round={round - 1} /> : null}
63+
{showLabels ? <CardLabel disputeId={disputeID} round={round - 1} isList={false} /> : null}
6464
</Container>
6565
);
6666
};

web/src/pages/Cases/CaseDetails/Overview/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ const Overview: React.FC<IOverview> = ({ arbitrable, courtID, currentPeriodIndex
5656
return (
5757
<>
5858
<Container>
59-
<DisputeContext isRpcError={isError} {...{ votingHistory, disputeDetails, dispute }} />
59+
<DisputeContext isRpcError={isError} disputeId={id} {...{ votingHistory, disputeDetails, dispute }} />
6060
<Divider />
6161

6262
<Verdict {...{ arbitrable, votingHistory }} />

0 commit comments

Comments
 (0)