Skip to content

Commit 67e1320

Browse files
committed
minor fixes
1 parent 679315b commit 67e1320

File tree

2 files changed

+57
-36
lines changed

2 files changed

+57
-36
lines changed

src/components/pages/homepage/wallets/new-wallet-flow/ready/index.tsx

Lines changed: 56 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,17 @@ import { useSiteStore } from "@/lib/zustand/site";
99
import { buildWallet } from "@/hooks/common";
1010

1111
import PageHeader from "@/components/common/page-header";
12-
import { Card, CardContent, CardDescription, CardHeader, CardTitle } from "@/components/ui/card";
12+
import {
13+
Card,
14+
CardContent,
15+
CardDescription,
16+
CardHeader,
17+
CardTitle,
18+
} from "@/components/ui/card";
1319
import { Button } from "@/components/ui/button";
1420
import ProgressIndicator from "@/components/pages/homepage/wallets/new-wallet-flow/shared/ProgressIndicator";
1521
import WalletFlowPageLayout from "@/components/pages/homepage/wallets/new-wallet-flow/shared/WalletFlowPageLayout";
22+
import { buildMultisigWallet } from "@/utils/common";
1623

1724
export default function PageSuccessWallet() {
1825
const router = useRouter();
@@ -25,12 +32,11 @@ export default function PageSuccessWallet() {
2532
// Get wallet data to show details
2633
const { data: walletData } = api.wallet.getWallet.useQuery(
2734
{ walletId, address: userAddress || "" },
28-
{ enabled: !!walletId && !!userAddress }
35+
{ enabled: !!walletId && !!userAddress },
2936
);
3037

3138
// Build wallet with address and other computed fields
32-
const wallet = walletData ? buildWallet(walletData, network) : null;
33-
39+
const wallet = walletData ? buildMultisigWallet(walletData, network) : null;
3440

3541
const handleViewWallets = () => {
3642
setLoading(true);
@@ -43,8 +49,8 @@ export default function PageSuccessWallet() {
4349
};
4450

4551
const handleCopyAddress = () => {
46-
if (wallet?.address) {
47-
navigator.clipboard.writeText(wallet.address);
52+
if (wallet?.getScript().address) {
53+
navigator.clipboard.writeText(wallet?.getScript().address);
4854
toast({
4955
title: "Copied!",
5056
description: "Wallet address copied to clipboard",
@@ -54,8 +60,8 @@ export default function PageSuccessWallet() {
5460
};
5561

5662
const handleCopyDRepId = () => {
57-
if (wallet?.dRepId) {
58-
navigator.clipboard.writeText(wallet.dRepId);
63+
if (wallet?.getDRepId()) {
64+
navigator.clipboard.writeText(wallet?.getDRepId());
5965
toast({
6066
title: "Copied!",
6167
description: "DRep ID copied to clipboard",
@@ -71,11 +77,11 @@ export default function PageSuccessWallet() {
7177
<CardHeader>
7278
<CardTitle>Wallet created successfully</CardTitle>
7379
</CardHeader>
74-
80+
7581
<CardContent className="space-y-4 sm:space-y-6">
7682
{/* Success notification inline */}
77-
<div className="flex items-start gap-3 p-4 bg-muted/50 border border-muted-foreground/20 rounded-lg">
78-
<CheckCircle2 className="h-5 w-5 text-green-600 dark:text-green-400 mt-0.5 flex-shrink-0" />
83+
<div className="flex items-start gap-3 rounded-lg border border-muted-foreground/20 bg-muted/50 p-4">
84+
<CheckCircle2 className="mt-0.5 h-5 w-5 flex-shrink-0 text-green-600 dark:text-green-400" />
7985
<div className="space-y-1">
8086
<p className="text-sm font-medium">
8187
Your multi-signature wallet is ready to use
@@ -85,37 +91,46 @@ export default function PageSuccessWallet() {
8591
</p>
8692
</div>
8793
</div>
88-
94+
8995
{/* Wallet Details */}
9096
{wallet && (
91-
<div className="p-4 bg-muted/30 rounded-lg space-y-3">
97+
<div className="space-y-3 rounded-lg bg-muted/30 p-4">
9298
{/* Name */}
93-
<div className="grid grid-cols-[120px_1fr] gap-4 items-baseline">
99+
<div className="grid grid-cols-[120px_1fr] items-baseline gap-4">
94100
<span className="text-sm text-muted-foreground">Name</span>
95101
<span className="text-sm font-medium">{wallet.name}</span>
96102
</div>
97103
{/* Description - only if exists */}
98104
{wallet.description && (
99-
<div className="grid grid-cols-[120px_1fr] gap-4 items-baseline">
100-
<span className="text-sm text-muted-foreground">Description</span>
105+
<div className="grid grid-cols-[120px_1fr] items-baseline gap-4">
106+
<span className="text-sm text-muted-foreground">
107+
Description
108+
</span>
101109
<span className="text-sm">{wallet.description}</span>
102110
</div>
103111
)}
104112
{/* Signature Rule */}
105-
<div className="grid grid-cols-[120px_1fr] gap-4 items-baseline">
106-
<span className="text-sm text-muted-foreground">Signature Rule</span>
113+
<div className="grid grid-cols-[120px_1fr] items-baseline gap-4">
114+
<span className="text-sm text-muted-foreground">
115+
Signature Rule
116+
</span>
107117
<span className="text-sm">
108-
{wallet.type === 'atLeast' ? `${wallet.numRequiredSigners} of ${wallet.signersAddresses.length} signers must approve` :
109-
wallet.type === 'all' ? `All signers (of ${wallet.signersAddresses.length}) must approve` :
110-
wallet.type === 'any' ? `Any signer (of ${wallet.signersAddresses.length}) can approve` :
111-
`${wallet.numRequiredSigners} of ${wallet.signersAddresses.length} signers must approve`}
118+
{walletData?.type === "atLeast"
119+
? `${walletData?.numRequiredSigners} of ${walletData?.signersAddresses.length} signers must approve`
120+
: walletData?.type === "all"
121+
? `All signers (of ${walletData?.signersAddresses.length}) must approve`
122+
: walletData?.type === "any"
123+
? `Any signer (of ${walletData?.signersAddresses.length}) can approve`
124+
: `${walletData?.numRequiredSigners} of ${walletData?.signersAddresses.length} signers must approve`}
112125
</span>
113126
</div>
114127
{/* Wallet Address with Copy Button */}
115-
{wallet.address && (
116-
<div className="grid grid-cols-[120px_1fr_auto] gap-4 items-center">
128+
{wallet?.getScript().address && (
129+
<div className="grid grid-cols-[120px_1fr_auto] items-center gap-4">
117130
<span className="text-sm text-muted-foreground">Address</span>
118-
<span className="text-xs font-mono break-all">{wallet.address}</span>
131+
<span className="break-all font-mono text-xs">
132+
{wallet?.getScript().address}
133+
</span>
119134
<Button
120135
variant="ghost"
121136
size="sm"
@@ -127,10 +142,12 @@ export default function PageSuccessWallet() {
127142
</div>
128143
)}
129144
{/* DRep ID with Copy Button */}
130-
{wallet.dRepId && (
131-
<div className="grid grid-cols-[120px_1fr_auto] gap-4 items-center">
145+
{wallet.getDRepId() && (
146+
<div className="grid grid-cols-[120px_1fr_auto] items-center gap-4">
132147
<span className="text-sm text-muted-foreground">DRep ID</span>
133-
<span className="text-xs font-mono break-all">{wallet.dRepId}</span>
148+
<span className="break-all font-mono text-xs">
149+
{wallet.getDRepId()}
150+
</span>
134151
<Button
135152
variant="ghost"
136153
size="sm"
@@ -143,9 +160,13 @@ export default function PageSuccessWallet() {
143160
)}
144161
{/* Stake Credential - only if set */}
145162
{wallet.stakeCredentialHash && (
146-
<div className="grid grid-cols-[120px_1fr] gap-4 items-baseline">
147-
<span className="text-sm text-muted-foreground">Stake Credential</span>
148-
<span className="text-xs font-mono break-all">{wallet.stakeCredentialHash}</span>
163+
<div className="grid grid-cols-[120px_1fr] items-baseline gap-4">
164+
<span className="text-sm text-muted-foreground">
165+
Stake Credential
166+
</span>
167+
<span className="break-all font-mono text-xs">
168+
{wallet.stakeCredentialHash}
169+
</span>
149170
</div>
150171
)}
151172
</div>
@@ -154,25 +175,25 @@ export default function PageSuccessWallet() {
154175
</Card>
155176

156177
{/* Action Section - Buttons aligned right */}
157-
<div className="mt-6 sm:mt-8 flex flex-col sm:flex-row gap-3 sm:gap-4 sm:justify-end">
178+
<div className="mt-6 flex flex-col gap-3 sm:mt-8 sm:flex-row sm:justify-end sm:gap-4">
158179
<Button
159180
variant="outline"
160181
onClick={handleViewWallets}
161182
disabled={loading}
162-
className="w-full sm:w-auto order-2 sm:order-1"
183+
className="order-2 w-full sm:order-1 sm:w-auto"
163184
size="lg"
164185
>
165186
View All Wallets
166187
</Button>
167188
<Button
168189
onClick={handleViewWallet}
169190
disabled={loading}
170-
className="w-full sm:w-auto order-1 sm:order-2"
191+
className="order-1 w-full sm:order-2 sm:w-auto"
171192
size="lg"
172193
>
173194
Go to Wallet
174195
</Button>
175196
</div>
176197
</WalletFlowPageLayout>
177198
);
178-
}
199+
}

src/utils/common.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ export function buildWallet(
8585
network: number,
8686
utxos?: UTxO[],
8787
): Wallet {
88-
console.log("hi");
88+
8989
const mWallet = buildMultisigWallet(wallet, network);
9090
if (!mWallet) {
9191
console.error("error when building Multisig Wallet!");

0 commit comments

Comments
 (0)