Skip to content

Commit

Permalink
use insufficient coins banner
Browse files Browse the repository at this point in the history
  • Loading branch information
jhesgodi committed Mar 11, 2024
1 parent 943c8b1 commit 7382e8a
Showing 1 changed file with 4 additions and 36 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
import {
Banner, Box, Heading, Link,
} from '@biom3/react';
import { Box, Heading } from '@biom3/react';
import { useContext, useEffect } from 'react';

import { SalePaymentTypes } from '@imtbl/checkout-sdk';
Expand All @@ -22,10 +20,11 @@ import { PaymentOptions } from '../components/PaymentOptions';
import { useSaleContext } from '../context/SaleContextProvider';
import { useSaleEvent } from '../hooks/useSaleEvents';
import { SaleErrorTypes, SignPaymentTypes } from '../types';
import { InsufficientCoinsBanner } from '../components/InsufficientCoinsBanner';

export function PaymentMethods() {
const { t } = useTranslation();
const { viewState, viewDispatch } = useContext(ViewContext);
const { viewDispatch } = useContext(ViewContext);
const {
sign,
goToErrorView,
Expand Down Expand Up @@ -82,35 +81,6 @@ export function PaymentMethods() {
}
}, [paymentMethod]);

const onClickInsufficientCoinsBanner = () => {
viewDispatch({
payload: {
type: ViewActions.UPDATE_VIEW,
view: {
type: SharedViews.TOP_UP_VIEW,
},
},
});
};

const insufficientCoinsBanner = (
<Box sx={{ paddingX: 'base.spacing.x2' }}>
<Banner>
<Banner.Icon icon="InformationCircle" />
<Banner.Caption>
{t('views.PAYMENT_METHODS.insufficientCoinsBanner.caption')}
<Link
sx={{ mx: 'base.spacing.x1' }}
onClick={() => onClickInsufficientCoinsBanner()}
>
{t('views.PAYMENT_METHODS.insufficientCoinsBanner.captionCTA')}
</Link>
{t('views.PAYMENT_METHODS.insufficientCoinsBanner.captionEnd')}
</Banner.Caption>
</Banner>
</Box>
);

useEffect(() => sendPageView(SaleWidgetViews.PAYMENT_METHODS), []);
useEffect(() => {
if (!invalidParameters) return;
Expand Down Expand Up @@ -150,9 +120,7 @@ export function PaymentMethods() {
onClick={handleOptionClick}
/>
</Box>
{viewState.view.data?.showInsufficientCoinsBanner
? insufficientCoinsBanner
: null}
<InsufficientCoinsBanner />
</Box>
</SimpleLayout>
);
Expand Down

0 comments on commit 7382e8a

Please sign in to comment.