import { type FC, useState } from 'react' import PageTitle from '../../components/PageTitle' import { useGetContactUs } from './hooks/useContactUsData'; import { type ContactUsItem } from './types'; import PageLoading from '../../components/PageLoading'; import Error from '../../components/Error'; import PaginationUi from '../../components/PaginationUi'; import Td from '../../components/Td'; const ContactUsList: FC = () => { const [currentPage, setCurrentPage] = useState(1); const { data: contactUsData, isLoading, error } = useGetContactUs(currentPage); if (isLoading) { return (
); } if (error) { return (
); } const contactUs = contactUsData?.results?.contactUs || []; const pager = contactUsData?.results?.pager; const truncateText = (text: string, maxLength: number = 100) => { return text.length > maxLength ? text.substring(0, maxLength) + '...' : text; }; return (
{contactUs.length === 0 ? ( ) : ( contactUs.map((contact: ContactUsItem, index: number) => ( )) )}
هیچ پیامی یافت نشد
{ setCurrentPage(page); }} />
) } export default ContactUsList