Skip to content

Commit

Permalink
Use chakra unit instead of rem, fixing issues after modalBase changes
Browse files Browse the repository at this point in the history
  • Loading branch information
ioay committed Jan 28, 2024
1 parent d0d4805 commit 0543d88
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 6 deletions.
40 changes: 36 additions & 4 deletions dapp/src/components/TransactionModal/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,17 +24,37 @@ export default function TransactionModal({
const { onOpen: openSideBar, onClose: closeSidebar } = useSidebar()

const [activeStep, setActiveStep] = useState(defaultStep)
const [isPaused, setIsPaused] = useState(false)
const [isPendingTransaction, setIsPendingTransaction] = useState(false)

const handleResume = useCallback(() => {
setIsPaused(false)
}, [])

const handleGoNext = useCallback(() => {
setActiveStep((prevStep) => prevStep + 1)
}, [])

const handleClose = useCallback(() => {
onClose()
}, [onClose])
if (!isPaused && isPendingTransaction) {
setIsPaused(true)
} else {
onClose()
}
}, [isPaused, isPendingTransaction, onClose])

const handleStartTransactionProcess = useCallback(() => {
setIsPendingTransaction(true)
}, [setIsPendingTransaction])

const handleStopTransactionProcess = useCallback(() => {
setIsPendingTransaction(false)
}, [setIsPendingTransaction])

const resetState = useCallback(() => {
setActiveStep(defaultStep)
setIsPaused(false)
setIsPendingTransaction(false)
}, [defaultStep])

useEffect(() => {
Expand All @@ -58,14 +78,26 @@ export default function TransactionModal({
const contextValue: ModalFlowContextValue = useMemo<ModalFlowContextValue>(
() => ({
activeStep,
isPaused,
onClose: handleClose,
onResume: handleResume,
goNext: handleGoNext,
startTransactionProcess: handleStartTransactionProcess,
endTransactionProcess: handleStopTransactionProcess,
}),
[activeStep, handleGoNext, handleClose],
[
activeStep,
isPaused,
handleGoNext,
handleClose,
handleResume,
handleStartTransactionProcess,
handleStopTransactionProcess,
],
)

return (
<ModalBase isOpen={isOpen} onClose={onClose}>
<ModalBase isOpen={isOpen} onClose={handleClose}>
<TransactionContextProvider>
<ModalFlowContext.Provider value={contextValue}>
<SupportWrapper>{children}</SupportWrapper>
Expand Down
4 changes: 2 additions & 2 deletions dapp/src/theme/Spinner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ const baseStyle = defineStyle({
})

const sizeXl = defineStyle({
width: "4.5rem",
height: "4.5rem",
width: 16,
height: 16,
})

const sizes = {
Expand Down

0 comments on commit 0543d88

Please sign in to comment.