Skip to content

Commit 97592cc

Browse files
committed
Add contact management and enhance transaction UI
- Introduced a new Contact model in the Prisma schema to manage user contacts associated with wallets. - Updated wallet info page to include a ManageContacts component for easy access to contacts. - Enhanced transaction components to display address labels for recipients, improving clarity on sender and recipient identities. - Implemented a contacts dialog for selecting contacts when creating transactions, streamlining the user experience. - Improved UTxO selection with search functionality and detailed summaries of selected UTxOs, enhancing transaction management. - Refactored various components to ensure consistent styling and improved user interaction.
1 parent 6dc3a72 commit 97592cc

File tree

19 files changed

+2050
-376
lines changed

19 files changed

+2050
-376
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
-- CreateTable
2+
CREATE TABLE "Contact" (
3+
"id" TEXT NOT NULL,
4+
"walletId" TEXT NOT NULL,
5+
"name" TEXT NOT NULL,
6+
"address" TEXT NOT NULL,
7+
"description" TEXT,
8+
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
9+
"updatedAt" TIMESTAMP(3) NOT NULL,
10+
11+
CONSTRAINT "Contact_pkey" PRIMARY KEY ("id")
12+
);
13+
14+
-- CreateIndex
15+
CREATE INDEX "Contact_walletId_idx" ON "Contact"("walletId");
16+
17+
-- CreateIndex
18+
CREATE INDEX "Contact_address_idx" ON "Contact"("address");
19+
20+
-- CreateIndex
21+
CREATE UNIQUE INDEX "Contact_walletId_address_key" ON "Contact"("walletId", "address");
22+

prisma/schema.prisma

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,17 @@ model Migration {
163163
@@index([status])
164164
@@index([createdAt])
165165
}
166+
167+
model Contact {
168+
id String @id @default(cuid())
169+
walletId String // The multisig wallet that owns this contact
170+
name String
171+
address String
172+
description String?
173+
createdAt DateTime @default(now())
174+
updatedAt DateTime @updatedAt
175+
176+
@@unique([walletId, address])
177+
@@index([walletId])
178+
@@index([address])
179+
}

src/components/pages/wallet/info/card-info.tsx

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -401,6 +401,26 @@ function ShowInfo({ appWallet }: { appWallet: Wallet }) {
401401
<div className="grid grid-cols-1 md:grid-cols-2 gap-4">
402402
{/* Left Column */}
403403
<div className="space-y-4">
404+
{/* Signing Threshold - Above Address */}
405+
<div className="flex items-center gap-3 p-3 bg-muted/30 rounded-lg border border-border/30">
406+
<div className="flex-1 min-w-0">
407+
<div className="text-xs font-medium text-muted-foreground mb-0.5">Signing Threshold</div>
408+
<div className="text-sm font-medium">{getSignersText()}</div>
409+
</div>
410+
<div className="flex items-center gap-1.5 flex-shrink-0">
411+
{Array.from({ length: signersCount }).map((_, index) => (
412+
<User
413+
key={index}
414+
className={`h-5 w-5 sm:h-6 sm:w-6 ${
415+
index < requiredCount
416+
? "text-foreground opacity-100"
417+
: "text-muted-foreground opacity-30"
418+
}`}
419+
/>
420+
))}
421+
</div>
422+
</div>
423+
404424
{/* Address */}
405425
<RowLabelInfo
406426
label="Address"
@@ -451,31 +471,10 @@ function ShowInfo({ appWallet }: { appWallet: Wallet }) {
451471

452472
{/* Right Column */}
453473
<div className="space-y-4">
454-
{/* Balance */}
455-
<RowLabelInfo
456-
label="Balance"
457-
value={`${balance} ₳`}
458-
allowOverflow={false}
459-
/>
460-
461-
{/* Signing Threshold */}
462-
<div className="flex items-center gap-3 p-3 bg-muted/30 rounded-lg border border-border/30">
463-
<div className="flex-1 min-w-0">
464-
<div className="text-xs font-medium text-muted-foreground mb-0.5">Signing Threshold</div>
465-
<div className="text-sm font-medium">{getSignersText()}</div>
466-
</div>
467-
<div className="flex items-center gap-1.5 flex-shrink-0">
468-
{Array.from({ length: signersCount }).map((_, index) => (
469-
<User
470-
key={index}
471-
className={`h-5 w-5 sm:h-6 sm:w-6 ${
472-
index < requiredCount
473-
? "text-foreground opacity-100"
474-
: "text-muted-foreground opacity-30"
475-
}`}
476-
/>
477-
))}
478-
</div>
474+
{/* Balance - Larger Display */}
475+
<div className="flex flex-col gap-2">
476+
<div className="text-sm font-medium text-muted-foreground">Balance</div>
477+
<div className="text-2xl sm:text-3xl font-semibold">{balance}</div>
479478
</div>
480479
</div>
481480
</div>

src/components/pages/wallet/info/index.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import useAppWallet from "@/hooks/useAppWallet";
22
import useMultisigWallet from "@/hooks/useMultisigWallet";
33
import CardInfo from "./card-info";
44
import CardSigners from "./signers/card-signers";
5+
import { ManageContacts } from "./manage-contacts";
56
import { MigrateWallet } from "./migrate-wallet";
67
import { ArchiveWallet } from "./archive-wallet";
78
import { UpgradeStakingWallet } from "./upgrade-staking-wallet";
@@ -19,6 +20,7 @@ export default function WalletInfo() {
1920
<div className="grid grid-cols-1 gap-4 sm:gap-6">
2021
<CardInfo appWallet={appWallet} />
2122
<CardSigners appWallet={appWallet} />
23+
<ManageContacts appWallet={appWallet} />
2224
<MigrateWallet appWallet={appWallet} />
2325
<ProxyControlCard />
2426
{multisigWallet && <UpgradeStakingWallet mWallet={multisigWallet} appWallet={appWallet} />}

0 commit comments

Comments
 (0)