Skip to content

Commit

Permalink
fixed modal
Browse files Browse the repository at this point in the history
  • Loading branch information
owlester12 committed Nov 3, 2024
1 parent 864f222 commit bbe383e
Showing 1 changed file with 19 additions and 8 deletions.
27 changes: 19 additions & 8 deletions frontend/components/ClubEditPage/ClubEditCard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,28 @@ const EmailModal = ({
show={true}
closeModal={closeModal}
children={
<div>
<div>
<div
style={{
alignItems: 'center',
}}
>
<Text className="card-content">
Warning: This email will be down to the public. We highly recommend
you don't use a personal email, and instead use a club email. Feel
free to ignore this if the email is not a personal email.
</div>
</Text>
<Field
type="email"
name="email"
value={email}
onChange={(e) => setEmail(e.target.value)}
className={`input`}
style={{ maxWidth: '350px', marginBottom: '12px' }}
></Field>
<button onClick={confirmSubmission}>Confirm</button>
<div>
<button onClick={confirmSubmission} className="button is-primary">
Confirm
</button>
</div>
</div>
}
/>
Expand Down Expand Up @@ -919,19 +928,21 @@ export default function ClubEditCard({
enableReinitialize
validate={(values) => {
const errors: { email?: string } = {}
if (values.email.includes('upenn.edu')) {
if (values.email.includes('upenn.edu') && !emailModal) {
showEmailModal(true)
errors.email = 'Please confirm your email'
}
return errors
}}
validateOnChange={false}
validateOnBlur={false}
>
{({ dirty, isSubmitting, setFieldValue, submitForm }) => (
{({ dirty, isSubmitting, setFieldValue, submitForm, values }) => (
<Form>
{emailModal && (
<EmailModal
closeModal={() => showEmailModal(false)}
email=""
email={values.email}
setEmail={(newEmail) => setFieldValue('email', newEmail)}
confirmSubmission={() => {
showEmailModal(false)
Expand Down

0 comments on commit bbe383e

Please sign in to comment.