Skip to content
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
38 changes: 19 additions & 19 deletions frontend/src/components/VaultDashboard.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,26 +33,26 @@ const VaultDashboard: React.FC<VaultDashboardProps> = ({
const value = Number(amount);

if (!walletAddress) {
toast.warning({
title: "Wallet required",
description: "Connect your wallet before submitting a transaction.",
});
toast.warning({
title: "Wallet required",
description: "Connect your wallet before submitting a transaction.",
});
return;
}

if (!amount || Number.isNaN(value) || value <= 0) {
toast.warning({
title: "Enter a valid amount",
description: "Choose a valid USDC amount before submitting the transaction.",
});
toast.warning({
title: "Enter a valid amount",
description: "Choose a valid USDC amount before submitting the transaction.",
});
return;
}

if (actionType === "withdraw" && value > availableBalance) {
toast.warning({
title: "Insufficient balance",
description: "The withdrawal amount exceeds your available USDC balance.",
});
toast.warning({
title: "Insufficient balance",
description: "The withdrawal amount exceeds your available USDC balance.",
});
return;
}

Expand All @@ -64,13 +64,13 @@ const VaultDashboard: React.FC<VaultDashboardProps> = ({
);
setAmount("");
setIsProcessing(null);
toast.success({
title: actionType === "deposit" ? "Deposit queued" : "Withdrawal queued",
description:
actionType === "deposit"
? `${value.toFixed(2)} USDC has been added to your pending vault activity.`
: `${value.toFixed(2)} USDC has been added to your pending withdrawal activity.`,
});
toast.success({
title: actionType === "deposit" ? "Deposit queued" : "Withdrawal queued",
description:
actionType === "deposit"
? `${value.toFixed(2)} USDC has been added to your pending vault activity.`
: `${value.toFixed(2)} USDC has been added to your pending withdrawal activity.`,
});
}, 2000);
};

Expand Down
52 changes: 26 additions & 26 deletions frontend/src/components/WalletConnect.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,12 +31,12 @@ const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, onConnect,
}

if (walletAddress) {
onDisconnect();
toast.info({
title: "Wallet disconnected",
description: "Freighter is no longer connected to this session.",
});
}
onDisconnect();
toast.info({
title: "Wallet disconnected",
description: "Freighter is no longer connected to this session.",
});
}
};

syncConnection();
Expand All @@ -56,31 +56,31 @@ const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, onConnect,
if (allowed.isAllowed) {
const userInfo = await getAddress();
if (userInfo.address) {
onConnect(userInfo.address);
toast.success({
title: t('toast.walletConnected.title'),
description: t('toast.walletConnected.description'),
});
onConnect(userInfo.address);
toast.success({
title: t('toast.walletConnected.title'),
description: t('toast.walletConnected.description'),
});
}
}
const discoveredAddress = await discoverConnectedAddress();
if (discoveredAddress) {
onConnect(discoveredAddress);
toast.success({
title: "Wallet connected",
description: "Freighter is now connected to your YieldVault session.",
});
onConnect(discoveredAddress);
toast.success({
title: "Wallet connected",
description: "Freighter is now connected to your YieldVault session.",
});
} else {
toast.warning({
title: t('toast.walletPermissionRequired.title'),
description: t('toast.walletPermissionRequired.description'),
});
toast.warning({
title: t('toast.walletPermissionRequired.title'),
description: t('toast.walletPermissionRequired.description'),
});
}
} catch (e: unknown) {
console.error(e);
toast.error({
title: t('toast.walletConnectionFailed.title'),
description: t('toast.walletConnectionFailed.description'),
console.error(e);
toast.error({
title: t('toast.walletConnectionFailed.title'),
description: t('toast.walletConnectionFailed.description'),
});
} finally {
setIsConnecting(false);
Expand Down Expand Up @@ -138,8 +138,8 @@ const WalletConnect: React.FC<WalletConnectProps> = ({ walletAddress, onConnect,
onClick={() => {
onDisconnect();
toast.info({
title: t('toast.walletDisconnected.title'),
description: t('toast.walletDisconnected.description'),
title: t('toast.walletDisconnected.title'),
description: t('toast.walletDisconnected.description'),
});
}}
aria-label={t('wallet.disconnectAria')}
Expand Down
Loading