import { SearchOutlined } from "@ant-design/icons"; import { Button, Input, Select } from "@imphnen-frontend-service/ui/atoms"; import { BackofficeWrapper, DataTable } from "@imphnen-frontend-service/ui/organisms"; import { cn } from "@imphnen-frontend-service/utils"; import { ColumnDef, getCoreRowModel, getPaginationRowModel, PaginationState, RowSelectionState, useReactTable } from "@tanstack/react-table"; import { ReactElement, useState } from "react"; import { ModalDetailSession } from "./_components/modal/detail"; type SessionStatus = 'ongoing' | 'finished'; interface SessionType { id: string mentorName: string menteeName: string datetime: number status: SessionStatus } const mockData: SessionType[] = Array.from({ length: 90 }, (_, i) => ({ id: `DS-${i + 1}`, mentorName: 'Ahmad Wijuana', menteeName: 'Sofia Wijuana', datetime: new Date().getTime(), status: i % 2 === 0 ? 'ongoing' : 'finished', })) export default function Components(): ReactElement { const [openDetail, setOpenDetail] = useState(false); const [rowSelection, setRowSelection] = useState({}) const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 9, }); const columns: ColumnDef[] = [ { id: 'select', meta: { cellClassName: cn("w-20") }, header: ({ table }) => ( ), cell: ({ row }) => ( ), }, { id: 'id', header: 'ID Sesi', accessorKey: 'id', }, { id: 'mentorName', header: 'Nama Mentor', accessorKey: 'name', }, { id: 'menteeName', header: 'Nama Mentee', accessorKey: 'name', }, { id: 'datetime', header: 'Waktu', accessorKey: 'datetime', }, { id: 'status', header: 'Status', accessorKey: 'status', cell: ({ row }) => { const status = row.original.status; const statusColors: Record = { ongoing: 'bg-warning-200 text-warning-700', finished: 'bg-success-200 text-success-500', }; const statusText: Record = { ongoing: 'On Going', finished: 'Finished', }; return (
{statusText[status]}
); }, }, { header: 'Action', meta: { cellClassName: cn("w-52") }, cell: ({ row }) => ( ), }, ] const table = useReactTable({ data: mockData, columns, state: { pagination, rowSelection, }, enableRowSelection: true, onRowSelectionChange: setRowSelection, getCoreRowModel: getCoreRowModel(), getPaginationRowModel: getPaginationRowModel(), onPaginationChange: setPagination, pageCount: Math.ceil(mockData.length / pagination.pageSize), manualPagination: false, }); return (

Session Management

) }