From c70299dbf4c795be368b3d16c6f2307af2c57983 Mon Sep 17 00:00:00 2001 From: Godfr3y Date: Thu, 25 Jun 2026 12:07:21 +0100 Subject: [PATCH] Build KYC status indicator updated UserProfile in lib/api/users.ts to include kycStatus, created components/dashboard/kyc-status-banner.tsx (fetches profile, shows amber warning + "Verify Now" CTA for unverified users, dismissible per session via localStorage, hidden for verified users), created components/dashboard/settings/kyc-section.tsx (green badge + "Your identity has been verified" for verified, red badge + "Verification required" + "Start Verification" button for unverified), and wired both into the dashboard page and the identity verification tab in settings respectively. --- app/(dashboard)/dashboard/page.tsx | 2 + components/dashboard/kyc-status-banner.tsx | 70 ++++++++++++++++ components/dashboard/settings/kyc-section.tsx | 79 +++++++++++++++++++ components/settings/tabs.tsx | 2 + lib/api/users.ts | 1 + 5 files changed, 154 insertions(+) create mode 100644 components/dashboard/kyc-status-banner.tsx create mode 100644 components/dashboard/settings/kyc-section.tsx diff --git a/app/(dashboard)/dashboard/page.tsx b/app/(dashboard)/dashboard/page.tsx index 2a760e65..65ffed76 100644 --- a/app/(dashboard)/dashboard/page.tsx +++ b/app/(dashboard)/dashboard/page.tsx @@ -1,6 +1,7 @@ "use client"; import { AccountOverview } from "@/components/dashboard/account-overview"; import DepositMethods from "@/components/dashboard/deposit"; +import { KYCStatusBanner } from "@/components/dashboard/kyc-status-banner"; import { MarketOverview } from "@/components/dashboard/market-overview"; import { RecentTransactions } from "@/components/dashboard/recent-transactions"; import { WithdrawalModal } from "@/components/dashboard/withdrawal/WithdrawalModal"; @@ -18,6 +19,7 @@ export default function DashboardPage() { return (
+ {openDeposit ? ( ) : ( diff --git a/components/dashboard/kyc-status-banner.tsx b/components/dashboard/kyc-status-banner.tsx new file mode 100644 index 00000000..06b936e6 --- /dev/null +++ b/components/dashboard/kyc-status-banner.tsx @@ -0,0 +1,70 @@ +'use client'; + +import { getProfile } from '@/lib/api/users'; +import { X } from 'lucide-react'; +import Link from 'next/link'; +import { useEffect, useState } from 'react'; + +const DISMISS_KEY = 'kyc-banner-dismissed'; + +export function KYCStatusBanner() { + const [kycStatus, setKycStatus] = useState(null); + const [loading, setLoading] = useState(true); + const [dismissed, setDismissed] = useState(false); + + useEffect(() => { + const load = async () => { + try { + const profile = await getProfile(); + setKycStatus(profile.kycStatus ?? null); + } catch { + setKycStatus(null); + } finally { + setLoading(false); + } + }; + load(); + }, []); + + if (loading) return null; + + const isVerified = kycStatus === 'Verified'; + if (isVerified) return null; + + const isDismissed = + dismissed || localStorage.getItem(DISMISS_KEY) === 'true'; + if (isDismissed) return null; + + const handleDismiss = () => { + localStorage.setItem(DISMISS_KEY, 'true'); + setDismissed(true); + }; + + return ( +
+ +
+
+

+ Your account is not yet verified +

+

+ Complete KYC to unlock full transaction limits. +

+
+ + Verify Now + +
+
+ ); +} diff --git a/components/dashboard/settings/kyc-section.tsx b/components/dashboard/settings/kyc-section.tsx new file mode 100644 index 00000000..b6648ac8 --- /dev/null +++ b/components/dashboard/settings/kyc-section.tsx @@ -0,0 +1,79 @@ +'use client'; + +import { getProfile } from '@/lib/api/users'; +import { BadgeCheck, AlertTriangle } from 'lucide-react'; +import Link from 'next/link'; +import { useEffect, useState } from 'react'; + +export function KycSection() { + const [kycStatus, setKycStatus] = useState(null); + const [loading, setLoading] = useState(true); + + useEffect(() => { + const load = async () => { + try { + const profile = await getProfile(); + setKycStatus(profile.kycStatus ?? null); + } catch { + setKycStatus(null); + } finally { + setLoading(false); + } + }; + load(); + }, []); + + if (loading) { + return ( +
+
+
+
+ ); + } + + const isVerified = kycStatus === 'Verified'; + + return ( +
+

+ KYC Verification +

+ + {isVerified ? ( +
+ +
+ + Verified + +

+ Your identity has been verified +

+
+
+ ) : ( +
+ +
+ + Unverified + +

+ Verification required +

+
+
+ )} + + {!isVerified && ( + + Start Verification + + )} +
+ ); +} diff --git a/components/settings/tabs.tsx b/components/settings/tabs.tsx index b6cd2591..406a07e7 100644 --- a/components/settings/tabs.tsx +++ b/components/settings/tabs.tsx @@ -3,6 +3,7 @@ import { useState } from "react"; import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs"; import { AccountIcon, SecurityIcon, IdentityIcon } from "../icons"; import { AccountInfo } from "./account-info"; +import { KycSection } from "../dashboard/settings/kyc-section"; import { Security } from "./security"; import { Notification } from "./notification"; import { ProfileOverview } from "../profile/profile-overview"; @@ -72,6 +73,7 @@ export function TabsSettings() { {/* Right Column: Content Stack */}
+
diff --git a/lib/api/users.ts b/lib/api/users.ts index e60e6140..f8ca0139 100644 --- a/lib/api/users.ts +++ b/lib/api/users.ts @@ -8,6 +8,7 @@ export interface UserProfile { phone?: string; avatarUrl?: string; isVerified?: boolean; + kycStatus?: string; walletAddress?: string; }