mirror of
https://github.com/comit-network/xmr-btc-swap.git
synced 2025-11-25 02:13:11 -05:00
dprint fmt
This commit is contained in:
parent
7102962898
commit
c1c45571f0
20 changed files with 151 additions and 74 deletions
|
|
@ -1,6 +1,9 @@
|
|||
import React from "react";
|
||||
import { Badge } from "@mui/material";
|
||||
import { useIsSwapRunning, useResumeableSwapsCountExcludingPunished } from "store/hooks";
|
||||
import {
|
||||
useIsSwapRunning,
|
||||
useResumeableSwapsCountExcludingPunished,
|
||||
} from "store/hooks";
|
||||
|
||||
export default function UnfinishedSwapsBadge({
|
||||
children,
|
||||
|
|
@ -10,7 +13,9 @@ export default function UnfinishedSwapsBadge({
|
|||
const isSwapRunning = useIsSwapRunning();
|
||||
const resumableSwapsCount = useResumeableSwapsCountExcludingPunished();
|
||||
|
||||
const displayedResumableSwapsCount = isSwapRunning ? resumableSwapsCount - 1 : resumableSwapsCount;
|
||||
const displayedResumableSwapsCount = isSwapRunning
|
||||
? resumableSwapsCount - 1
|
||||
: resumableSwapsCount;
|
||||
|
||||
if (displayedResumableSwapsCount > 0) {
|
||||
return (
|
||||
|
|
|
|||
|
|
@ -22,7 +22,8 @@ export default function SendTransactionModal({
|
|||
const pendingApprovals = usePendingSendMoneroApproval();
|
||||
const hasPendingApproval = pendingApprovals.length > 0;
|
||||
|
||||
const [successResponse, setSuccessResponse] = useState<SendMoneroResponse | null>(null);
|
||||
const [successResponse, setSuccessResponse] =
|
||||
useState<SendMoneroResponse | null>(null);
|
||||
|
||||
const showSuccess = successResponse !== null;
|
||||
|
||||
|
|
@ -42,13 +43,20 @@ export default function SendTransactionModal({
|
|||
}}
|
||||
>
|
||||
{!showSuccess && !hasPendingApproval && (
|
||||
<SendTransactionContent balance={balance} onClose={onClose} onSuccess={setSuccessResponse} />
|
||||
<SendTransactionContent
|
||||
balance={balance}
|
||||
onClose={onClose}
|
||||
onSuccess={setSuccessResponse}
|
||||
/>
|
||||
)}
|
||||
{!showSuccess && hasPendingApproval && (
|
||||
<SendApprovalContent onClose={onClose} />
|
||||
)}
|
||||
{showSuccess && (
|
||||
<SendSuccessContent onClose={onClose} successDetails={successResponse} />
|
||||
<SendSuccessContent
|
||||
onClose={onClose}
|
||||
successDetails={successResponse}
|
||||
/>
|
||||
)}
|
||||
</Dialog>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -1,6 +1,9 @@
|
|||
import { Box, Button, Typography } from "@mui/material";
|
||||
import CheckCircleIcon from "@mui/icons-material/CheckCircle";
|
||||
import { FiatPiconeroAmount, PiconeroAmount } from "renderer/components/other/Units";
|
||||
import {
|
||||
FiatPiconeroAmount,
|
||||
PiconeroAmount,
|
||||
} from "renderer/components/other/Units";
|
||||
import MonospaceTextBox from "renderer/components/other/MonospaceTextBox";
|
||||
import ArrowOutwardIcon from "@mui/icons-material/ArrowOutward";
|
||||
import { SendMoneroResponse } from "models/tauriModel";
|
||||
|
|
@ -15,10 +18,12 @@ export default function SendSuccessContent({
|
|||
onClose: () => void;
|
||||
successDetails: SendMoneroResponse | null;
|
||||
}) {
|
||||
|
||||
const address = successDetails?.address;
|
||||
const amount = successDetails?.amount_sent;
|
||||
const explorerUrl = getMoneroTxExplorerUrl(successDetails?.tx_hash, isTestnet());
|
||||
const explorerUrl = getMoneroTxExplorerUrl(
|
||||
successDetails?.tx_hash,
|
||||
isTestnet(),
|
||||
);
|
||||
|
||||
return (
|
||||
<Box
|
||||
|
|
@ -36,30 +41,68 @@ export default function SendSuccessContent({
|
|||
<CheckCircleIcon sx={{ fontSize: 64, mt: 3 }} />
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<Typography variant="h4">Transaction Published</Typography>
|
||||
<Box sx={{ display: "flex", flexDirection: "row", alignItems: "center", gap: 1 }}>
|
||||
<Typography variant="body1" color="text.secondary">Sent</Typography>
|
||||
<Typography variant="body1" color="text.primary">
|
||||
<PiconeroAmount amount={amount} fixedPrecision={4}/>
|
||||
</Typography>
|
||||
<Typography variant="body1" color="text.secondary">(<FiatPiconeroAmount amount={amount} />)</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1" color="text.secondary">
|
||||
Sent
|
||||
</Typography>
|
||||
<Typography variant="body1" color="text.primary">
|
||||
<PiconeroAmount amount={amount} fixedPrecision={4} />
|
||||
</Typography>
|
||||
<Typography variant="body1" color="text.secondary">
|
||||
(<FiatPiconeroAmount amount={amount} />)
|
||||
</Typography>
|
||||
</Box>
|
||||
<Box sx={{ display: "flex", flexDirection: "row", alignItems: "center", gap: 1 }}>
|
||||
<Typography variant="body1" color="text.secondary">to</Typography>
|
||||
<Typography variant="body1" color="text.primary">
|
||||
<MonospaceTextBox>{address.slice(0, 8)} ... {address.slice(-8)}</MonospaceTextBox>
|
||||
</Typography>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "row",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<Typography variant="body1" color="text.secondary">
|
||||
to
|
||||
</Typography>
|
||||
<Typography variant="body1" color="text.primary">
|
||||
<MonospaceTextBox>
|
||||
{address.slice(0, 8)} ... {address.slice(-8)}
|
||||
</MonospaceTextBox>
|
||||
</Typography>
|
||||
</Box>
|
||||
</Box>
|
||||
<Box sx={{ display: "flex", flexDirection: "column", alignItems: "center", gap: 1 }}>
|
||||
<Button onClick={onClose} variant="contained" color="primary">Done</Button>
|
||||
<Button color="primary" size="small" endIcon={<ArrowOutwardIcon />} onClick={() => open(explorerUrl)}>View on Explorer</Button>
|
||||
<Box
|
||||
sx={{
|
||||
display: "flex",
|
||||
flexDirection: "column",
|
||||
alignItems: "center",
|
||||
gap: 1,
|
||||
}}
|
||||
>
|
||||
<Button onClick={onClose} variant="contained" color="primary">
|
||||
Done
|
||||
</Button>
|
||||
<Button
|
||||
color="primary"
|
||||
size="small"
|
||||
endIcon={<ArrowOutwardIcon />}
|
||||
onClick={() => open(explorerUrl)}
|
||||
>
|
||||
View on Explorer
|
||||
</Button>
|
||||
</Box>
|
||||
</Box>
|
||||
);
|
||||
|
|
|
|||
|
|
@ -514,16 +514,15 @@ export async function sendMoneroTransaction(
|
|||
const response = await sendMonero(args);
|
||||
|
||||
// Refresh balance and history after sending - but don't let this block the response
|
||||
Promise.all([
|
||||
getMoneroBalance(),
|
||||
getMoneroHistory(),
|
||||
]).then(([newBalance, newHistory]) => {
|
||||
store.dispatch(setBalance(newBalance));
|
||||
store.dispatch(setHistory(newHistory));
|
||||
}).catch(refreshErr => {
|
||||
console.error("Failed to refresh wallet data after send:", refreshErr);
|
||||
// Could emit a toast notification here
|
||||
});
|
||||
Promise.all([getMoneroBalance(), getMoneroHistory()])
|
||||
.then(([newBalance, newHistory]) => {
|
||||
store.dispatch(setBalance(newBalance));
|
||||
store.dispatch(setHistory(newHistory));
|
||||
})
|
||||
.catch((refreshErr) => {
|
||||
console.error("Failed to refresh wallet data after send:", refreshErr);
|
||||
// Could emit a toast notification here
|
||||
});
|
||||
|
||||
return response;
|
||||
} catch (err) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue