From 111b242bf879701101c21d21989703f69961fe3f Mon Sep 17 00:00:00 2001 From: sazzadulalambd Date: Tue, 5 May 2026 02:44:32 +0600 Subject: [PATCH] feat: replace native alerts with react-hot-toast notifications and update rider plan constants --- src/app/admin/kyc/[id]/page.tsx | 5 +- src/app/admin/kyc/page.tsx | 137 ++++++++++++++++---------------- src/app/layout.tsx | 2 + 3 files changed, 74 insertions(+), 70 deletions(-) diff --git a/src/app/admin/kyc/[id]/page.tsx b/src/app/admin/kyc/[id]/page.tsx index 44d7da5..651b1d0 100644 --- a/src/app/admin/kyc/[id]/page.tsx +++ b/src/app/admin/kyc/[id]/page.tsx @@ -9,10 +9,11 @@ import { CheckCircle, XCircle, ArrowLeft, Save, Printer, Send, MessageSquare, Edit, UserCheck, Wallet, Store, Globe, Calendar, Briefcase, Plus, Upload } from 'lucide-react'; +import toast from 'react-hot-toast'; type ApplicationSource = 'app' | 'web' | 'walkin' | 'referral'; type KYCType = 'biker' | 'investor' | 'swapstation' | 'merchant' | 'general'; -type RiderPlan = 'daily_rent' | 'weekly_rent' | 'monthly_rent' | 'rent_to_own' | 'share_ev'; +type RiderPlan = 'single_rent' | 'rent_to_own' | 'share_ev'; type VerificationStage = 'application' | 'document_collection' | 'risk_check' | 'plan_selection' | 'payment' | 'agreement' | 'allocated' | 'active'; interface Document { @@ -310,7 +311,7 @@ export default function KYCDetailPage() { } : null); setNewMessageText(''); setShowMessageModal(false); - alert(`Message sent to ${request.phone}`); + toast.success(`SMS sent to ${request.phone}`); }; const handleAddDocument = () => { diff --git a/src/app/admin/kyc/page.tsx b/src/app/admin/kyc/page.tsx index d01b716..188ffb6 100644 --- a/src/app/admin/kyc/page.tsx +++ b/src/app/admin/kyc/page.tsx @@ -9,10 +9,11 @@ import { Upload, CheckCircle, XCircle, Camera, AlertTriangle, Edit, Globe, Wallet, Calendar, CreditCard, FileSignature, MapPinned, Key, BatteryCharging, Briefcase, Plus } from 'lucide-react'; +import toast from 'react-hot-toast'; export type ApplicationSource = 'app' | 'web' | 'walkin' | 'referral'; export type KYCType = 'biker' | 'investor' | 'swapstation' | 'merchant' | 'general'; -export type RiderPlan = 'daily_rent' | 'weekly_rent' | 'monthly_rent' | 'rent_to_own' | 'share_ev'; +export type RiderPlan = 'single_rent' | 'rent_to_own' | 'share_ev'; export type VerificationStage = 'application' | 'document_collection' | 'risk_check' | 'plan_selection' | 'payment' | 'agreement' | 'allocated' | 'active'; interface NomineeDetails { @@ -352,12 +353,12 @@ export default function RequestsPage() { return req; }); setRequests(updatedRequests); - alert('Document approved!'); + toast.success('Document approved!'); }; const handleRejectDocument = (docId: string, reason: string) => { if (!selectedRequest || !reason.trim()) { - alert('Please enter a reason for rejection'); + toast.error('Please enter a reason for rejection'); return; } const updatedRequests = requests.map(req => { @@ -373,7 +374,7 @@ export default function RequestsPage() { }); setRequests(updatedRequests); setRejectReason(''); - alert('Document rejected!'); + toast.error('Document rejected!'); }; const filteredRequests = requests.filter(req => { @@ -410,7 +411,7 @@ export default function RequestsPage() { setRequests(updatedRequests); setShowMessageModal(false); setMessageText(''); - alert(`Message sent to ${selectedRequest.phone}: "${messageText}"`); + toast.success(`SMS sent to ${selectedRequest.phone}`); } }; @@ -444,7 +445,7 @@ export default function RequestsPage() { ); setRequests(updatedRequests); setShowActionModal(false); - alert(successMessage); + toast.success(successMessage); }; return ( @@ -1099,7 +1100,7 @@ export default function RequestsPage() { }; setRequests([newRequest, ...requests]); setShowNewApplicationModal(false); - alert('Application created successfully!'); + toast.success('Application created successfully!'); }} /> @@ -1674,68 +1675,68 @@ function NewApplicationModal({ isOpen, onClose, onSave }: { isOpen: boolean; onC {formData.type === 'biker' && ( -
-

- Driving License -

-
-
- - updateField('drivingLicense.number', e.target.value)} - className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" - placeholder="License number" - /> -
-
- - -
-
- - -
-
- - updateField('drivingLicense.issueDate', e.target.value)} - className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" - /> -
-
- - updateField('drivingLicense.expiryDate', e.target.value)} - className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" - /> +
+

+ Driving License +

+
+
+ + updateField('drivingLicense.number', e.target.value)} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + placeholder="License number" + /> +
+
+ + +
+
+ + +
+
+ + updateField('drivingLicense.issueDate', e.target.value)} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
+
+ + updateField('drivingLicense.expiryDate', e.target.value)} + className="w-full px-3 py-2 border border-slate-200 rounded-lg text-sm" + /> +
-
)}
)} @@ -2217,7 +2218,7 @@ function NewApplicationModal({ isOpen, onClose, onSave }: { isOpen: boolean; onC
{[ - { v: 'daily_rent', l: 'Single Rent', d: 'Single person rental plan', icon: Bike }, + { v: 'single_rent', l: 'Single Rent', d: 'Single person rental plan', icon: Bike }, { v: 'rent_to_own', l: 'Rent to Own', d: 'Own after X months', icon: Key }, { v: 'share_ev', l: 'Share EV', d: 'Shared bike', icon: Users }, ].map(plan => ( diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 627fd45..4bef204 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -2,6 +2,7 @@ import type { Metadata } from "next"; import { Inter } from "next/font/google"; import "./globals.css"; import Sidebar from "@/components/Sidebar"; +import { Toaster } from "react-hot-toast"; const inter = Inter({ variable: "--font-inter", @@ -25,6 +26,7 @@ export default function RootLayout({
{children}
+ );