Skip to content

Commit 2ffe7e7

Browse files
committed
Merge branch 'main' into HMT-103-check-in-time-confirmation-was-really-long-and-sometimes-buggy
2 parents 2b27b84 + f691329 commit 2ffe7e7

File tree

10 files changed

+78
-168
lines changed

10 files changed

+78
-168
lines changed

.github/workflows/bump-version.yaml

Lines changed: 0 additions & 116 deletions
This file was deleted.

amplify/data/resource.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,10 +295,6 @@ export const data = defineData({
295295
schema,
296296
authorizationModes: {
297297
defaultAuthorizationMode: "userPool",
298-
// API Key is used for a.allow.public() rules
299-
apiKeyAuthorizationMode: {
300-
expiresInDays: 30,
301-
},
302298
lambdaAuthorizationMode: {
303299
function: DemoAuthFunction,
304300
},

src/app/layout.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const Omnes = localFont({
1717
});
1818
export const metadata: Metadata = {
1919
title: "Hack the Change",
20-
description: "Hack the Change Participant Portal",
20+
description: "Hack the Change",
2121
icons: [
2222
{
2323
rel: "icon",
@@ -26,6 +26,41 @@ export const metadata: Metadata = {
2626
url: "/favicon.ico",
2727
},
2828
],
29+
keywords: [
30+
"hackathon",
31+
"portal",
32+
"participants",
33+
"innovation",
34+
"YYC",
35+
"Hack the Change",
36+
],
37+
authors: [
38+
{ name: "Code the Change YYC", url: "https://hackthechangeyyc.ca" },
39+
],
40+
openGraph: {
41+
title: "Hack the Change",
42+
description:
43+
"Join the Hack the Change hackathon and collaborate for impact.",
44+
url: "https://hackthechangeyyc.ca",
45+
siteName: "Hack the Change",
46+
images: [
47+
{
48+
url: "/public/images/landingpage/HeroSection/htc2024graphiclight2.png",
49+
width: 1200,
50+
height: 630,
51+
alt: "Hack the Change Banner",
52+
},
53+
],
54+
locale: "en_CA",
55+
type: "website",
56+
},
57+
twitter: {
58+
card: "summary_large_image",
59+
title: "Hack the Change",
60+
description: "Hack the Change Participant Portal",
61+
images: ["/public/images/landingpage/HeroSection/htc2024graphiclight2.png"],
62+
creator: "@hackthechangeyyc",
63+
},
2964
};
3065

3166
function RootLayout({ children }: { children: React.ReactNode }) {

src/components/Dashboard/UserBasedNav.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import Link from "next/link";
44
import { useState } from "react";
5-
import { useUser } from "@/components/contexts/UserContext";
5+
import { useUserDetails } from "@/components/contexts/UserDetailsContext";
66

77
interface NavItem {
88
name: string;
@@ -98,13 +98,13 @@ function GenericNav({ navItems }: { navItems: NavItem[] }) {
9898
}
9999

100100
export default function UserBasedNav() {
101-
const { currentUser } = useUser();
101+
const { userDetails } = useUserDetails();
102102

103-
if (!currentUser) {
103+
if (!userDetails) {
104104
return <div className="p-4 text-center">Loading...</div>;
105105
}
106106

107-
const role = currentUser?.role || "Participant";
107+
const role = userDetails?.role || "Participant";
108108
const navItems = navigationMap[role] || navigationMap.Participant;
109109

110110
return <GenericNav navItems={navItems} />;

src/components/LandingPage/AboutEventTile.tsx

Lines changed: 31 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,6 @@ import Image from "next/image";
22
import type { ReactNode } from "react";
33
import { fetchContent } from "@/app/actions";
44

5-
const EVENT_DETAILS_SECTION_STYLES =
6-
"flex w-full flex-col items-center bg-white";
7-
const EVENT_DETAILS_CONTENT_STYLES =
8-
"bg-pastel-pink border-4 border-dark-pink rounded-3xl mt-4 mb-8 xl:mt-8 xl:mb-12 flex flex-col xl:flex-row w-4/5 shadow-[15px_15px_0px_0px_dark-pink]";
9-
const EVENT_IMAGE_CONTAINER_STYLES =
10-
"bg-dark-grey border-b-4 border-dark-pink size-full xl:size-1/2 rounded-t-2xl xl:rounded-tr-none xl:rounded-l-2xl xl:border-b-0 xl:border-r-4 ";
11-
const EVENT_IMAGE_STYLES =
12-
"w-full h-full object-cover rounded-bl-none rounded-t-2xl xl:rounded-tr-none xl:rounded-l-2xl";
13-
const EVENT_DETAILS_CONTAINER_STYLES =
14-
"flex items-center w-full xl:w-1/2 rounded-b-20 md:rounded-bl-none md:rounded-r-2xl";
15-
const EVENT_DETAIL_STYLES = "flex items-center ml-10";
16-
const EVENT_DETAIL_TITLE_STYLES =
17-
"text-lg text-dark-grey font-extrabold leading-tight";
18-
const ICON_CONTAINER_STYLES = "bg-white rounded-xl p-1 m-4";
19-
205
const icons = {
216
date: "/svgs/aboutEventTile/date_icon.svg",
227
location: "/svgs/aboutEventTile/location_icon.svg",
@@ -30,15 +15,20 @@ interface EventDetailProps {
3015
children: ReactNode;
3116
}
3217

33-
const EventDetail = (props: EventDetailProps) => {
34-
const { iconSrc, iconName, children } = props;
35-
18+
const EventDetail = ({ iconSrc, iconName, children }: EventDetailProps) => {
3619
return (
37-
<div className={EVENT_DETAIL_STYLES}>
38-
<div className={ICON_CONTAINER_STYLES}>
39-
<Image src={iconSrc} alt={`${iconName} icon`} width={35} height={35} />
20+
<div className="ml-4 flex items-center md:ml-10">
21+
<div className="m-4 rounded-xl bg-white p-1">
22+
<Image
23+
src={iconSrc || "/placeholder.svg"}
24+
alt={`${iconName} icon`}
25+
width={35}
26+
height={35}
27+
/>
4028
</div>
41-
<h2 className={EVENT_DETAIL_TITLE_STYLES}>{children}</h2>
29+
<h2 className="text-lg font-extrabold leading-tight text-dark-grey">
30+
{children}
31+
</h2>
4232
</div>
4333
);
4434
};
@@ -54,22 +44,26 @@ export default async function AboutEventTile() {
5444
});
5545

5646
return (
57-
<div className={EVENT_DETAILS_SECTION_STYLES}>
58-
<div className={EVENT_DETAILS_CONTENT_STYLES}>
59-
<div className={EVENT_IMAGE_CONTAINER_STYLES}>
60-
<Image
61-
className={EVENT_IMAGE_STYLES}
62-
src={
63-
eventDetails.locationImage.fields.file?.url
64-
?.toString()
65-
.replace("//", "https://") ?? ""
66-
}
67-
alt={eventDetails.locationName}
68-
width={500}
69-
height={500}
70-
/>
47+
<div className="flex w-full flex-col items-center bg-white py-10 md:py-20">
48+
<div className="z-100 mb-8 mt-4 flex w-4/5 flex-col rounded-3xl border-4 border-dark-pink bg-pastel-pink shadow-[15px_15px_0px_0px_dark-pink] xl:mb-12 xl:mt-8">
49+
<div className="relative rounded-t-2xl border-b-4 border-dark-pink bg-dark-pink">
50+
<div className="flex h-1/2 w-full items-center justify-center overflow-hidden rounded-t-3xl ">
51+
<Image
52+
src={
53+
eventDetails.locationImage.fields.file?.url
54+
?.toString()
55+
.replace("//", "https://") ?? ""
56+
}
57+
alt={eventDetails.locationName}
58+
sizes="100vw"
59+
height={0}
60+
width={0}
61+
priority
62+
className="size-full object-contain"
63+
/>
64+
</div>
7165
</div>
72-
<div className={EVENT_DETAILS_CONTAINER_STYLES}>
66+
<div className="flex w-full items-center rounded-b-20 md:rounded-r-2xl md:rounded-bl-none">
7367
<div>
7468
<EventDetail iconSrc={icons.date} iconName="date">
7569
{formattedDate}

src/components/LandingPage/HeroSection.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ export default async function HeroSection() {
1111
const res = (await fetchContent("hackathonDetails"))[0];
1212
const hackathonDetails = res.fields;
1313
return (
14-
<div className="relative flex h-[85dvh] flex-col items-center justify-center md:px-8 md:py-16 lg:px-32">
14+
<div className="relative flex h-[100dvh] flex-col items-center justify-center md:px-8 md:py-16 lg:px-32">
1515
<Image
1616
src={HERO_SECTION_BACKGROUND}
1717
alt="Landing page background"

src/components/LandingPage/HeroSectionTile.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ const HeroSectionTile = ({
1111
const eventYear = eventDate.getFullYear();
1212

1313
return (
14-
<div className={"flex flex-col px-4 pt-10 md:items-center md:px-0 "}>
14+
<div className={"flex flex-col px-4 md:items-center md:px-0 md:pt-16 "}>
1515
<h1 className="text-shadow-title flex-wrap text-5xl font-black text-pastel-green drop-shadow-lg md:text-center md:text-6xl">
1616
<span className="text-white">{eventName} </span> {" " + eventYear}
1717
</h1>

src/components/UserProfile/ProfileHeader.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@ const RIGHT_SQUIGGLE_STYLES =
1818
export default function ProfileHeader() {
1919
const user = useUser().currentUser;
2020

21-
// console.log(user);
22-
2321
return (
2422
<div className={CONTAINER_STYLES}>
2523
<div className={PROFILE_CONTAINER}>

src/components/contexts/UserContext.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,11 @@ export function UserContextProvider({ children }: Props) {
6767
const userRole = (
6868
user.tokens?.idToken?.payload["cognito:groups"] as UserType[]
6969
).filter((group) => Object.keys(UserType).includes(group))?.[0];
70-
7170
if (!userRole) {
7271
// Logout User if not in group
7372
signOut();
74-
console.error("User not in group");
7573
}
74+
7675
if (!user.userSub) {
7776
throw new Error("No user");
7877
}

src/components/contexts/UserDetailsContext.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
"use client";
22

3+
import { getCurrentUser } from "aws-amplify/auth";
34
import { createContext, useContext, useMemo, type ReactNode } from "react";
45
import { type UserDetailsNoFunctions } from "@/utils/amplify-utils";
56
import { useQuery } from "@tanstack/react-query";
@@ -23,6 +24,9 @@ export function UserDetailsProvider({
2324
const queryKey = ["User"];
2425

2526
async function fetchUserDetails(): Promise<UserDetailsNoFunctions> {
27+
// migh tneed to remove this is a scuffed fix
28+
const currentUser = await getCurrentUser();
29+
if (!currentUser?.userId) return {} as UserDetailsNoFunctions;
2630
const resp = await fetch("/api/user");
2731
if (!resp || !resp.ok) throw new Error("Failed to fetch user details");
2832
return await resp.json();

0 commit comments

Comments
 (0)