summaryrefslogtreecommitdiff
path: root/client/src/components/Dashboard.tsx
blob: 20758fc03b46809737ec10e996d6406a041b6188 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React, { useMemo } from 'react';
import { useOutletContext } from 'react-router-dom';
import {
  MaterialReactTable,
  useMaterialReactTable,
  type MRT_ColumnDef,
} from 'material-react-table';
import type { Guest } from '../slices/api/adminSlice';

function Dashboard() {
  const guests: Guest[] = useOutletContext();
  const columns = useMemo<MRT_ColumnDef<Guest>[]>(
    () => [
      {
        accessorKey: 'firstName',
        header: 'First Name',
        size: 150,
      },
      {
        accessorKey: 'lastName',
        header: 'Last Name',
        size: 150,
      },
      {
        accessorKey: 'attendance',
        header: 'Attendance',
        size: 50,
      },
      {
        accessorKey: 'email',
        header: 'Email',
        size: 150,
      },
      {
        accessorKey: 'message',
        header: 'Message',
        size: 200,
      },
      {
        accessorKey: 'partySize',
        header: 'Party Size',
        size: 50,
      },
      // {
      //   accessorKey: 'partyList',
      //   header: 'Party List',
      //   size: 150,
      // },
    ],
    []
  );
  const table = useMaterialReactTable({
    columns,
    data: guests,
  });

  return <MaterialReactTable table={table} />;
}

export default Dashboard;