diff --git a/apps/backoffice/src/app/(protected)/feedback-review-dimentorin/page.tsx b/apps/backoffice/src/app/(protected)/feedback-review-dimentorin/page.tsx new file mode 100644 index 0000000..6fc556a --- /dev/null +++ b/apps/backoffice/src/app/(protected)/feedback-review-dimentorin/page.tsx @@ -0,0 +1,181 @@ +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, For } from "@imphnen-frontend-service/utils"; +import { ColumnDef, getCoreRowModel, getPaginationRowModel, PaginationState, RowSelectionState, useReactTable } from "@tanstack/react-table"; +import { ReactElement, useState } from "react" + +const TABS = { + MENTORING: 'Mentoring', + PLATFORM: 'Platform' +} as const +type Tabs = typeof TABS[keyof typeof TABS] + +type FeedbackStatus = 'done' | 'todo'; + +interface FeedbackType { + id: number + name: string + email: string + rating: number + status: FeedbackStatus +} + +const mockData: FeedbackType[] = Array.from({ length: 90 }, (_, i) => ({ + id: i + 1, + name: i % 3 === 0 ? 'Ahmad Wijuana' : 'Sofia Wijuana', + email: 'fullname23@gmail.com', + rating: 4.5, + status: i % 2 === 0 ? 'done' : 'todo', +})) + +export default function Components(): ReactElement { + const [activeTab, setActiveTab] = useState(TABS.MENTORING) + + 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: 'name', + header: 'Name', + accessorKey: 'name', + }, + { + id: 'email', + header: 'Email', + accessorKey: 'email', + }, + { + id: 'rating', + header: 'Rating', + accessorKey: 'rating', + }, + { + id: 'status', + header: 'Status', + accessorKey: 'status', + cell: ({ row }) => { + const status = row.original.status; + const statusColors: Record = { + done: 'bg-success-200 text-success-500', + todo: 'bg-primary-200 text-primary-500', + }; + const statusText: Record = { + done: 'Done', + todo: 'To Do', + }; + 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 ( + +
+

Feedback

+
+ + {(tab) => ( + + )} + +
+
+ +
+
+
+ +
+ +
+
+ + +
+ + +
+
+ ); +} diff --git a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx index 9c44c9b..ff42883 100644 --- a/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx +++ b/libs/ui/src/organisms/backoffice-sidebar/backoffice-sidebar.tsx @@ -2,6 +2,7 @@ import { AppstoreOutlined, AuditOutlined, BookOutlined, + CommentOutlined, InboxOutlined, LogoutOutlined, ReloadOutlined, @@ -28,6 +29,7 @@ const MENUS = [ { label: 'User - Dimentorin', href: '/users-dimentorin', icon: }, { label: 'Session - Dimentorin', href: '/session-dimentorin', icon: }, { label: 'Content & Roadmap', href: '/roadmap-dimentorin', icon: }, + { label: 'Feedback & Review', href: '/feedback-review-dimentorin', icon: }, { label: 'Settings - Dimentorin', href: '/settings-dimentorin', icon: }, ]