Skip to content

Commit f0c5d3f

Browse files
committed
refactor(web): center-connect-button-in-fund-input
1 parent dea63d5 commit f0c5d3f

File tree

2 files changed

+41
-37
lines changed

2 files changed

+41
-37
lines changed

web/src/pages/Cases/CaseDetails/Appeal/Classic/Fund.tsx

Lines changed: 31 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import { useSelectedOptionContext, useFundingContext, useCountdownContext } from
1414
const Container = styled.div`
1515
display: flex;
1616
flex-direction: column;
17+
align-items: center;
1718
gap: 8px;
1819
`;
1920

@@ -34,9 +35,12 @@ const StyledField = styled(Field)`
3435

3536
const StyledButton = styled(Button)`
3637
margin: auto;
37-
margin-top: 12px;
38+
margin-top: 4px;
3839
`;
3940

41+
const StyledLabel = styled.label`
42+
align-self: flex-start;
43+
`;
4044
const useNeedFund = () => {
4145
const { loserSideCountdown } = useCountdownContext();
4246
const { fundedChoices, winningChoice } = useFundingContext();
@@ -95,36 +99,34 @@ const Fund: React.FC<IFund> = ({ amount, setAmount, setIsOpen }) => {
9599

96100
return needFund ? (
97101
<Container>
98-
<label>How much ETH do you want to contribute?</label>
99-
<div>
100-
<StyledField
101-
type="number"
102-
value={amount}
103-
onChange={(e) => {
104-
setAmount(e.target.value);
102+
<StyledLabel>How much ETH do you want to contribute?</StyledLabel>
103+
<StyledField
104+
type="number"
105+
value={amount}
106+
onChange={(e) => {
107+
setAmount(e.target.value);
108+
}}
109+
placeholder="Amount to fund"
110+
/>
111+
<EnsureChain>
112+
<StyledButton
113+
disabled={isFundDisabled}
114+
isLoading={isSending}
115+
text={isDisconnected ? "Connect to Fund" : "Fund"}
116+
onClick={() => {
117+
if (fundAppeal) {
118+
setIsSending(true);
119+
wrapWithToast(async () => await fundAppeal().then((response) => response.hash), publicClient)
120+
.then((res) => {
121+
res.status && setIsOpen(true);
122+
})
123+
.finally(() => {
124+
setIsSending(false);
125+
});
126+
}
105127
}}
106-
placeholder="Amount to fund"
107128
/>
108-
<EnsureChain>
109-
<StyledButton
110-
disabled={isFundDisabled}
111-
isLoading={isSending}
112-
text={isDisconnected ? "Connect to Fund" : "Fund"}
113-
onClick={() => {
114-
if (fundAppeal) {
115-
setIsSending(true);
116-
wrapWithToast(async () => await fundAppeal().then((response) => response.hash), publicClient)
117-
.then((res) => {
118-
res.status && setIsOpen(true);
119-
})
120-
.finally(() => {
121-
setIsSending(false);
122-
});
123-
}
124-
}}
125-
/>
126-
</EnsureChain>
127-
</div>
129+
</EnsureChain>
128130
</Container>
129131
) : (
130132
<></>

web/src/pages/Cases/CaseDetails/Appeal/Classic/StageExplainer.tsx

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,26 +40,28 @@ interface IStageExplainer {
4040
}
4141

4242
const StageOneExplanation: React.FC = () => (
43-
<>
43+
<div>
4444
{" "}
4545
<label>
4646
Losing options can only be funded <small>before</small> the deadline.
4747
</label>
4848
<label>
4949
If no losing option is <small>fully funded</small> in time, the jury decision is maintained.
5050
</label>
51-
</>
51+
</div>
5252
);
5353

5454
const StageTwoExplanation: React.FC = () => {
5555
const { fundedChoices } = useFundingContext();
5656
const options = useOptionsContext();
5757
return (
58-
<>
59-
<label>Loser deadline has finalized, you can only fund the current winner.</label>
58+
<div>
6059
<label>
61-
The sum of funds must reach 100%. If it's not fully funded in time the option fully funded at stage 1 is
62-
declared the winner of the case.{" "}
60+
Loser deadline has <small>finalized</small>, you can only fund the current winner.
61+
</label>
62+
<label>
63+
The sum of funds must reach 100%. If it's not fully funded in time the option fully funded at{" "}
64+
<small>stage 1</small> is declared the winner of the case.{" "}
6365
</label>
6466
<label>
6567
{" "}
@@ -72,7 +74,7 @@ const StageTwoExplanation: React.FC = () => {
7274
: null}
7375
</small>
7476
</label>
75-
</>
77+
</div>
7678
);
7779
};
7880

@@ -87,7 +89,7 @@ const StageExplainer: React.FC<IStageExplainer> = ({ countdown, stage }) => {
8789
</>
8890
) : null}
8991
</CountdownLabel>
90-
<div>{stage === 1 ? <StageOneExplanation /> : <StageTwoExplanation />}</div>
92+
{stage === 1 ? <StageOneExplanation /> : <StageTwoExplanation />}
9193
</StyledBox>
9294
);
9395
};

0 commit comments

Comments
 (0)