Skip to content

Create a basic events page draft #45

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

avalee0215
Copy link
Contributor

closes #36

🌟 Context

This pr implements the basic Events page for the frontend.

📝 Description

Fetched all published events from Payload, sorted by startTime (ascending)
Displayed event title, start time, and location in each card
Implemented loading and error states
Added pagination (10 items per page)
-Added dynamic routing for each event using its slug


📋 Notes

Only events with the status published are displayed
Edited events/page.tsx to build the page and added a slug hook in events.ts to support dynamic routing

@avalee0215 avalee0215 added this to the Milestone 1 milestone Apr 22, 2025
@avalee0215 avalee0215 self-assigned this Apr 22, 2025
@avalee0215 avalee0215 requested review from dyzhuu and phawatboom April 22, 2025 03:52
Copy link
Contributor

@dyzhuu dyzhuu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good start, dynamically fetch and render the data in a server component first, and then maybe focus on pagination later

@@ -64,3 +64,5 @@ export default buildConfig({
}),
],
})

export const serverURL = env.SERVER_URL
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this used anywhere?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you intended to use this on the client side, have a look at our env validation ibrary. Client side environment variables must also be prefixed with NEXT_PUBLIC_
https://env.t3.gg/docs/nextjs

however, we are unlikely to need this

Comment on lines +7 to +10

env: {
SERVER_URL: process.env.SERVER_URL,
},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

likewise

import { useSearchParams } from 'next/navigation'

// 👇 Suspense 내부에 렌더링용 분리 컴포넌트
function EventList() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can add this to a colocated components folder

app/events/_components/event-list.tsx

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for general shared components we put them under @/components

Comment on lines +25 to +27
const res = await fetch(
`http://localhost:3000/api/events?limit=10&page=${pageParam}&sort=startTime&where[status][equals]=published`,
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Look at the payload local api for fetching data
https://payloadcms.com/docs/local-api/overview
this can be used server side

@@ -1,13 +1,101 @@
export default async function EventsPage() {
'use client'
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Frontend] Create a basic events page draft
4 participants