Skip to content

Commit 8e78b4f

Browse files
authored
Merge pull request #32 from syscoin/terms-and-conditions
feat: add terms and conditions
2 parents 9909069 + 6648c5e commit 8e78b4f

File tree

2 files changed

+31
-2
lines changed

2 files changed

+31
-2
lines changed

components/Bridge/v3/Steps/ConnectValidate.tsx

Lines changed: 31 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ import { CheckCircleOutline, CloseOutlined } from "@mui/icons-material";
33
import {
44
Box,
55
Button,
6+
Checkbox,
7+
FormControlLabel,
68
InputAdornment,
79
TextField,
810
Typography,
@@ -21,6 +23,7 @@ import { ITransfer, TransferStatus } from "@contexts/Transfer/types";
2123
import { useRouter } from "next/router";
2224
import { MIN_AMOUNT } from "@constants";
2325
import { useFeatureFlags } from "../hooks/useFeatureFlags";
26+
import Link from "next/link";
2427

2528
const ErrorMessage = ({ message }: { message: string }) => (
2629
<Box sx={{ display: "flex", mb: 2 }}>
@@ -36,6 +39,7 @@ type ConnectValidateFormData = {
3639
nevmAddress: string;
3740
utxoAddress: string;
3841
utxoXpub: string;
42+
agreeTermsAndConditions: boolean;
3943
};
4044

4145
type BridgeV3ConnectValidateStepProps = {
@@ -52,7 +56,7 @@ const BridgeV3ConnectValidateStep: React.FC<
5256
const {
5357
register,
5458
setValue,
55-
formState: { errors },
59+
formState: { errors, isValid },
5660
handleSubmit,
5761
watch,
5862
} = useForm<ConnectValidateFormData>({
@@ -62,6 +66,7 @@ const BridgeV3ConnectValidateStep: React.FC<
6266
nevmAddress: "",
6367
utxoAddress: "",
6468
utxoXpub: "",
69+
agreeTermsAndConditions: false,
6570
},
6671
});
6772

@@ -106,7 +111,8 @@ const BridgeV3ConnectValidateStep: React.FC<
106111
(!isNevmNotEnoughGas || foundationFundingAvailable);
107112
const isAmountValid = errors.amount === undefined;
108113
const balanceFetched = utxoBalance.isFetched && nevmBalance.isFetched;
109-
const isReady = isUtxoValid && isNevmValid && isAmountValid && balanceFetched;
114+
const isReady =
115+
isUtxoValid && isNevmValid && isAmountValid && balanceFetched && isValid;
110116

111117
const onSubmit: SubmitHandler<ConnectValidateFormData> = (data) => {
112118
const { amount, ...rest } = data;
@@ -204,6 +210,29 @@ const BridgeV3ConnectValidateStep: React.FC<
204210
helperText={<>{errors.amount && errors.amount.message}</>}
205211
sx={{ mb: 2 }}
206212
/>
213+
<Box>
214+
<FormControlLabel
215+
control={
216+
<Checkbox
217+
{...register("agreeTermsAndConditions", { required: true })}
218+
color="primary"
219+
></Checkbox>
220+
}
221+
label={
222+
<Typography variant="body1">
223+
I agree the{" "}
224+
<Typography
225+
component={Link}
226+
color="primary"
227+
target="_blank"
228+
href="/Syscoin Terms and Conditions.pdf"
229+
>
230+
terms and conditions.
231+
</Typography>
232+
</Typography>
233+
}
234+
/>
235+
</Box>
207236
{isReady && (
208237
<Box sx={{ display: "flex", mb: 2 }}>
209238
<Typography variant="body1">
86.4 KB
Binary file not shown.

0 commit comments

Comments
 (0)