import type { DistrictListData } from "@/features/districts/lib/data"; import { userStore } from "@/shared/hooks/user"; import { Button } from "@/shared/ui/button"; import { Table, TableBody, TableCell, TableHead, TableHeader, TableRow, } from "@/shared/ui/table"; import { Edit, Loader2, Trash } from "lucide-react"; import type { Dispatch, SetStateAction } from "react"; interface Props { data: DistrictListData[] | []; isLoading: boolean; isError: boolean; handleDelete: (user: DistrictListData) => void; setDialogOpen: Dispatch>; setEditingDistrict: Dispatch>; currentPage: number; } const TableDistrict = ({ data, isError, isLoading, handleDelete, setDialogOpen, setEditingDistrict, currentPage, }: Props) => { const { user } = userStore(); return (
{isLoading && (
)} {isError && (
Ma'lumotlarni olishda xatolik yuz berdi.
)} {!isError && !isLoading && ( ID Tuman nomi Kim qo‘shgan Harakatlar {data.map((d, index) => ( {index + 1 + (currentPage - 1) * 20} {d.name} {d.user.first_name} {d.user.last_name} {user?.is_superuser && ( )} ))} {data.length === 0 && ( Hech qanday tuman topilmadi )}
)}
); }; export default TableDistrict;