From d354b9813541a1c70da00fd5e82eb23aa5447e1e Mon Sep 17 00:00:00 2001 From: Juraj Piar Date: Tue, 14 Sep 2021 15:49:00 +0100 Subject: [PATCH] RESOLVE CONFLICTS AND SQUASH ME! When done with conflicts, run: git rebase -i HEAD~ to reword message to: fix(notifier): makes exp date calc safer --- .../notifier/buy/CheckoutStepper.tsx | 94 +++++++++++++++++++ 1 file changed, 94 insertions(+) create mode 100644 src/components/organisms/notifier/buy/CheckoutStepper.tsx diff --git a/src/components/organisms/notifier/buy/CheckoutStepper.tsx b/src/components/organisms/notifier/buy/CheckoutStepper.tsx new file mode 100644 index 000000000..aa63cba28 --- /dev/null +++ b/src/components/organisms/notifier/buy/CheckoutStepper.tsx @@ -0,0 +1,94 @@ +import React, { FC, useContext, useState } from 'react' +import Stepper from '@material-ui/core/Stepper' +import Step from '@material-ui/core/Step' +import StepLabel from '@material-ui/core/StepLabel' +import StepContent from '@material-ui/core/StepContent' +import { Button } from '@rsksmart/rif-ui' +import MarketContext from 'context/Market' +import { OffersOrder } from 'context/Services/notifier/offers/interfaces' +import { NotifierEventItem } from 'models/marketItems/NotifierEventItem' +import CheckoutPayment from './CheckoutPayment' +import EventsRegistrar from './EventsRegistrar' + +type Props = { + order: OffersOrder + onEventItemAdded: (eventitem: NotifierEventItem) => void + onEventItemRemoved: (eventitem: NotifierEventItem) => void + onBuy: () => void + eventsAdded: NotifierEventItem[] +} + +const getExpirationDate = (daysLeft: number): Date => { + const retDate = new Date() + retDate.setDate(retDate.getDate() + daysLeft) + return retDate +} + +const CheckoutStepper: FC = ( + { + onBuy, order, onEventItemAdded, onEventItemRemoved, eventsAdded, + }, +) => { + const [activeStep, setActiveStep] = useState(0) + const { + state: { + exchangeRates: { + crypto: cryptoXRs, + currentFiat: { displayName: fiatDisplayName }, + }, + }, + } = useContext(MarketContext) + + const { + item: { + token: { symbol: tokenSymbol }, + value: tokenValue, + daysLeft, + }, + } = order + + const handleNext = (): void => setActiveStep(1) + const handleBack = (): void => setActiveStep(0) + + const expirationDate = getExpirationDate(daysLeft) + const tokenXR = cryptoXRs[tokenSymbol] + + return ( + + + Notification events + + + + + + Payment + + + + + + + ) +} + +export default CheckoutStepper