"use client"; import React from "react"; import { Table, Button, Space, Popconfirm, Tooltip, Avatar, Tag } from "antd"; import type { ColumnsType } from "antd/es/table"; import { Assistant } from "@/types/assistant"; import { Trash, Eye, User } from "iconsax-react"; import Link from "next/link"; interface SelectionConfig { setSelectedItems: (items: Assistant[]) => void; initialSelecteds: Assistant[]; } interface AssistantsProps { data: Assistant[]; loading: boolean; page: number; total: number; setPage: (page: number) => void; selectionConfig?: SelectionConfig | null; onDelete?: (id: number) => void; isDeleting?: boolean; } // این کامپوننت باید اکسپورت شود تا در فایل پیج استفاده شود export const Assistants = ({ data, loading, page, total, setPage, selectionConfig, onDelete, isDeleting, }: AssistantsProps) => { const columns: ColumnsType = [ { title: "شناسه", dataIndex: "id", key: "id", width: 60, align: "center", }, { title: "تصویر", dataIndex: "image", key: "image", width: 70, align: "center", render: (img) => ( } /> ) }, { title: "نام دستیار", dataIndex: "name", key: "name", }, { title: "دسته‌بندی", dataIndex: ["category", "name"], key: "category", render: (text) => ( text ? {text} : --- ), }, { title: "سازنده", dataIndex: ["user", "username"], key: "creator", render: (text) => text || "---", }, { title: "وضعیت", dataIndex: "status", key: "status", render: (status) => { const color = status === "confirmed" ? "green" : status === "rejected" ? "red" : "gold"; return {status}; } }, { title: "تاریخ", dataIndex: "created_at", key: "created_at", render: (date) => new Date(date).toLocaleDateString("fa-IR"), }, { title: "عملیات", key: "action", width: 120, render: (_, record) => (