Skip to content

Commit

Permalink
address PR comments :)
Browse files Browse the repository at this point in the history
Co-authored-by: Tyler <[email protected]>
  • Loading branch information
wkim10 and tylerrlin committed Mar 10, 2024
1 parent 52d043e commit e10353e
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 64 deletions.
1 change: 1 addition & 0 deletions src/app/private/[uid]/chapter-leader/pending/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ const PendingPage = async ({ params }: { params: { uid: string } }) => {
const userRequests = await prisma.userRequest.findMany({
where: {
chapterId: user.ChapterID ?? "",
approved: "PENDING",
},
});

Expand Down
52 changes: 21 additions & 31 deletions src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx
Original file line number Diff line number Diff line change
@@ -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 = {
Expand All @@ -12,39 +10,31 @@ type MembersHomePageProps = {
};

const MembersHomePage = ({ members, user }: MembersHomePageProps) => {
const [filter, setFilter] = useState("");
const displayMembers = (elem: User, index: number) => (
<UserTile
key={index}
student={elem}
link={`/private/${user.id}/chapter-leader/users/${elem.id}`}
/>
);

return (
<>
<h1 className="font-merriweather text-3xl">
<h1 className="font-merriweather pb-6 text-3xl">
{`Members (${members.length})`}
</h1>
<div className="mb-6 mt-6 flex w-full gap-2.5">
<SearchBar setFilter={setFilter} />
</div>
{members.length > 0 ? (
<CardGrid
tiles={members
.filter((member) =>
(member.firstName + " " + member.lastName)
.toLowerCase()
.includes(filter.toLowerCase())
)
.map((member, index) => {
return (
<UserTile
key={index}
student={member}
link={`/private/${user.id}/chapter-leader/users/${member.id}`}
/>
);
})}
/>
) : (
<h1 className="text-2xl font-light">
{"This chapter has no members."}
</h1>
)}
<SearchableContainer
display={displayMembers}
elements={members}
emptyNode={
<h1 className="text-2xl font-light">This chapter has no members.</h1>
}
search={(member: User, filter: string) =>
(member.firstName + " " + member.lastName)
.toLowerCase()
.includes(filter.toLowerCase())
}
/>
</>
);
};
Expand Down
55 changes: 23 additions & 32 deletions src/app/private/[uid]/user/seniors/SeniorsHomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,51 +1,42 @@
"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[];
user: User;
};

const SeniorsHomePage = ({ seniors, user }: SeniorsHomePageProps) => {
const [filter, setFilter] = useState("");
const displaySeniors = (elem: Senior, index: number) => (
<UserTile
key={index}
senior={elem}
link={`/private/${user.id}/user/seniors/${elem.id}`}
/>
);

return (
<>
<h1 className="font-merriweather text-3xl">
<h1 className="font-merriweather pb-6 text-3xl">
{`My Assigned Seniors (${seniors.length})`}
</h1>
<div className="mb-6 mt-6 flex w-full gap-2.5">
<SearchBar setFilter={setFilter} />
</div>
{seniors.length > 0 ? (
<CardGrid
tiles={seniors
.filter((senior) =>
senior.name.toLowerCase().includes(filter.toLowerCase())
)
.map((senior, index) => {
return (
<UserTile
key={index}
senior={senior}
link={`/private/${user.id}/user/seniors/${senior.id}`}
/>
);
})}
/>
) : (
<h1 className="text-2xl font-light">
{"You haven't been assigned a Senior yet."}
</h1>
)}
<SearchableContainer
display={displaySeniors}
elements={seniors}
emptyNode={
<h1 className="text-2xl font-light">
{"You haven't been assigned a Senior yet."}
</h1>
}
search={(senior: Senior, filter: string) =>
(senior.firstName + " " + senior.lastName)
.toLowerCase()
.includes(filter.toLowerCase())
}
/>
</>
);
};
Expand Down
1 change: 0 additions & 1 deletion src/components/admin/DisplayChapter.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* eslint-disable react/jsx-no-duplicate-props */
"use client";

import { editRole } from "@api/user/[uid]/edit-role/route.client";
Expand Down

0 comments on commit e10353e

Please sign in to comment.