Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining funds alert #123

Merged
merged 2 commits into from
Nov 4, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/renderer/components/alert/ConfidentialityAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Alert } from '@material-ui/lab';

export default function ConfidentialityAlert() {
return (
<Alert severity="warning">
<Alert severity="warning" variant="filled">
This page contains confidential information including private keys. Keep
this information to yourself. You will lose your funds if you do not!
</Alert>
Expand Down
33 changes: 33 additions & 0 deletions src/renderer/components/alert/RemainingFundsWillBeUsedAlert.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
import { Alert } from '@material-ui/lab';
import { Box, makeStyles } from '@material-ui/core';
import { useAppSelector } from '../../../store/hooks';
import WalletRefreshButton from '../pages/wallet/WalletRefreshButton';

const useStyles = makeStyles((theme) => ({
outer: {
paddingBottom: theme.spacing(1),
},
}));

export default function RemainingFundsWillBeUsedAlert() {
const classes = useStyles();
const balance = useAppSelector((s) => s.balance.balanceValue);

if (balance == null || balance <= 0) {
return <></>;
}

return (
<Box className={classes.outer}>
<Alert
severity="warning"
action={<WalletRefreshButton />}
variant="filled"
>
The remaining funds of {balance} BTC in the wallet will be used for the
next swap. If the remaining funds exceed the minimum swap amount of the
provider, a swap will be initiated instantaneously.
</Alert>
</Box>
);
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export default function SwapMightBeCancelledAlert({
}

return (
<Alert severity="warning" className={classes.outer}>
<Alert severity="warning" className={classes.outer} variant="filled">
<AlertTitle>Be careful!</AlertTitle>
The swap provider has taken a long time to lock their Monero. This might
mean that:
Expand Down
1 change: 1 addition & 0 deletions src/renderer/components/alert/SwapTxLockStatusAlert.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export default function SwapTxLockStatusAlert({
key={dbState.swapId}
severity="warning"
action={<SwapResumeButton dbState={dbState} />}
variant="filled"
>
<AlertTitle>Swap {dbState.swapId} is unfinished</AlertTitle>
<SwapAlertStatusText timelockStatus={timelockStatus} />
Expand Down
2 changes: 2 additions & 0 deletions src/renderer/components/modal/swap/pages/init/InitPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import MoneroAddressTextField from 'renderer/components/inputs/MoneroAddressText
import { useAppSelector } from 'store/hooks';
import PlayArrowIcon from '@material-ui/icons/PlayArrow';
import { isTestnet } from '../../../../../../store/config';
import RemainingFundsWillBeUsedAlert from '../../../../alert/RemainingFundsWillBeUsedAlert';

const useStyles = makeStyles((theme) => ({
initButton: {
Expand Down Expand Up @@ -53,6 +54,7 @@ export default function InitPage() {

return (
<Box>
<RemainingFundsWillBeUsedAlert />
<DialogContentText>
Please specify the address to which the Monero should be sent upon
completion of the swap and the address for receiving a Bitcoin refund if
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export default function FundsLeftInWalletAlert() {
if (fundsLeft != null && fundsLeft > 0) {
return (
<Alert
variant="filled"
severity="warning"
action={
<Button
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ export default function UnfinishedSwapsAlert() {
return (
<Alert
severity="warning"
variant="filled"
action={
<Button
color="inherit"
Expand Down