diff --git a/src/app/private/[uid]/chapter-leader/layout.tsx b/src/app/private/[uid]/chapter-leader/layout.tsx
index dedb653d..a1eb7045 100644
--- a/src/app/private/[uid]/chapter-leader/layout.tsx
+++ b/src/app/private/[uid]/chapter-leader/layout.tsx
@@ -35,11 +35,6 @@ const UserLayout = ({ children }: IUserLayout) => {
link: `/private/${user.id}/chapter-leader/seniors`,
icon: faUserGroup,
},
- {
- name: "Pending",
- link: `/private/${user.id}/chapter-leader/pending`,
- icon: faUserPlus,
- },
{
name: "Profile",
link: `/private/${user.id}/chapter-leader/edit-profile`,
diff --git a/src/app/private/[uid]/chapter-leader/pending/PendingHomePage.tsx b/src/app/private/[uid]/chapter-leader/pending/PendingHomePage.tsx
deleted file mode 100644
index 27167fcc..00000000
--- a/src/app/private/[uid]/chapter-leader/pending/PendingHomePage.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-"use client";
-
-import PendingCard from "@components/PendingCard";
-import { CardGrid } from "@components/container";
-import { User } from "@prisma/client";
-
-type MembersHomePageProps = {
- users: User[];
-};
-
-const PendingHomePage = ({ users }: MembersHomePageProps) => {
- return (
- <>
-
- {`Pending (${users.length})`}
-
- {users.length > 0 ? (
- {
- return (
-
- );
- })}
- />
- ) : (
-
- {"This chapter has no pending members."}
-
- )}
- >
- );
-};
-
-export default PendingHomePage;
diff --git a/src/app/private/[uid]/chapter-leader/pending/layout.tsx b/src/app/private/[uid]/chapter-leader/pending/layout.tsx
deleted file mode 100644
index b52667ac..00000000
--- a/src/app/private/[uid]/chapter-leader/pending/layout.tsx
+++ /dev/null
@@ -1,20 +0,0 @@
-import { HeaderContainer } from "@components/container";
-import { faUserGroup } from "@fortawesome/free-solid-svg-icons";
-
-interface LayoutProps {
- children?: React.ReactNode;
-}
-
-const Layout = (props: LayoutProps) => {
- return (
-
- {props.children}
-
- );
-};
-
-export default Layout;
diff --git a/src/app/private/[uid]/chapter-leader/pending/page.tsx b/src/app/private/[uid]/chapter-leader/pending/page.tsx
deleted file mode 100644
index 42a97be7..00000000
--- a/src/app/private/[uid]/chapter-leader/pending/page.tsx
+++ /dev/null
@@ -1,35 +0,0 @@
-import React from "react";
-import { prisma } from "@server/db/client";
-import PendingHomePage from "./PendingHomePage";
-import { User } from "@prisma/client";
-
-const PendingPage = async ({ params }: { params: { uid: string } }) => {
- const user = await prisma.user.findFirstOrThrow({
- where: {
- id: params.uid,
- },
- });
-
- const userRequests = await prisma.userRequest.findMany({
- where: {
- chapterId: user.ChapterID ?? "",
- approved: "PENDING",
- },
- });
-
- const users: User[] = [];
-
- for (let i = 0; i < userRequests.length; i++) {
- const user = await prisma.user.findFirstOrThrow({
- where: {
- id: userRequests[i]?.uid ?? "",
- },
- });
-
- users.push(user);
- }
-
- return ;
-};
-
-export default PendingPage;
diff --git a/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx b/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx
index 03d633ae..60e3f651 100644
--- a/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx
+++ b/src/app/private/[uid]/chapter-leader/users/MembersHomePage.tsx
@@ -11,6 +11,7 @@ import { faArrowUpFromBracket } from "@fortawesome/free-solid-svg-icons";
import { Dropdown } from "@components/selector";
import { Popup } from "@components/container";
import { useRouter } from "next/navigation";
+import { sortedStudents } from "@utils";
type MembersHomePageProps = {
members: User[];
@@ -96,7 +97,7 @@ const MembersHomePage = ({ members }: MembersHomePageProps) => {
)}
This chapter has no members.
diff --git a/src/components/DisplayChapterInfo.tsx b/src/components/DisplayChapterInfo.tsx
index d1b3127c..34f48150 100644
--- a/src/components/DisplayChapterInfo.tsx
+++ b/src/components/DisplayChapterInfo.tsx
@@ -9,6 +9,7 @@ import { UserContext } from "@context/UserProvider";
import PendingCard from "@components/PendingCard";
import { fullName } from "@utils";
import { RoleToUrlSegment } from "@constants/RoleAlias";
+import { sortedStudents } from "@utils";
type ChapterWithUser = Prisma.ChapterGetPayload<{
include: { students: true };
@@ -91,12 +92,14 @@ const DisplayChapterInfo = ({
: "Executive Board"}
}
- tiles={students.map((student) => {
+ tiles={sortedStudents(students).map((student) => {
const link =
user.role === "USER"
? ""
: `/private/${user.id}/${RoleToUrlSegment[user.role]}` +
- `${user.role === "ADMIN" && `/home/chapters/${chapter.id}`}` +
+ `${
+ user.role === "ADMIN" ? `/home/chapters/${chapter.id}` : ""
+ }` +
`/users/${student.id}`;
return ;
})}
diff --git a/src/components/TileGrid/SeniorTile.tsx b/src/components/TileGrid/SeniorTile.tsx
index 0fd0d445..08347e03 100644
--- a/src/components/TileGrid/SeniorTile.tsx
+++ b/src/components/TileGrid/SeniorTile.tsx
@@ -59,12 +59,6 @@ export function SeniorTile({
},
];
- console.log(
- `${senior.firstname} ${senior.lastname}` +
- "'s Students: " +
- senior.StudentIDs.toString()
- );
-
return (
diff --git a/src/components/TileGrid/UserTile.tsx b/src/components/TileGrid/UserTile.tsx
index cc8a0b3d..f028fc10 100644
--- a/src/components/TileGrid/UserTile.tsx
+++ b/src/components/TileGrid/UserTile.tsx
@@ -21,8 +21,12 @@ export function UserTile({
dropdownComponent,
}: UserTileProps) {
return (
-
-
+
+
-
+
-
+
{student
? fullName(student)
: senior
? seniorFullName(senior)
: null}
+ {student ? (
+
+ {student.role === "CHAPTER_LEADER"
+ ? "Chapter Leader"
+ : student.position === ""
+ ? "Member"
+ : student.position}
+
+ ) : null}
{/* @TODO: Add pronouns once we add to student field */}
-
- {senior && senior.location}
-
+ {senior ? (
+
+ {senior.location}
+
+ ) : null}
{dropdownComponent}
diff --git a/src/utils/index.tsx b/src/utils/index.tsx
index b0d3ed87..150c3344 100644
--- a/src/utils/index.tsx
+++ b/src/utils/index.tsx
@@ -3,6 +3,10 @@ import { Session } from "next-auth";
import { Resource, Senior, User } from "@prisma/client";
import moment from "moment";
+type PositionOrder = {
+ [position: string]: number;
+};
+
export const formatUserHomeRoute = (user: NonNullable
) => {
return `/private/${user.id}/${RoleToUrlSegment[user.role]}/home`;
};
@@ -41,3 +45,30 @@ export const fullName = (user: User) => `${user.firstName} ${user.lastName}`;
export const seniorFullName = (senior: Senior) =>
`${senior.firstname} ${senior.lastname}`;
+
+export const sortedStudents = (students: User[]) => {
+ const positionOrder: PositionOrder = {
+ "Social Coordinator": 0,
+ "Senior Outreach Coordinator": 1,
+ "Head of Media": 2,
+ Secretary: 3,
+ Treasurer: 4,
+ "Match Coordinator": 5,
+ };
+
+ const comparePositions = (a: User, b: User) => {
+ if (a.role === "CHAPTER_LEADER" && b.role !== "CHAPTER_LEADER") {
+ return -1;
+ }
+ if (b.role === "CHAPTER_LEADER" && a.role !== "CHAPTER_LEADER") {
+ return 1;
+ }
+
+ const orderA = positionOrder[a.position] || Infinity;
+ const orderB = positionOrder[b.position] || Infinity;
+
+ return orderA - orderB;
+ };
+
+ return students.sort(comparePositions);
+};