import { DeleteOutlined, EditOutlined, PlusOutlined, 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 { useState } from "react"; import { ModalCreateRoadmap } from "./_components/modal/create-roadmap"; type LearningStatus = 'active' | 'inactive' type RoadmapType = { id: number name: string learningLevel: string status: LearningStatus } const mockData: RoadmapType[] = Array.from({ length: 90 }, (_, i) => ({ id: i + 1, name: i === 0 ? 'Ahmad Wijuana' : 'Anna Wiguana', learningLevel: ['Pemula', 'Menengah'][Math.floor(Math.random() * 2)], status: i % 2 === 0 ? 'active' : 'inactive', })) export default function Components(): React.ReactElement { const [openCreateModal, setOpenCreateModal] = 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: 'No', accessorKey: 'id', }, { id: 'name', header: 'Nama Roadmap', accessorKey: 'name', }, { id: 'learningLevel', header: 'Tingkat Belajar', accessorKey: 'learningLevel', }, { id: 'status', header: 'Status', accessorKey: 'status', cell: ({ row }) => { const status = row.original.status; const statusColors: Record = { inactive: 'bg-danger-200 text-danger-700', active: 'bg-success-200 text-success-500', }; const statusText: Record = { inactive: 'Inactive', active: 'Active', }; return (
{statusText[status]}
); }, }, { header: 'Action', meta: { cellClassName: cn("w-72") }, 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 (

Content & Roadmap

AI Roadmaps

setOpenCreateModal(false)} />
) }