import { type FC } from 'react' import { useNavigate } from 'react-router-dom' import { useGetLearning } from './hooks/useSellerData' import type { Learning as LearningType } from './types/Types' import PageLoading from '../../components/PageLoading' import Error from '../../components/Error' import PageTitle from '../../components/PageTitle' import Td from '../../components/Td' import Button from '@/components/Button' import LearningTableRow from './components/LearningTableRow' import { Pages } from '@/config/Pages' const Learning: FC = () => { const navigate = useNavigate() const { data: learningData, isLoading, error } = useGetLearning() const handleEditLearning = (learning: LearningType) => { navigate(`${Pages.sellers.learningUpdate}${learning._id}`) } const handleCreateLearning = () => { navigate(Pages.sellers.learningCreate) } if (isLoading) { return (
) } if (error) { return (
) } const learnings = learningData?.results?.learning || [] return (
{learnings.length === 0 ? ( ) : ( learnings.map((learning: LearningType) => ( )) )}
هیچ یادگیری یافت نشد
) } export default Learning