From 0d547b792c7fe00751cb0aa8714f1eb786fe0e15 Mon Sep 17 00:00:00 2001 From: OG T Date: Fri, 12 Jun 2026 11:17:12 +0800 Subject: [PATCH] feat: improve USDC wallet checkout clarity --- .../app/propose/success/WalletCheckout.tsx | 162 +++++++++++++----- apps/web/src/app/propose/success/page.tsx | 12 ++ apps/web/src/app/propose/wallet/actions.ts | 6 + 3 files changed, 141 insertions(+), 39 deletions(-) diff --git a/apps/web/src/app/propose/success/WalletCheckout.tsx b/apps/web/src/app/propose/success/WalletCheckout.tsx index ed7638d..3bbf029 100644 --- a/apps/web/src/app/propose/success/WalletCheckout.tsx +++ b/apps/web/src/app/propose/success/WalletCheckout.tsx @@ -1,6 +1,6 @@ "use client"; -import { Copy, ExternalLink, Wallet } from "lucide-react"; +import { AlertTriangle, CheckCircle2, Copy, ExternalLink, QrCode, ShieldCheck, Wallet } from "lucide-react"; import { useState } from "react"; type WalletCheckoutProps = { @@ -44,6 +44,12 @@ function CopyRow({ label, value, copyValue, copiedKey, copied, onCopy }: CopyRow ); } +function shortAddress(value: string) { + if (!value) return ""; + if (value.length <= 18) return value; + return `${value.slice(0, 10)}...${value.slice(-8)}`; +} + export function WalletCheckout({ amountUsdc, network, @@ -59,6 +65,19 @@ export function WalletCheckout({ const [copied, setCopied] = useState(""); const paymentMemo = `VibeWork Proposal ${proposalId}`; const walletReady = Boolean(walletAddress); + const qrData = paymentUri || walletAddress; + const qrCodeUrl = qrData + ? `https://api.qrserver.com/v1/create-qr-code/?size=220x220&margin=12&data=${encodeURIComponent(qrData)}` + : ""; + const checkoutDetails = [ + `VibeWork wallet checkout`, + `Amount: ${amountUsdc} USDC`, + `Network: ${network}`, + `Wallet: ${walletAddress}`, + `Chain ID: ${chainId}`, + `USDC token: ${tokenAddress}`, + `Memo: ${paymentMemo}`, + ].join("\n"); const copyValue = async (key: string, value: string) => { try { @@ -71,26 +90,37 @@ export function WalletCheckout({ }; return ( -
+

USDC wallet checkout

- 請使用 Base USDC 轉帳,完成後貼上 tx hash 進入人工確認。 + 請用自己的錢包確認金額、鏈與收款地址後付款。完成後貼上 tx hash,系統會先自動驗證 Base USDC。

- {paymentUri && !capturedReference ? ( - + + {paymentUri && !capturedReference ? ( + + + 開啟錢包 + + ) : null} +
{capturedReference ? ( @@ -99,36 +129,90 @@ export function WalletCheckout({
) : null} -
- - - - {walletReady ? ( - <> - - - - - {paymentUri ? ( - +
+
+
+
+
應付金額
+
{amountUsdc}
+
USDC
+
+
+
網路
+
{network}
+
Chain ID {chainId}
+
+
+
收款錢包
+
+ {walletReady ? shortAddress(walletAddress) : walletLabel} +
+
Treasury
+
+
+ +
+
+ + 金額需完全等於 {amountUsdc} USDC。 +
+
+ + 只支援 Base USDC;錯鏈不會自動入帳。 +
+
+ + 請勿轉入 ETH、USDT 或其他 token。 +
+
+ +
+ + + + {walletReady ? ( + <> + + + + + {paymentUri ? ( + + ) : null} + ) : null} - +
+
+ + {walletReady && qrCodeUrl ? ( +
+
+ + 掃碼付款 +
+
+ VibeWork USDC payment QR code +
+

+ 掃碼後仍請在錢包內確認網路、金額與收款地址。 +

+
) : null} -
+ {copied === "copy-failed" ? (

瀏覽器阻擋自動複製,請手動選取付款資訊。

diff --git a/apps/web/src/app/propose/success/page.tsx b/apps/web/src/app/propose/success/page.tsx index eb55a0d..f62341f 100644 --- a/apps/web/src/app/propose/success/page.tsx +++ b/apps/web/src/app/propose/success/page.tsx @@ -218,6 +218,18 @@ export default async function ProposalSuccessPage({ searchParams }: { searchPara placeholder={`建議填:VibeWork Proposal ${task?.id || taskId}`} /> +