diff --git a/client/src/components/main/MemberProfile.tsx b/client/src/components/main/MemberProfile.tsx index 13e9e434..859d4b6b 100644 --- a/client/src/components/main/MemberProfile.tsx +++ b/client/src/components/main/MemberProfile.tsx @@ -20,6 +20,7 @@ export type MemberProfileData = { link: string; socialMediaUserName: string; }[]; + pk: number; }; type MemberProfileProps = { diff --git a/client/src/hooks/useCommittee.ts b/client/src/hooks/useCommittee.ts index 69c6fb8a..5759947d 100644 --- a/client/src/hooks/useCommittee.ts +++ b/client/src/hooks/useCommittee.ts @@ -8,6 +8,11 @@ export type ApiMember = { profile_picture: string; pronouns: string; about: string; + social_media?: { + link: string; + socialMediaUserName: string; + }[]; + pk: number; }; export function useCommittee() { diff --git a/client/src/hooks/useMember.ts b/client/src/hooks/useMember.ts index c564657e..0d1f0581 100644 --- a/client/src/hooks/useMember.ts +++ b/client/src/hooks/useMember.ts @@ -11,6 +11,7 @@ type ApiMember = { link: string; socialMediaUserName: string; }[]; + pk: number; }; // return api member, import id number from router, is not enabled if not a number type diff --git a/client/src/pages/about.tsx b/client/src/pages/about.tsx index c64544aa..fee93f7e 100644 --- a/client/src/pages/about.tsx +++ b/client/src/pages/about.tsx @@ -1,13 +1,13 @@ import Image from "next/image"; +import Link from "next/link"; import { ApiMember, useCommittee } from "@/hooks/useCommittee"; export default function AboutPage() { const { data: committee, isPending, error, isError } = useCommittee(); - const topRow: ApiMember[] = []; - const bottomRow: ApiMember[] = []; - //lists that will be populated with member objects in the committee + const committeeList: ApiMember[] = []; + //List that will be populated with member objects in the committee const roleOrder = [ "President", "Vice President", @@ -44,9 +44,7 @@ export default function AboutPage() { /landing_placeholder.png @@ -61,23 +59,61 @@ export default function AboutPage() { ); + function committeeImage(profilePic: string) { + return ( +
+ /landing_placeholder.png +
+ ); + } + + function committeePortrait(committeeMember: ApiMember, id: number) { + return ( + <> +
+ {committeeMember.pk === 0 ? ( + committeeImage(committeeMember.profile_picture) + ) : ( + + {committeeImage(committeeMember.profile_picture)} + + )} +
+
+

+ + {committeeMember.pk === 0 ? ( + <>{committeeMember.name} + ) : ( + + {committeeMember.name} + + )} + + {committeeMember.pronouns} +

+

+ {roleOrder[id]} +

+
+ + ); + } + if (isPending) { for (let i = 0; i < 8; i++) { - if (i < 4) { - topRow.push({ - name: "Loading...", - pronouns: "", - profile_picture: "/landing_placeholder.png", - about: "", - }); - } else { - bottomRow.push({ - name: "Loading...", - pronouns: "", - profile_picture: "/landing_placeholder.png", - about: "", - }); - } + committeeList.push({ + name: "Loading...", + pronouns: "", + profile_picture: "/landing_placeholder.png", + about: "", + pk: 0, + }); } } else if (isError) { const errorMessage = @@ -97,11 +133,7 @@ export default function AboutPage() { ); } else { for (let i = 0; i < 8; i++) { - if (i < 4) { - topRow.push(committee[i]); - } else { - bottomRow.push(committee[i]); - } + committeeList.push(committee[i]); } } @@ -109,68 +141,15 @@ export default function AboutPage() {
{about} {/* Portraits Section - DARK - Full Width */} -
+
- {/* Top row - 4 Presidents */}
- {topRow.map((member, idx) => ( + {committeeList.map((member, idx) => (
-
- /landing_placeholder.png -
-
-

- {member.name} {member.pronouns} -

-

- {roleOrder[idx]} -

-
-
- ))} -
- - {/* Bottom row - 4 other roles */} -
- {bottomRow.map((member, idx) => ( -
-
- /landing_placeholder.png -
-
-

- {member.name} {member.pronouns} -

-

- {roleOrder[4 + idx]} -

-
+ {committeePortrait(member, idx)}
))}
diff --git a/server/game_dev/serializers.py b/server/game_dev/serializers.py index 4d278157..386ea930 100644 --- a/server/game_dev/serializers.py +++ b/server/game_dev/serializers.py @@ -103,4 +103,5 @@ class Meta: "about", "pronouns", "social_media", + "pk" ] diff --git a/server/game_dev/views.py b/server/game_dev/views.py index 40ea5457..086119cf 100644 --- a/server/game_dev/views.py +++ b/server/game_dev/views.py @@ -85,7 +85,7 @@ def get_queryset(self): outputList = [] roleOrder = ("P", "VP", "SEC", "TRE", "MARK", "EVE", "PRO", "FRE") placeholderMember = {"name": "Position not filled", "profile_picture": "url('/landing_placeholder.png')", - "about": "", "pronouns": ""} + "about": "", "pronouns": "", "pk": 0} for i in roleOrder: try: cur = Committee.objects.get(role=i).id