diff --git a/src/app/private/[uid]/user/seniors/layout.tsx b/src/app/private/user/seniors/layout.tsx
similarity index 100%
rename from src/app/private/[uid]/user/seniors/layout.tsx
rename to src/app/private/user/seniors/layout.tsx
diff --git a/src/app/private/[uid]/user/seniors/page.tsx b/src/app/private/user/seniors/page.tsx
similarity index 64%
rename from src/app/private/[uid]/user/seniors/page.tsx
rename to src/app/private/user/seniors/page.tsx
index e4c86a0c..a5d4f788 100644
--- a/src/app/private/[uid]/user/seniors/page.tsx
+++ b/src/app/private/user/seniors/page.tsx
@@ -1,11 +1,13 @@
import React from "react";
import { prisma } from "@server/db/client";
import SeniorsHomePage from "./SeniorsHomePage";
+import { getServerSessionOrRedirect } from "@server/utils";
-const UserSeniorsPage = async ({ params }: { params: { uid: string } }) => {
+const UserSeniorsPage = async () => {
+ const session = await getServerSessionOrRedirect();
const user = await prisma.user.findFirstOrThrow({
where: {
- id: params.uid,
+ id: session.user?.id,
},
include: {
Seniors: true,
diff --git a/src/components/AdminHomePage.tsx b/src/components/AdminHomePage.tsx
index b3b58f22..a82d14df 100644
--- a/src/components/AdminHomePage.tsx
+++ b/src/components/AdminHomePage.tsx
@@ -46,7 +46,7 @@ const AdminHomePage = ({ chapters }: AdminHomePageProps) => {
)}
(
-
- ))}
+ tiles={sortedStudents(students).map((student) => {
+ let link = `/private/${RoleToUrlSegment[user.role]}`;
+ if (user.role === "ADMIN") {
+ link += `/home/chapters/${student.ChapterID}`;
+ }
+ link += `/users/${student.id}`;
+ return (
+
+ );
+ })}
/>
diff --git a/src/components/SeniorView.tsx b/src/components/SeniorView.tsx
index cd2f8036..0ea28220 100644
--- a/src/components/SeniorView.tsx
+++ b/src/components/SeniorView.tsx
@@ -4,8 +4,7 @@ import { Senior, User } from "@prisma/client";
import SearchableContainer from "./SearchableContainer";
import { UserTile, TileEdit } from "./TileGrid";
import AddSenior from "./AddSenior";
-import { useContext, useState } from "react";
-import { UserContext } from "@context/UserProvider";
+import { useState } from "react";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import { faPencil, faTrashCan } from "@fortawesome/free-solid-svg-icons";
@@ -15,7 +14,6 @@ type SeniorViewProps = {
};
export const SeniorView = ({ seniors, students }: SeniorViewProps) => {
- const context = useContext(UserContext);
const [seniorsState, setSeniorsState] = useState(seniors);
const [showAddSeniorPopUp, setShowAddSeniorPopUp] = useState(false);
const [seniorPatch, setSeniorPatch] = useState("");
@@ -68,7 +66,7 @@ export const SeniorView = ({ seniors, students }: SeniorViewProps) => {
// TODO(nickbar01234) - Fix link