mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-17 01:24:02 -05:00
fix(gui): simplify wallet seedphrase dialog open button
This commit is contained in:
parent
65a46a4205
commit
706aaf1fe7
2 changed files with 65 additions and 73 deletions
|
|
@ -19,35 +19,25 @@ export default function SeedPhraseButton({
|
|||
onMenuClose,
|
||||
onSeedPhraseSuccess,
|
||||
}: SeedPhraseButtonProps) {
|
||||
const handleSeedPhraseSuccess = (
|
||||
response: [GetMoneroSeedResponse, GetRestoreHeightResponse],
|
||||
) => {
|
||||
onSeedPhraseSuccess(response);
|
||||
onMenuClose();
|
||||
};
|
||||
|
||||
return (
|
||||
<MenuItem component="div">
|
||||
<PromiseInvokeButton
|
||||
onInvoke={getMoneroSeedAndRestoreHeight}
|
||||
onSuccess={handleSeedPhraseSuccess}
|
||||
displayErrorSnackbar={true}
|
||||
variant="text"
|
||||
contextRequirement={isContextWithMoneroWallet}
|
||||
sx={{
|
||||
justifyContent: "flex-start",
|
||||
textTransform: "none",
|
||||
padding: 0,
|
||||
minHeight: "auto",
|
||||
width: "100%",
|
||||
color: "text.primary",
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<KeyIcon />
|
||||
</ListItemIcon>
|
||||
<Typography>Seedphrase</Typography>
|
||||
</PromiseInvokeButton>
|
||||
</MenuItem>
|
||||
<PromiseInvokeButton
|
||||
onInvoke={getMoneroSeedAndRestoreHeight}
|
||||
onSuccess={onSeedPhraseSuccess}
|
||||
displayErrorSnackbar={true}
|
||||
contextRequirement={isContextWithMoneroWallet}
|
||||
component={MenuItem}
|
||||
disableRipple={false}
|
||||
sx={{
|
||||
textTransform: "none",
|
||||
width: "100%",
|
||||
borderRadius: "0px",
|
||||
}}
|
||||
color="inherit"
|
||||
>
|
||||
<ListItemIcon>
|
||||
<KeyIcon />
|
||||
</ListItemIcon>
|
||||
<Typography>Seedphrase</Typography>
|
||||
</PromiseInvokeButton>
|
||||
);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -72,51 +72,53 @@ export default function WalletActionButtons({
|
|||
open={sendDialogOpen}
|
||||
onClose={() => setSendDialogOpen(false)}
|
||||
/>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexWrap: "wrap",
|
||||
gap: 1,
|
||||
mb: 2,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Chip
|
||||
icon={<SendIcon />}
|
||||
label="Send"
|
||||
variant="button"
|
||||
clickable
|
||||
onClick={() => setSendDialogOpen(true)}
|
||||
/>
|
||||
<Chip
|
||||
onClick={() => navigate("/swap")}
|
||||
icon={<SwapIcon />}
|
||||
label="Swap"
|
||||
variant="button"
|
||||
clickable
|
||||
/>
|
||||
<DfxButton />
|
||||
|
||||
<IconButton onClick={handleMenuClick}>
|
||||
<MoreHorizIcon />
|
||||
</IconButton>
|
||||
<Menu anchorEl={menuAnchorEl} open={menuOpen} onClose={handleMenuClose}>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setRestoreHeightDialogOpen(true);
|
||||
handleMenuClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<RestoreIcon />
|
||||
</ListItemIcon>
|
||||
<Typography>Restore Height</Typography>
|
||||
</MenuItem>
|
||||
<SeedPhraseButton
|
||||
onMenuClose={handleMenuClose}
|
||||
onSeedPhraseSuccess={setSeedPhrase}
|
||||
<Box sx={{ display: "flex", justifyContent: "space-between" }}>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexWrap: "wrap",
|
||||
gap: 1,
|
||||
alignItems: "center",
|
||||
}}
|
||||
>
|
||||
<Chip
|
||||
icon={<SendIcon />}
|
||||
label="Send"
|
||||
variant="button"
|
||||
clickable
|
||||
onClick={() => setSendDialogOpen(true)}
|
||||
/>
|
||||
</Menu>
|
||||
<Chip
|
||||
onClick={() => navigate("/swap")}
|
||||
icon={<SwapIcon />}
|
||||
label="Swap"
|
||||
variant="button"
|
||||
clickable
|
||||
/>
|
||||
<DfxButton />
|
||||
</Box>
|
||||
<Box>
|
||||
<IconButton onClick={handleMenuClick}>
|
||||
<MoreHorizIcon />
|
||||
</IconButton>
|
||||
<Menu anchorEl={menuAnchorEl} open={menuOpen} onClose={handleMenuClose}>
|
||||
<MenuItem
|
||||
onClick={() => {
|
||||
setRestoreHeightDialogOpen(true);
|
||||
handleMenuClose();
|
||||
}}
|
||||
>
|
||||
<ListItemIcon>
|
||||
<RestoreIcon />
|
||||
</ListItemIcon>
|
||||
<Typography>Restore Height</Typography>
|
||||
</MenuItem>
|
||||
<SeedPhraseButton
|
||||
onMenuClose={handleMenuClose}
|
||||
onSeedPhraseSuccess={setSeedPhrase}
|
||||
/>
|
||||
</Menu>
|
||||
</Box>
|
||||
</Box>
|
||||
</>
|
||||
);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue