From 44b4b169a9c41beca7e36d3e1950697540c5f95a Mon Sep 17 00:00:00 2001 From: Ronald Langeveld Date: Wed, 15 Nov 2023 16:36:55 +0700 Subject: [PATCH] Fixed duration options for yearly cadence (#18989) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit no issue --- ### 🤖 Generated by Copilot at b84f2a0 This change improves the offer creation modal by filtering the duration options based on the tier's cadence. This avoids showing irrelevant or invalid options to the user and simplifies the selection process. --- .../settings/growth/offers/AddOfferModal.tsx | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/apps/admin-x-settings/src/components/settings/growth/offers/AddOfferModal.tsx b/apps/admin-x-settings/src/components/settings/growth/offers/AddOfferModal.tsx index 08e410fa1a..e046cc3ff7 100644 --- a/apps/admin-x-settings/src/components/settings/growth/offers/AddOfferModal.tsx +++ b/apps/admin-x-settings/src/components/settings/growth/offers/AddOfferModal.tsx @@ -74,6 +74,15 @@ const Sidebar: React.FC = ({tierOptions, handleNameInput, handleTextAreaInput, amountOptions}) => { + const getFilteredDurationOptions = () => { + // Check if the selected tier's cadence is 'yearly' + if (selectedTier?.label?.includes('Yearly')) { + // Filter out 'repeating' from duration options + return durationOptions.filter(option => option.value !== 'repeating'); + } + return durationOptions; + }; + const filteredDurationOptions = getFilteredDurationOptions(); return (
@@ -124,8 +133,8 @@ const Sidebar: React.FC = ({tierOptions,