Skip to content

Commit

Permalink
Save edits from VSR individual page directly rather than showing conf…
Browse files Browse the repository at this point in the history
…irmation popup
  • Loading branch information
benjaminJohnson2204 committed May 27, 2024
1 parent 7e94593 commit 8131cc4
Showing 1 changed file with 1 addition and 32 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,6 @@ export const VSRIndividualPage = () => {
const [loadingUpdateStatus, setLoadingUpdateStatus] = useState(false);

const [discardEditsConfirmationModalOpen, setDiscardEditsConfirmationModalOpen] = useState(false);
const [saveEditsConfirmationModalOpen, setSaveEditsConfirmationModalOpen] = useState(false);
const [editSuccessNotificationOpen, setEditSuccessNotificationOpen] = useState(false);
const [editErrorNotificationOpen, setEditErrorNotificationOpen] = useState(false);
const [loadingEdit, setLoadingEdit] = useState(false);
Expand Down Expand Up @@ -321,7 +320,7 @@ export const VSRIndividualPage = () => {
iconAlt="Check"
text="Save Changes"
hideTextOnMobile
onClick={() => setSaveEditsConfirmationModalOpen(true)}
onClick={(e) => handleSubmit(onSubmitEdits)(e)}
/>
</>
) : (
Expand Down Expand Up @@ -694,36 +693,6 @@ export const VSRIndividualPage = () => {
/>

{/* Modals & notifications for saving changes to VSR */}
<BaseModal
isOpen={saveEditsConfirmationModalOpen}
onClose={() => setSaveEditsConfirmationModalOpen(false)}
title="Save Changes"
content="Would you like to save your changes?"
bottomRow={
<div className={styles.modalBottomRow}>
<Button
variant="primary"
outlined
text="Keep Editing"
className={styles.modalButton}
onClick={() => setSaveEditsConfirmationModalOpen(false)}
style={{ width: "100%" }}
/>
<Button
variant="primary"
outlined={false}
text="Save Changes"
className={styles.modalButton}
onClick={(e) => {
// Close the confirmation modal to enable user to see any errors on the form
setSaveEditsConfirmationModalOpen(false);
handleSubmit(onSubmitEdits)(e);
}}
style={{ width: "100%" }}
/>
</div>
}
/>
<NotificationBanner
variant="success"
isOpen={editSuccessNotificationOpen}
Expand Down

0 comments on commit 8131cc4

Please sign in to comment.