mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-12-18 18:14:03 -05:00
feat(gui): Display progress of monero-wallet-rpc download (#170)
This commit is contained in:
parent
3540a029bd
commit
6f0d060263
5 changed files with 77 additions and 12 deletions
|
|
@ -1,12 +1,22 @@
|
|||
import { Button } from "@material-ui/core";
|
||||
import { Box, Button, LinearProgress, makeStyles } from "@material-ui/core";
|
||||
import { Alert } from "@material-ui/lab";
|
||||
import { TauriContextInitializationProgress } from "models/tauriModel";
|
||||
import { useNavigate } from "react-router-dom";
|
||||
import { useAppSelector } from "store/hooks";
|
||||
import { exhaustiveGuard } from "utils/typescriptUtils";
|
||||
import { LoadingSpinnerAlert } from "./LoadingSpinnerAlert";
|
||||
import { bytesToMb } from "utils/conversionUtils";
|
||||
|
||||
const useStyles = makeStyles((theme) => ({
|
||||
innerAlert: {
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
gap: theme.spacing(2),
|
||||
},
|
||||
}));
|
||||
|
||||
export default function DaemonStatusAlert() {
|
||||
const classes = useStyles();
|
||||
const contextStatus = useAppSelector((s) => s.rpc.status);
|
||||
const navigate = useNavigate();
|
||||
|
||||
|
|
@ -16,20 +26,32 @@ export default function DaemonStatusAlert() {
|
|||
|
||||
switch (contextStatus.type) {
|
||||
case "Initializing":
|
||||
switch (contextStatus.content) {
|
||||
case TauriContextInitializationProgress.OpeningBitcoinWallet:
|
||||
switch (contextStatus.content.type) {
|
||||
case "OpeningBitcoinWallet":
|
||||
return (
|
||||
<LoadingSpinnerAlert severity="warning">
|
||||
Connecting to the Bitcoin network
|
||||
</LoadingSpinnerAlert>
|
||||
);
|
||||
case TauriContextInitializationProgress.OpeningMoneroWallet:
|
||||
case "DownloadingMoneroWalletRpc":
|
||||
return (
|
||||
<LoadingSpinnerAlert severity="warning">
|
||||
<Box className={classes.innerAlert}>
|
||||
<Box>
|
||||
Downloading and verifying the Monero wallet RPC (
|
||||
{bytesToMb(contextStatus.content.content.size).toFixed(2)} MB)
|
||||
</Box>
|
||||
<LinearProgress variant="determinate" value={contextStatus.content.content.progress} />
|
||||
</Box>
|
||||
</LoadingSpinnerAlert >
|
||||
);
|
||||
case "OpeningMoneroWallet":
|
||||
return (
|
||||
<LoadingSpinnerAlert severity="warning">
|
||||
Connecting to the Monero network
|
||||
</LoadingSpinnerAlert>
|
||||
);
|
||||
case TauriContextInitializationProgress.OpeningDatabase:
|
||||
case "OpeningDatabase":
|
||||
return (
|
||||
<LoadingSpinnerAlert severity="warning">
|
||||
Opening the local database
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue