Skip to content
This repository was archived by the owner on Oct 7, 2025. It is now read-only.

Commit 05e0f93

Browse files
committed
feat(ui/portal/challenges): complete page
1 parent 40fae61 commit 05e0f93

File tree

3 files changed

+18
-10
lines changed

3 files changed

+18
-10
lines changed

apps/portal/app/routes/challenges.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import process from 'node:process'
33
import { ChallengesPage } from '@cuhacking/portal/pages/challenges'
44
import { useLoaderData } from '@remix-run/react'
55

6-
export const loader: LoaderFunction = async () => {
6+
export const loader: LoaderFunction = async ({ request }) => {
7+
const cookie = request.headers.get('Cookie')
8+
79
try {
810
const API_URL
911
= process.env.NODE_ENV === 'development'
@@ -15,7 +17,10 @@ export const loader: LoaderFunction = async () => {
1517
let hasNextPage = true
1618

1719
while (hasNextPage) {
18-
const req = await fetch(`${API_URL}/api/challenges?page=${page}&limit=100`)
20+
const req = await fetch(`${API_URL}/api/challenges?page=${page}&limit=100`, {
21+
credentials: 'include',
22+
headers: { Cookie: cookie || '' },
23+
})
1924

2025
if (!req.ok) {
2126
throw new Error('Error fetching challenges')

apps/portal/app/routes/schedule.tsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,9 @@ import process from 'node:process'
33
import { SchedulePage } from '@cuhacking/portal/pages/schedule'
44
import { useLoaderData } from '@remix-run/react'
55

6-
export const loader: LoaderFunction = async () => {
6+
export const loader: LoaderFunction = async ({ request }) => {
7+
const cookie = request.headers.get('Cookie')
8+
79
try {
810
const API_URL
911
= process.env.NODE_ENV === 'development'
@@ -15,7 +17,10 @@ export const loader: LoaderFunction = async () => {
1517
let hasNextPage = true
1618

1719
while (hasNextPage) {
18-
const req = await fetch(`${API_URL}/api/events?page=${page}&limit=100`)
20+
const req = await fetch(`${API_URL}/api/events?page=${page}&limit=100`, {
21+
credentials: 'include',
22+
headers: { Cookie: cookie || '' },
23+
})
1924

2025
if (!req.ok) {
2126
throw new Response('Error fetching events', { status: req.status })

libs/portal/pages/schedule.tsx

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ export function SchedulePage({ data }) {
4646
</GlassmorphicCard>
4747

4848
<div className="flex flex-col gap-5">
49-
{/* Day Selection */}
49+
{/* DAY SELECTION */}
5050
<div className="flex flex-row gap-3 justify-center">
5151
{days.map(day => (
5252
<button key={day.date} onClick={() => setSelectedDay(day.date)}>
@@ -77,7 +77,7 @@ export function SchedulePage({ data }) {
7777
))}
7878
</div>
7979

80-
{/* Events List */}
80+
{/* EVENTS LIST */}
8181
{filteredEvents.length > 0
8282
? (
8383
filteredEvents.map(event => (
@@ -103,9 +103,9 @@ function Event({ eventData }) {
103103
<div className="flex-grow-1 space-y-3">
104104
<Typography variant="h5">{eventData.title}</Typography>
105105
<Typography variant="paragraph-xs">
106-
📍
106+
📍
107107
{' '}
108-
{ eventData.location}
108+
{ eventData.location}
109109
</Typography>
110110
<Typography variant="paragraph-xs">
111111
@@ -122,7 +122,6 @@ function Event({ eventData }) {
122122
</div>
123123
<div className="flex flex-wrap p-2 w-fit my-auto gap-2">
124124
{eventData.type.map((tag, index) => {
125-
// Find the matching label for the event type
126125
const matchedOption = options.find(option => option.value === tag)
127126

128127
return (
@@ -133,7 +132,6 @@ function Event({ eventData }) {
133132
>
134133
{matchedOption ? matchedOption.label : tag}
135134
{' '}
136-
{/* Show emoji + label if found */}
137135
</Badge>
138136
)
139137
})}

0 commit comments

Comments
 (0)