Skip to content

Commit 277992c

Browse files
committed
feat: dynamic popup text if shutter dispute kit
1 parent 16af2f7 commit 277992c

File tree

4 files changed

+22
-8
lines changed

4 files changed

+22
-8
lines changed

web/src/components/Popup/Description/VoteWithCommit.tsx

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,20 @@ import React from "react";
33
import { VoteDescriptionEmphasizedDate } from "components/Popup";
44

55
interface IVoteWithCommit {
6-
date: string;
6+
date?: string;
7+
automaticVoteReveal?: boolean;
78
}
89

9-
const VoteWithCommit: React.FC<IVoteWithCommit> = ({ date }) => {
10-
return (
10+
const VoteWithCommit: React.FC<IVoteWithCommit> = ({ date, automaticVoteReveal = false }) =>
11+
automaticVoteReveal ? (
12+
<div>Your vote is confirmed. It's kept secret until all jurors have cast their votes.</div>
13+
) : (
1114
<div>
1215
Your vote is confirmed. It's kept secret until all jurors have cast their votes.
1316
<VoteDescriptionEmphasizedDate>
1417
You'll need to justify and reveal your vote on {date}
1518
</VoteDescriptionEmphasizedDate>
1619
</div>
1720
);
18-
};
21+
1922
export default VoteWithCommit;

web/src/components/Popup/ExtraInfo/VoteWithCommitExtraInfo.tsx

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,15 @@ const StyledInfoCard = styled(InfoCard)`
1212
line-height: 19px;
1313
`;
1414

15-
const VoteWithCommitExtraInfo: React.FC = () => {
16-
return <StyledInfoCard msg="Subscribe to receive notifications to be reminded when the reveal time comes." />;
15+
interface Props {
16+
automaticVoteReveal?: boolean;
17+
}
18+
19+
const VoteWithCommitExtraInfo: React.FC<Props> = ({ automaticVoteReveal = false }) => {
20+
const msg = automaticVoteReveal
21+
? "Enable notifications to be updated about the progress of the case: Settings > Notifications"
22+
: "Enable notifications to be reminded when the reveal time comes: Settings > Notifications";
23+
return <StyledInfoCard msg={msg} />;
1724
};
25+
1826
export default VoteWithCommitExtraInfo;

web/src/components/Popup/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -168,6 +168,7 @@ interface IPopup {
168168
setIsOpen: (val: boolean) => void;
169169
setAmount?: (val: string) => void;
170170
isCommit?: boolean;
171+
automaticVoteReveal?: boolean;
171172
}
172173

173174
type PopupProps = IStakeWithdraw | IVoteWithoutCommit | IVoteWithCommit | IAppeal | IDisputeCreated | ISwapSuccess;
@@ -179,6 +180,7 @@ const Popup: React.FC<PopupProps & IPopup> = ({
179180
setIsOpen,
180181
setAmount,
181182
isCommit,
183+
automaticVoteReveal,
182184
...props
183185
}) => {
184186
const containerRef = useRef(null);
@@ -213,7 +215,7 @@ const Popup: React.FC<PopupProps & IPopup> = ({
213215
const { date } = props as IVoteWithCommit;
214216
PopupComponent = (
215217
<VoteDescriptionContainer>
216-
<VoteWithCommit date={date} />
218+
<VoteWithCommit {...{ date, automaticVoteReveal }} />
217219
</VoteDescriptionContainer>
218220
);
219221
break;
@@ -260,7 +262,7 @@ const Popup: React.FC<PopupProps & IPopup> = ({
260262
</IconContainer>
261263
)}
262264
{popupType === PopupType.STAKE_WITHDRAW && <StakeWithdrawExtraInfo />}
263-
{popupType === PopupType.VOTE_WITH_COMMIT && <VoteWithCommitExtraInfo />}
265+
{popupType === PopupType.VOTE_WITH_COMMIT && <VoteWithCommitExtraInfo {...{ automaticVoteReveal }} />}
264266
{popupType === PopupType.DISPUTE_CREATED && <DisputeCreatedExtraInfo />}
265267
{popupType !== PopupType.SWAP_SUCCESS && (
266268
<StyledButton

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,7 @@ const Voting: React.FC<IVoting> = ({ arbitrable, currentPeriodIndex, dispute })
111111
date={finalDate ? formatDate(finalDate) : ""}
112112
isCommit={false}
113113
setIsOpen={setIsPopupOpen}
114+
automaticVoteReveal={isShutterDisputeKit}
114115
/>
115116
)}
116117
{userWasDrawn && isCommitOrVotePeriod && !voted ? (

0 commit comments

Comments
 (0)