"use client"; import { useState } from "react"; import { Alert, Input, Button } 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 (
{ if (e.target === e.currentTarget) onClose(); }} style={{ position: "fixed", inset: 0, zIndex: 70, background: "rgba(15,23,42,0.6)", backdropFilter: "blur(4px)", display: "flex", alignItems: "flex-start", justifyContent: "center", padding: "2rem 1rem", overflowY: "auto", }} > {viewAddress && ( setViewAddress(null)} /> )}
e.stopPropagation()} style={{ width: "100%", maxWidth: 920, background: "var(--color-surface-sunken)", borderRadius: "var(--radius-xl)", border: "1px solid var(--color-border)", boxShadow: "0 24px 64px rgba(0,0,0,.2)", overflow: "hidden", }} > {/* header */}

الأرشيف

العناوين المؤرشفة ({total})

{/* body */}
{/* search — client-side only: this endpoint has no server-side search/pagination */}
handleSearch(e.target.value)} dir="rtl" icon={ } />
{error && }
); }