Skip to content

Commit

Permalink
Merge pull request #1434 from danskernesdigitalebibliotek/DDFHER-67-m…
Browse files Browse the repository at this point in the history
…obile-number-appears-in-wrong-field-in-cicero
  • Loading branch information
kasperg authored Sep 24, 2024
2 parents c650052 + 8e58b1e commit 1083233
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
3 changes: 2 additions & 1 deletion src/apps/create-patron-user-info/UserInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ const UserInfo: FC<UserInfoProps> = ({ cpr, registerSuccessCallback }) => {
set(copyUser, key, newValue);
setPatron(copyUser);
};

const handleSubmit = (e: FormEvent<HTMLFormElement>) => {
e.preventDefault();
setIsLoading(true);
Expand Down Expand Up @@ -80,7 +81,7 @@ const UserInfo: FC<UserInfoProps> = ({ cpr, registerSuccessCallback }) => {
</h1>
<form onSubmit={(e) => handleSubmit(e)} ref={formRef}>
<ContactInfoSection
showCheckboxes={false}
showCheckboxes={["phone"]}
isDouble
inLine
changePatron={changePatron}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/patron-page/PatronPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ const PatronPage: FC = () => {
changePatron={changePatron}
patron={patron}
inLine={false}
showCheckboxes
showCheckboxes={["email", "phone"]}
/>
)}
{patron?.resident && <StatusSection />}
Expand Down
2 changes: 1 addition & 1 deletion src/apps/patron-page/PatronPageSkeleton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const PatronPageSkeleton: React.FC = () => {
changePatron={() => {}}
patron={null}
inLine={false}
showCheckboxes
showCheckboxes={["email", "phone"]}
/>
</form>
);
Expand Down
8 changes: 5 additions & 3 deletions src/components/contact-info-section/ContactInfoSection.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface ContactInfoSectionProps {
inLine?: boolean;
isDouble?: boolean;
changePatron: ChangePatronProps;
showCheckboxes: boolean;
showCheckboxes: ("email" | "phone")[];
requiredFields?: ("email" | "phone")[];
}

Expand Down Expand Up @@ -43,7 +43,9 @@ const ContactInfoSection: FC<ContactInfoSectionProps> = ({
changePatron={changePatron}
patron={patron}
isRequired={requiredFields.includes("phone")}
showCheckboxes={showCheckboxes && textNotificationsEnabledConfig}
showCheckboxes={
showCheckboxes.includes("phone") && textNotificationsEnabledConfig
}
/>
<ContactInfoEmail
className={clsx(inputsClass, {
Expand All @@ -52,7 +54,7 @@ const ContactInfoSection: FC<ContactInfoSectionProps> = ({
changePatron={changePatron}
patron={patron}
isRequired={requiredFields.includes("email")}
showCheckboxes={showCheckboxes}
showCheckboxes={showCheckboxes.includes("email")}
/>
</ContactInfoInputs>
</section>
Expand Down

0 comments on commit 1083233

Please sign in to comment.