From adc1c620c1a3ad0cfd0b48468cec4f33c3d16b19 Mon Sep 17 00:00:00 2001 From: FeimeiChen <54688836+FeimeiChen@users.noreply.github.com> Date: Tue, 6 Aug 2024 17:43:17 -1000 Subject: [PATCH] Create GroupingsTable.tsx component --- ui/package.json | 7 + ui/src/app/groupings/page.tsx | 28 ++- .../components/layout/navbar/navbar-menu.tsx | 18 +- ui/src/components/table/GroupingsTable.tsx | 132 +++++++++++ .../table/table-element/ColumnSettings.tsx | 78 ++++++ .../table/table-element/GlobalFilter.tsx | 18 ++ .../table/table-element/GroupingPathCell.tsx | 53 +++++ .../table-element/GroupingsTableHeaders.tsx | 20 ++ .../table/table-element/Pagination.tsx | 108 +++++++++ .../table/table-element/SortArrow.tsx | 18 ++ ui/src/components/ui/button.tsx | 10 +- ui/src/components/ui/dropdown-menu.tsx | 222 ++++++++++++++++++ ui/src/components/ui/pagination.tsx | 117 +++++++++ ui/src/components/ui/switch.tsx | 36 +++ ui/src/components/ui/table.tsx | 119 ++++++++++ ui/src/components/ui/tooltip.tsx | 35 +++ ui/tailwind.config.ts | 8 +- .../(home)/_components/login-button.test.tsx | 15 +- .../_components/feedback-form.test.tsx | 31 ++- ui/tests/app/groupings/page.test.tsx | 54 ++++- .../components/table/GroupingsTable.test.tsx | 194 +++++++++++++++ .../table-element/ColumnSettings.test.tsx | 119 ++++++++++ .../table/table-element/GlobalFilter.test.tsx | 20 ++ .../table-element/GroupingPathCell.test.tsx | 61 +++++ .../table/table-element/Pagination.test.tsx | 128 ++++++++++ .../table/table-element/SortArrow.test.tsx | 26 ++ 26 files changed, 1633 insertions(+), 42 deletions(-) create mode 100644 ui/src/components/table/GroupingsTable.tsx create mode 100644 ui/src/components/table/table-element/ColumnSettings.tsx create mode 100644 ui/src/components/table/table-element/GlobalFilter.tsx create mode 100644 ui/src/components/table/table-element/GroupingPathCell.tsx create mode 100644 ui/src/components/table/table-element/GroupingsTableHeaders.tsx create mode 100644 ui/src/components/table/table-element/Pagination.tsx create mode 100644 ui/src/components/table/table-element/SortArrow.tsx create mode 100644 ui/src/components/ui/dropdown-menu.tsx create mode 100644 ui/src/components/ui/pagination.tsx create mode 100644 ui/src/components/ui/switch.tsx create mode 100644 ui/src/components/ui/table.tsx create mode 100644 ui/src/components/ui/tooltip.tsx create mode 100644 ui/tests/components/table/GroupingsTable.test.tsx create mode 100644 ui/tests/components/table/table-element/ColumnSettings.test.tsx create mode 100644 ui/tests/components/table/table-element/GlobalFilter.test.tsx create mode 100644 ui/tests/components/table/table-element/GroupingPathCell.test.tsx create mode 100644 ui/tests/components/table/table-element/Pagination.test.tsx create mode 100644 ui/tests/components/table/table-element/SortArrow.test.tsx diff --git a/ui/package.json b/ui/package.json index 9c2f6650..78121f4c 100644 --- a/ui/package.json +++ b/ui/package.json @@ -13,13 +13,20 @@ "test:watch": "jest --watch" }, "dependencies": { + "@fortawesome/free-solid-svg-icons": "^6.6.0", + "@fortawesome/react-fontawesome": "^0.2.2", "@hookform/resolvers": "^3.3.4", "@radix-ui/react-alert-dialog": "^1.0.5", "@radix-ui/react-dialog": "^1.0.5", + "@radix-ui/react-dropdown-menu": "^2.1.1", + "@radix-ui/react-icons": "^1.3.0", "@radix-ui/react-label": "^2.0.2", "@radix-ui/react-select": "^1.0.2", "@radix-ui/react-slot": "^1.0.2", + "@radix-ui/react-switch": "^1.1.0", "@radix-ui/react-tabs": "^1.0.4", + "@radix-ui/react-tooltip": "^1.1.2", + "@tanstack/react-table": "^8.20.1", "camaro": "^6.2.2", "class-variance-authority": "^0.7.0", "clsx": "^2.1.0", diff --git a/ui/src/app/groupings/page.tsx b/ui/src/app/groupings/page.tsx index 6d6dba73..8192f488 100644 --- a/ui/src/app/groupings/page.tsx +++ b/ui/src/app/groupings/page.tsx @@ -1,9 +1,27 @@ -const Groupings = () => { +import GroupingsTable from '@/components/table/GroupingsTable'; +import {ownerGroupings} from '@/actions/groupings-api'; + +const Groupings = async () => { + const res = await ownerGroupings(); + const groupingPaths = res.groupingPaths; return ( -
-
{/* GroupingsTable goes here */}
-
+
+
+
+

Manage My Groupings

+

+ View and manage groupings I own. Manage members, + configure grouping options and sync destinations. +

+
+
+
+ +
+
+
+
); -}; +} export default Groupings; diff --git a/ui/src/components/layout/navbar/navbar-menu.tsx b/ui/src/components/layout/navbar/navbar-menu.tsx index 8066d4b7..f8b8067b 100644 --- a/ui/src/components/layout/navbar/navbar-menu.tsx +++ b/ui/src/components/layout/navbar/navbar-menu.tsx @@ -1,12 +1,13 @@ 'use client'; -import { Sheet, SheetContent, SheetTrigger } from '@/components/ui/sheet'; +import { Sheet, SheetContent, SheetTitle, SheetTrigger } from '@/components/ui/sheet'; import User from '@/access/user'; import Link from 'next/link'; import { NavbarLinks } from './navbar-links'; -import { useState } from 'react'; +import React, { useState } from 'react'; import Role from '@/access/role'; import NavbarMenuIcon from './navbar-menu-icon'; +import {VisuallyHidden} from "@radix-ui/react-visually-hidden"; const NavbarMenu = ({ currentUser }: { currentUser: User }) => { const [open, setOpen] = useState(false); @@ -20,13 +21,20 @@ const NavbarMenu = ({ currentUser }: { currentUser: User }) => {