Commit d407ba41 by Arjun Jhukal

updated the new changesg

parent 09f43e01
...@@ -8,24 +8,24 @@ import CoinCalculator from './CoinCalculator' ...@@ -8,24 +8,24 @@ import CoinCalculator from './CoinCalculator'
export default function BuyCoinSinlgeGame({ slug }: { slug: string }) { export default function BuyCoinSinlgeGame({ slug }: { slug: string }) {
const packs = [ const packs = [
{ {
amount: "10",
label: "Starter Pack",
coin: "1000",
bonus: "10",
tag: "popular"
},
{
amount: "20", amount: "20",
label: "Golden Pack", label: "Starter Pack",
coin: "2000", coin: "2000",
bonus: "20", bonus: "20",
tag: "popular"
}, },
{ {
amount: "50", amount: "50",
label: "Legend Pack", label: "Golden Pack",
coin: "5000", coin: "5000",
bonus: "50", bonus: "50",
}, },
{
amount: "100",
label: "Legend Pack",
coin: "10000",
bonus: "100",
},
] ]
return ( return (
......
...@@ -208,7 +208,7 @@ export default function WithdrawlModal({ ...@@ -208,7 +208,7 @@ export default function WithdrawlModal({
<div className="flex flex-col md:grid grid-cols-2 gap-4"> <div className="flex flex-col md:grid grid-cols-2 gap-4">
{fields.map((field) => ( {fields.map((field) => (
<div className={field.type === "IDSelfieCollection" ? "col-span-2" : "col-span-1"} key={field.token}> <div className={field.type === "IDSelfieCollection" ? "col-span-2" : "col-span-1"} key={field.token}>
{field.type === "IDSelfieCollection" ? <Link href={field.value} className="bg-primary-grad ss-btn">{field.label}</Link> : <RenderFields field={field} formik={formik} />} {field.type === "IDSelfieCollection" ? <Link href={field.value} className="bg-primary-grad ss-btn">{field.label}</Link> : <RenderFields field={field} formik={formik} disabled={fields.some(field => field.type === "IDSelfieCollection") || isLoading} />}
</div> </div>
))} ))}
</div> </div>
...@@ -246,6 +246,7 @@ export default function WithdrawlModal({ ...@@ -246,6 +246,7 @@ export default function WithdrawlModal({
color="primary" color="primary"
fullWidth fullWidth
type="submit" type="submit"
disabled={fields.some(field => field.type === "IDSelfieCollection") || isLoading}
> >
{isLoading ? "Processing..." : "Withdraw Now"} {isLoading ? "Processing..." : "Withdraw Now"}
</Button> </Button>
......
...@@ -9,9 +9,10 @@ import { validateDynamicField } from "."; ...@@ -9,9 +9,10 @@ import { validateDynamicField } from ".";
interface RenderFieldsProps { interface RenderFieldsProps {
field: MasspayPaymentFields; field: MasspayPaymentFields;
formik: FormikProps<any>; formik: FormikProps<any>;
disabled?: boolean;
} }
export const RenderFields = ({ field, formik }: RenderFieldsProps) => { export const RenderFields = ({ field, formik, disabled }: RenderFieldsProps) => {
const fieldIndex = formik.values.payment_fields?.findIndex( const fieldIndex = formik.values.payment_fields?.findIndex(
(f: MasspayPaymentFields) => f.token === field.token (f: MasspayPaymentFields) => f.token === field.token
); );
...@@ -79,6 +80,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -79,6 +80,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
<div className="input__field text-left"> <div className="input__field text-left">
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<OutlinedInput <OutlinedInput
disabled={disabled}
fullWidth fullWidth
id={field.token} id={field.token}
name={`payment_fields.${field.token}`} name={`payment_fields.${field.token}`}
...@@ -101,6 +103,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -101,6 +103,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<FormControl fullWidth error={Boolean(fieldError)}> <FormControl fullWidth error={Boolean(fieldError)}>
<Select <Select
disabled={disabled}
id={field.token} id={field.token}
name={`payment_fields.${field.token}`} name={`payment_fields.${field.token}`}
value={fieldValue} value={fieldValue}
...@@ -130,6 +133,8 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -130,6 +133,8 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
<div className="input__field text-left"> <div className="input__field text-left">
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<OutlinedInput <OutlinedInput
disabled={disabled}
fullWidth fullWidth
id={field.token} id={field.token}
name={`payment_fields.${field.token}`} name={`payment_fields.${field.token}`}
...@@ -151,6 +156,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -151,6 +156,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<LocalizationProvider dateAdapter={AdapterDayjs}> <LocalizationProvider dateAdapter={AdapterDayjs}>
<DatePicker <DatePicker
disabled={disabled}
value={fieldValue ? dayjs(fieldValue) : null} value={fieldValue ? dayjs(fieldValue) : null}
onChange={(newValue) => handleChange(newValue)} onChange={(newValue) => handleChange(newValue)}
onClose={handleBlur} onClose={handleBlur}
...@@ -249,6 +255,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => { ...@@ -249,6 +255,7 @@ export const RenderFields = ({ field, formik }: RenderFieldsProps) => {
<div className="input__field text-left"> <div className="input__field text-left">
<InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel> <InputLabel>{field.label} <span className="text-red-500">*</span></InputLabel>
<OutlinedInput <OutlinedInput
disabled={disabled}
fullWidth fullWidth
id={field.token} id={field.token}
name={`payment_fields.${field.token}`} name={`payment_fields.${field.token}`}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment