- Added dedicated merchant dashboard with analytics and transactions - Implemented API Key based authentication for merchants - Introduced 8-character Short IDs for merchants to use in URLs - Refactored checkout and payment intent APIs to support multi-gateway - Enhanced Landing Page with Merchant Portal access and marketing copy - Fixed Next.js 15 async params build issues - Updated internal branding to P2CGateway - Added AyrisTech credits to footer
42 lines
1.5 KiB
TypeScript
42 lines
1.5 KiB
TypeScript
'use client';
|
|
|
|
import React, { useState, useEffect } from 'react';
|
|
import { useRouter, useSearchParams } from 'next/navigation';
|
|
import { Search } from 'lucide-react';
|
|
|
|
export default function CustomerSearch() {
|
|
const router = useRouter();
|
|
const searchParams = useSearchParams();
|
|
const [searchTerm, setSearchTerm] = useState(searchParams.get('q') || '');
|
|
|
|
useEffect(() => {
|
|
const currentQ = searchParams.get('q') || '';
|
|
if (searchTerm === currentQ) return;
|
|
|
|
const delayDebounceFn = setTimeout(() => {
|
|
const params = new URLSearchParams(searchParams.toString());
|
|
if (searchTerm) {
|
|
params.set('q', searchTerm);
|
|
} else {
|
|
params.delete('q');
|
|
}
|
|
router.push(`/admin/customers?${params.toString()}`);
|
|
}, 500);
|
|
|
|
return () => clearTimeout(delayDebounceFn);
|
|
}, [searchTerm, searchParams, router]);
|
|
|
|
return (
|
|
<div className="relative flex-1 max-w-md">
|
|
<Search className="absolute left-6 top-1/2 -translate-y-1/2 text-gray-300" size={20} />
|
|
<input
|
|
type="text"
|
|
placeholder="İsim veya telefon ile ara..."
|
|
value={searchTerm}
|
|
onChange={(e) => setSearchTerm(e.target.value)}
|
|
className="w-full pl-16 pr-6 py-5 bg-gray-50 border-none rounded-2xl text-sm font-medium focus:ring-2 focus:ring-blue-500 outline-none placeholder:text-gray-300"
|
|
/>
|
|
</div>
|
|
);
|
|
}
|