diff --git a/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx b/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx
index 75f44e3b99..7dc7a2cef5 100644
--- a/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx
+++ b/apps/admin-x-settings/src/components/settings/growth/offers/OffersIndex.tsx
@@ -89,42 +89,6 @@ export const CopyLinkButton: React.FC<{offerCode: string}> = ({offerCode}) => {
return ;
};
-const OfferCard: React.FC<{amount: number, cadence: string, currency: string, duration: string, name: string, code: string, offerId: string, offerTier: Tier | undefined, redemptionCount: number, type: OfferType, onClick: ()=>void}> = ({amount, cadence, currency, duration, name, code, offerId, offerTier, redemptionCount, type, onClick}) => {
- let tierName = offerTier?.name + ' ' + getOfferCadence(cadence) + ' — ' + getOfferDuration(duration);
- const {discountColor, discountOffer, originalPriceWithCurrency, updatedPriceWithCurrency} = getOfferDiscount(type, amount, cadence, currency || 'USD', offerTier);
-
- const isTierArchived = offerTier?.active === false;
-
- return (
-
{}}>
-
-
-
{name}
- {discountOffer}
-
-
- {updatedPriceWithCurrency}
- {originalPriceWithCurrency}
-
-
-
- {!isTierArchived ?
-
:
- null
- }
-
-
- {isTierArchived ?
-
This offer is disabled, because
it is tied to an archived tier.
:
- null
- }
-
- );
-};
-
export const OffersIndexModal = () => {
const modal = useModal();
const {updateRoute} = useRouting();
@@ -149,7 +113,6 @@ export const OffersIndexModal = () => {
{id: 'archived', title: 'Archived'}
];
const [selectedTab, setSelectedTab] = useState('active');
- const [selectedLayout, setSelectedLayout] = useState('card');
const [sortOption, setSortOption] = useState('date-added');
const [sortDirection, setSortDirection] = useState('desc');
@@ -179,43 +142,11 @@ export const OffersIndexModal = () => {
}
});
- const cardLayoutOutput =
- {sortedOffers.filter((offer) => {
- const offerTier = allTiers?.find(tier => tier.id === offer?.tier.id);
- //Check to filter out offers with archived offerTier
- return (selectedTab === 'active' && (offer.status === 'active' && offerTier && offerTier.active === true)) ||
- (selectedTab === 'archived' && (offer.status === 'archived' || (offerTier && offerTier.active === false)));
- }).map((offer) => {
- const offerTier = allTiers?.find(tier => tier.id === offer?.tier.id);
-
- if (!offerTier) {
- return null;
- }
-
- return (
- handleOfferEdit(offer?.id ? offer.id : '')}
- />
- );
- })}
-
;
-
const listLayoutOutput =
{(selectedTab === 'active' && activeOffers.length > 0) || (selectedTab === 'archived' && archivedOffers.length > 0) ?
- {sortedOffers.length} {sortedOffers.length > 1 ? 'offers' : 'offer'} |
+ {selectedTab === 'active' ? activeOffers.length : archivedOffers.length} {selectedTab === 'active' ? (activeOffers.length !== 1 ? 'offers' : 'offer') : (archivedOffers.length !== 1 ? 'offers' : 'offer')} |
Tier |
Terms |
Price |
@@ -264,20 +195,15 @@ export const OffersIndexModal = () => {
}}
animate={false}
cancelLabel=''
- footer={
-
- }
header={false}
height='full'
size='lg'
testId='offers-modal'
stickyFooter
+ onOk={() => {
+ modal.remove();
+ updateRoute('offers');
+ }}
>
@@ -295,7 +221,7 @@ export const OffersIndexModal = () => {
{offersTabs.find(tab => tab.id === selectedTab)?.title} offers
-
+
{
setSortOption(selectedOption);
}}
/>
-
-
@@ -331,7 +253,7 @@ export const OffersIndexModal = () => {
:
null
}
- {selectedLayout === 'card' ? cardLayoutOutput : listLayoutOutput}
+ {listLayoutOutput}
;
};