Skip to content

Commit

Permalink
chore: revert closing of registration
Browse files Browse the repository at this point in the history
  • Loading branch information
Shurtu-gal committed Nov 2, 2023
1 parent 6dedc2f commit ee3039f
Show file tree
Hide file tree
Showing 3 changed files with 74 additions and 77 deletions.
102 changes: 49 additions & 53 deletions src/components/Registration/RegistrationForm.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React, { useContext, useEffect } from 'react';
import { navigate } from 'gatsby';
import { toast } from 'react-toastify';
import { RegistrationContext } from './RegistrationContext';
import { Body1, Body2, ButtonText, Heading2, Heading4, Input } from '../shared';
import { Body2, ButtonText, Heading2, Input } from '../shared';
import { InputContainer, RegistrationCard, RegistrationCardTitle } from './styles';
import Button from '../shared/Button';
import { SHOW, verify, verifyAll } from './utils';
Expand Down Expand Up @@ -60,61 +60,57 @@ export const RegistrationForm = () => {
<RegistrationCard>
<RegistrationCardTitle>
<Heading2 style={{ textTransform: 'none' }}>
{isNITR ? 'Registration form' : 'Registration has been closed'}
{/* {isNITR ? 'Registration form' : 'Registration has been closed'} */}
Registration form
</Heading2>
{isNITR && (
<Body2 style={{ display: 'flex', gap: '16px' }}>
Student from NIT Rourkela
<ButtonText
onClick={() => setIsNITR((prev) => !prev)}
className='cursor-pointer'
outline
>
Change
</ButtonText>
</Body2>
)}
<Body2 style={{ display: 'flex', gap: '16px' }}>
{isNITR ? 'Student from NIT Rourkela' : 'Student from other college'}
<ButtonText onClick={() => setIsNITR((prev) => !prev)} className='cursor-pointer' outline>
Change
</ButtonText>
</Body2>
</RegistrationCardTitle>
{/* {isNITR ? ( */}
<>
<InputContainer>
{Object.entries(inputData)
.filter(([, value]) =>
isNITR ? SHOW.NITR.includes(value.show) : SHOW.NON_NITR.includes(value.show),
)
.map(([key, value], index, array) => {
let gridCols;
if (array.length <= 4) {
gridCols = 'span 4';
} else if (index === array.length - 1 && index % 2 === 0) {
gridCols = '2 / 4';
} else {
gridCols = 'span 2';
}

{isNITR ? (
<>
<InputContainer>
{Object.entries(inputData)
.filter(([, value]) => SHOW.NITR.includes(value.show))
.map(([key, value], index, array) => {
let gridCols;
if (array.length <= 4) {
gridCols = 'span 4';
} else if (index === array.length - 1 && index % 2 === 0) {
gridCols = '2 / 4';
} else {
gridCols = 'span 2';
}

return (
<div key={key} style={{ gridColumn: gridCols }}>
<Input
data={value}
key={key}
onChange={(e) => setInputValue(key, e.target.value)}
onBlur={onBlur}
/>
</div>
);
})}
</InputContainer>
return (
<div key={key} style={{ gridColumn: gridCols }}>
<Input
data={value}
key={key}
onChange={(e) => setInputValue(key, e.target.value)}
onBlur={onBlur}
/>
</div>
);
})}
</InputContainer>

<Button
type='submit'
variant='filled'
text='Register'
width='350px'
disabled={!verified && isNITR}
tooltip={verified ? '' : 'Verify your credentials'}
onClick={registerUser}
/>
</>
) : (
<Button
type='submit'
variant='filled'
text='Register'
width='350px'
disabled={!verified && isNITR}
tooltip={verified ? '' : 'Verify your credentials'}
onClick={registerUser}
/>
</>
{/* ) : (
<>
<Heading4 font='Inter' style={{ textAlign: 'center', maxWidth: '500px' }}>
Registration for non-NITR students has been closed.
Expand All @@ -129,7 +125,7 @@ export const RegistrationForm = () => {
</ButtonText>
</Body1>
</>
)}
)} */}
</RegistrationCard>
);
};
41 changes: 21 additions & 20 deletions src/pages/payment.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import React, { useContext, useEffect } from 'react';
import React, { useContext, useEffect, useState } from 'react';
import { toast } from 'react-toastify';
import { navigate } from 'gatsby';
// import { Body1, ButtonText, PaymentCard, PrivateRoute, SuccessCard } from '../components';
import { PaymentCard, PrivateRoute, SuccessCard } from '../components';
import { AuthContext } from '../utils/Auth';
import { PaymentCardContainer } from '../components/Payment/styles';
import { Body2, Heading4, PrivateRoute } from '../components/shared';
// import { PaymentCardContainer } from '../components/Payment/styles';
// import { Body2, Heading4, PrivateRoute } from '../components/shared';

const PaymentPage = () => {
// const [paymentStatus, setPaymentStatus] = useState(false);
const [paymentStatus, setPaymentStatus] = useState(false);
const { userData } = useContext(AuthContext);

useEffect(() => {
Expand All @@ -17,20 +17,20 @@ const PaymentPage = () => {
}
}, [userData]);

// useEffect(() => {
// const params = new URLSearchParams(window.location.search);
// const currPaymentStatus = params.get('payment_status');
// const paymentId = params.get('payment_id');
// const paymentRequestId = params.get('payment_request_id');
useEffect(() => {
const params = new URLSearchParams(window.location.search);
const currPaymentStatus = params.get('payment_status');
const paymentId = params.get('payment_id');
const paymentRequestId = params.get('payment_request_id');

// if (currPaymentStatus === 'Credit' && paymentId && paymentRequestId) {
// toast.success('Payment Successful');
// setPaymentStatus(true);
// } else if (currPaymentStatus === 'Failed') {
// toast.error('Payment Failed');
// setPaymentStatus(false);
// }
// }, []);
if (currPaymentStatus === 'Credit' && paymentId && paymentRequestId) {
toast.success('Payment Successful');
setPaymentStatus(true);
} else if (currPaymentStatus === 'Failed') {
toast.error('Payment Failed');
setPaymentStatus(false);
}
}, []);

return (
<PrivateRoute>
Expand All @@ -45,7 +45,7 @@ const PaymentPage = () => {
marginTop: '7rem',
}}
>
<PaymentCardContainer
{/* <PaymentCardContainer
style={{
maxWidth: '600px',
textAlign: 'center',
Expand All @@ -62,7 +62,8 @@ const PaymentPage = () => {
<Body2>
If you have any queries reach out to innovision team at reachus.inno@gmail.com
</Body2>
</PaymentCardContainer>
</PaymentCardContainer> */}
{paymentStatus ? <SuccessCard /> : <PaymentCard />}
</div>
)}
</PrivateRoute>
Expand Down
8 changes: 4 additions & 4 deletions src/utils/Api.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ class Api {
});

if (avenueUser) {
// if (!avenueUser.festID.includes('innovision-2023') && !avenueUser.rollNumber) {
// toast.error('Kindly do the payment');
// navigate('/payment');
// }
if (!avenueUser.festID.includes('innovision-2023') && !avenueUser.rollNumber) {
toast.error('Kindly do the payment');
navigate('/payment');
}
} else {
toast.info('You are not registered for Innovision 2023. Please register to continue.');
navigate('/register');
Expand Down

0 comments on commit ee3039f

Please sign in to comment.