"use client"; import { useState } from "react"; import { Alert, Input, Modal } from "../../UI"; import { ArchivedClientAddressesTable } from "./ArchivedClientAddressesTable"; import { ArchivedClientAddressesDetailModal } from "./ArchivedClientAddressesDetailModal"; import { useArchivedClientAddresses } from "@/src/hooks/archive/useArchiveClientAdresses"; import type { ArchivedClientAddress } from "@/src/types/client_adresses"; interface ArchivedClientsAddressesModalProps { onClose: () => void; /** Optional — scopes the archive to a single client's addresses. * Pass the current clientId when opened from a client's addresses page; * omit to browse the full cross-client archive. */ clientId?: string; } export function ArchivedClientsAddressesModal({ onClose, clientId }: ArchivedClientsAddressesModalProps) { const [viewAddress, setViewAddress] = useState(null); const { addresses, total, loading, error, search, handleSearch, clearError, } = useArchivedClientAddresses(clientId); return ( {viewAddress && ( setViewAddress(null)} /> )}
{/* search — client-side only: this endpoint has no server-side search/pagination */}
handleSearch(e.target.value)} dir="rtl" icon={