From bc0d535443ce40430c918c17919df19cf5076c93 Mon Sep 17 00:00:00 2001 From: Alex Bueno <44420072+aweell@users.noreply.github.com> Date: Thu, 21 Nov 2024 11:51:15 +0100 Subject: [PATCH] Remove dismiss when not repeatable --- .../components/calendar-card.jsx | 7 +------ .../components/modal-view.jsx | 18 ++++++++++-------- 2 files changed, 11 insertions(+), 14 deletions(-) diff --git a/src/pages/advent-calendar-2024/components/calendar-card.jsx b/src/pages/advent-calendar-2024/components/calendar-card.jsx index 77d8524e6e..1d16870530 100644 --- a/src/pages/advent-calendar-2024/components/calendar-card.jsx +++ b/src/pages/advent-calendar-2024/components/calendar-card.jsx @@ -48,11 +48,6 @@ const CalendarCard = ({ onEndDay(); // Notify the parent to update the state }; - const handleDismiss = () => { - dialogRef.current.close(); - isRepeatable && onEndDay(); - }; - let cardStatusStyles; switch (status) { @@ -217,7 +212,7 @@ const CalendarCard = ({ description={eventDescription} content={content ? content({ closeModal: handleCloseModal }) : null} onClose={handleEndDay} - onCancel={handleDismiss} + onCancel={isRepeatable ? handleEndDay : null} /> ); diff --git a/src/pages/advent-calendar-2024/components/modal-view.jsx b/src/pages/advent-calendar-2024/components/modal-view.jsx index 60593193f7..fa2103dc52 100644 --- a/src/pages/advent-calendar-2024/components/modal-view.jsx +++ b/src/pages/advent-calendar-2024/components/modal-view.jsx @@ -74,14 +74,16 @@ const ModalView = forwardRef( }} > {content} -
- -
+ {onCancel !== null && ( +
+ +
+ )}