Skip to content

Commit

Permalink
Add callbacks to action buttons
Browse files Browse the repository at this point in the history
  • Loading branch information
WRadoslaw committed Mar 20, 2024
1 parent f9e6643 commit 77aee34
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ export const ChangeNowModal = ({ type, onClose }: ChangeNowModalProps) => {
if (primaryButtonProps) {
return {
text: 'Go to dashboard',
onClick: () => onClose(),
to: absoluteRoutes.viewer.portfolio(),
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,13 @@ type ProgressStepProps = {
transactionData: TransactionData
} & CommonProps

export const ProgressStep = ({ transactionData, type, setPrimaryButtonProps, goToStep }: ProgressStepProps) => {
export const ProgressStep = ({
transactionData,
type,
setPrimaryButtonProps,
goToStep,
onClose,
}: ProgressStepProps) => {
const [retry, setRetry] = useState(true)
const isSellingJoy = type === 'sell'
const steps = isSellingJoy ? sellSteps : buySteps
Expand Down Expand Up @@ -118,13 +124,13 @@ export const ProgressStep = ({ transactionData, type, setPrimaryButtonProps, goT
setRetry(false)
setPrimaryButtonProps({
text: 'Close',
onClick: () => undefined,
onClick: () => onClose(),
})
step = steps.length
extraContent = successText
}
return [step, steps[step]?.[1], extraContent]
}, [data, isSellingJoy, setPrimaryButtonProps, steps, transactionData.hasAutomaticTransactionSucceeded])
}, [data, isSellingJoy, onClose, setPrimaryButtonProps, steps, transactionData.hasAutomaticTransactionSucceeded])

return (
<FlexBox gap={6} flow="column">
Expand Down

0 comments on commit 77aee34

Please sign in to comment.