feat: replace native alerts with react-hot-toast notifications and update rider plan constants

This commit is contained in:
sazzadulalambd
2026-05-05 02:44:32 +06:00
parent 4445624638
commit 111b242bf8
3 changed files with 74 additions and 70 deletions

View File

@@ -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 = () => {

View File

@@ -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!');
}}
/>
</div>
@@ -2217,7 +2218,7 @@ function NewApplicationModal({ isOpen, onClose, onSave }: { isOpen: boolean; onC
</h4>
<div className="grid grid-cols-1 sm:grid-cols-3 gap-3 mb-4">
{[
{ 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 => (

View File

@@ -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({
<main className="lg:ml-64 min-h-screen">
{children}
</main>
<Toaster position="top-right" />
</body>
</html>
);