From 7dfe69659be8dcf93b33c2a1f2be919a182d6acd Mon Sep 17 00:00:00 2001 From: euxzy Date: Mon, 18 Aug 2025 16:20:31 +0700 Subject: [PATCH] feat(backoffice): slicing backoffice dimentorin - session management --- .../(protected)/session-dimentorin/page.tsx | 162 ++++++++++++++++++ .../backoffice-sidebar/backoffice-sidebar.tsx | 1 + 2 files changed, 163 insertions(+) create mode 100644 apps/backoffice/src/app/(protected)/session-dimentorin/page.tsx diff --git a/apps/backoffice/src/app/(protected)/session-dimentorin/page.tsx b/apps/backoffice/src/app/(protected)/session-dimentorin/page.tsx new file mode 100644 index 0000000..abc4943 --- /dev/null +++ b/apps/backoffice/src/app/(protected)/session-dimentorin/page.tsx @@ -0,0 +1,162 @@ +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"; + +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 [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

+ +
+
+
+ +
+ +
+
+ + +
+ + +
+
+ ) +} diff --git a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx index 2516114..c7cec92 100644 --- a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx +++ b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx @@ -23,6 +23,7 @@ const MENUS = [ { label: 'Validasi Transaksi', href: '/transactions', icon: }, { label: 'Data Pengiriman Hadiah', href: '/prizes', icon: }, { label: 'User - Dimentorin', href: '/users-dimentorin', icon: }, + { label: 'Session - Dimentorin', href: '/session-dimentorin', icon: }, ] export const BackofficeSidebar: FC = (): ReactElement => {