Skip to content

Commit

Permalink
feat: added flow reset button
Browse files Browse the repository at this point in the history
  • Loading branch information
Polybius93 committed Dec 8, 2023
1 parent d60b773 commit 1f29e74
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
import { useContext, useState } from 'react';
import { useDispatch } from 'react-redux';

import { Button, VStack } from '@chakra-ui/react';
import { VaultCard } from '@components/vault/vault-card';
import { useVaults } from '@hooks/use-vaults';
import { Vault } from '@models/vault';
import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions';

import { BlockchainContext } from '../../../../providers/blockchain-context-provider';
import { LockScreenProtocolFee } from './components/protocol-fee';
Expand All @@ -13,6 +15,7 @@ interface LockScreenProps {
}

export function LockScreen({ currentStep }: LockScreenProps): React.JSX.Element {
const dispatch = useDispatch();
const { readyVaults } = useVaults();
const blockchainContext = useContext(BlockchainContext);
const bitcoin = blockchainContext?.bitcoin;
Expand Down Expand Up @@ -46,6 +49,13 @@ export function LockScreen({ currentStep }: LockScreenProps): React.JSX.Element
>
Lock BTC
</Button>
<Button
isLoading={isSubmitting}
variant={'navigate'}
onClick={() => dispatch(mintUnmintActions.setMintStep([0, '']))}
>
Cancel
</Button>
</VStack>
);
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
import { Link } from 'react-router-dom';
import { useDispatch } from 'react-redux';
import { Link, useNavigate } from 'react-router-dom';

import { HStack, Spinner, Stack, Text, VStack } from '@chakra-ui/react';
import { Button, HStack, Spinner, Stack, Text, VStack } from '@chakra-ui/react';
import { VaultCard } from '@components/vault/vault-card';
import { useVaults } from '@hooks/use-vaults';
import { mintUnmintActions } from '@store/slices/mintunmint/mintunmint.actions';

import { TransactionSummaryPreviewCard } from './components/transaction-summary-preview-card';

Expand Down Expand Up @@ -40,6 +42,8 @@ export function TransactionSummary({
flow,
blockchain,
}: TransactionSummaryProps): React.JSX.Element {
const navigate = useNavigate();
const dispatch = useDispatch();
const { allVaults } = useVaults();
const currentVault = allVaults.find(vault => vault.uuid === currentStep[1]);

Expand Down Expand Up @@ -79,6 +83,19 @@ export function TransactionSummary({
tab.
</Text>
</Stack>
<Button
variant={'navigate'}
onClick={() => {
dispatch(
flow === 'mint'
? mintUnmintActions.setMintStep([0, ''])
: mintUnmintActions.setUnmintStep([0, ''])
);
navigate('/my-vaults');
}}
>
View in My Vaults
</Button>
</VStack>
);
}
4 changes: 2 additions & 2 deletions src/app/store/slices/mintunmint/mintunmint.slice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ interface MintUnmintState {
}

const initialMintUnmintState: MintUnmintState = {
mintStep: [0, ''],
unmintStep: [0, ''],
mintStep: [2, ''],
unmintStep: [1, ''],
activeTab: 0,
};

Expand Down

0 comments on commit 1f29e74

Please sign in to comment.