From e10353ede47a59d3c503af7e1e342ee51bf6deb8 Mon Sep 17 00:00:00 2001 From: wkim10 Date: Sun, 10 Mar 2024 13:48:27 -0400 Subject: [PATCH] address PR comments :) Co-authored-by: Tyler --- .../[uid]/chapter-leader/pending/page.tsx | 1 + .../chapter-leader/users/MembersHomePage.tsx | 52 +++++++----------- .../[uid]/user/seniors/SeniorsHomePage.tsx | 55 ++++++++----------- src/components/admin/DisplayChapter.tsx | 1 - 4 files changed, 45 insertions(+), 64 deletions(-) diff --git a/src/app/private/[uid]/chapter-leader/pending/page.tsx b/src/app/private/[uid]/chapter-leader/pending/page.tsx index 92db5f09..42a97be7 100644 --- a/src/app/private/[uid]/chapter-leader/pending/page.tsx +++ b/src/app/private/[uid]/chapter-leader/pending/page.tsx @@ -13,6 +13,7 @@ const PendingPage = async ({ params }: { params: { uid: string } }) => { const userRequests = await prisma.userRequest.findMany({ where: { chapterId: user.ChapterID ?? "", + approved: "PENDING", }, }); diff --git a/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx b/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx index f5a68a70..8c3d7a8e 100644 --- a/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx +++ b/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx @@ -1,9 +1,7 @@ "use client"; -import { useState } from "react"; import { UserTile } from "@components/TileGrid"; -import { CardGrid } from "@components/container"; -import SearchBar from "@components/SearchBar"; +import SearchableContainer from "@components/SearchableContainer"; import { User } from "@prisma/client"; type MembersHomePageProps = { @@ -12,39 +10,31 @@ type MembersHomePageProps = { }; const MembersHomePage = ({ members, user }: MembersHomePageProps) => { - const [filter, setFilter] = useState(""); + const displayMembers = (elem: User, index: number) => ( + + ); return ( <> -

+

{`Members (${members.length})`}

-
- -
- {members.length > 0 ? ( - - (member.firstName + " " + member.lastName) - .toLowerCase() - .includes(filter.toLowerCase()) - ) - .map((member, index) => { - return ( - - ); - })} - /> - ) : ( -

- {"This chapter has no members."} -

- )} + This chapter has no members. + } + search={(member: User, filter: string) => + (member.firstName + " " + member.lastName) + .toLowerCase() + .includes(filter.toLowerCase()) + } + /> ); }; diff --git a/src/app/private/[uid]/user/seniors/SeniorsHomePage.tsx b/src/app/private/[uid]/user/seniors/SeniorsHomePage.tsx index 2448f666..38a83d91 100644 --- a/src/app/private/[uid]/user/seniors/SeniorsHomePage.tsx +++ b/src/app/private/[uid]/user/seniors/SeniorsHomePage.tsx @@ -1,13 +1,8 @@ "use client"; -import { useState } from "react"; import { UserTile } from "@components/TileGrid"; -import { CardGrid } from "@components/container"; -import { TileEdit } from "@components/TileGrid/TileEdit"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { faEllipsis, faTrashCan } from "@fortawesome/free-solid-svg-icons"; -import SearchBar from "@components/SearchBar"; import { Senior, User } from "@prisma/client"; +import SearchableContainer from "@components/SearchableContainer"; type SeniorsHomePageProps = { seniors: Senior[]; @@ -15,37 +10,33 @@ type SeniorsHomePageProps = { }; const SeniorsHomePage = ({ seniors, user }: SeniorsHomePageProps) => { - const [filter, setFilter] = useState(""); + const displaySeniors = (elem: Senior, index: number) => ( + + ); return ( <> -

+

{`My Assigned Seniors (${seniors.length})`}

-
- -
- {seniors.length > 0 ? ( - - senior.name.toLowerCase().includes(filter.toLowerCase()) - ) - .map((senior, index) => { - return ( - - ); - })} - /> - ) : ( -

- {"You haven't been assigned a Senior yet."} -

- )} + + {"You haven't been assigned a Senior yet."} + + } + search={(senior: Senior, filter: string) => + (senior.firstName + " " + senior.lastName) + .toLowerCase() + .includes(filter.toLowerCase()) + } + /> ); }; diff --git a/src/components/admin/DisplayChapter.tsx b/src/components/admin/DisplayChapter.tsx index d8b91205..02eb66ec 100644 --- a/src/components/admin/DisplayChapter.tsx +++ b/src/components/admin/DisplayChapter.tsx @@ -1,4 +1,3 @@ -/* eslint-disable react/jsx-no-duplicate-props */ "use client"; import { editRole } from "@api/user/[uid]/edit-role/route.client";