Skip to content

Feature/backend data integration#102

Open
deb-coder-man wants to merge 8 commits into
mainfrom
feature/backend-data-integration
Open

Feature/backend data integration#102
deb-coder-man wants to merge 8 commits into
mainfrom
feature/backend-data-integration

Conversation

@deb-coder-man

Copy link
Copy Markdown
Contributor

What does this PR do?

Replaces static mock data and CMS REST API calls with direct Supabase queries for the three public-facing data collections: events, execs, and sponsors.

Supabase client

  • Added @supabase/supabase-js to the web package
  • Created a shared supabase.ts client driven by NEXT_PUBLIC_SUPABASE_URL and NEXT_PUBLIC_SUPABASE_ANON_KEY env vars

New data hooks (web/src/hooks/)

  • useExecs() — fetches exec members sorted by year descending; joins the media table on photo_id to resolve photo URLs in one query
  • useSponsors() — fetches all sponsors sorted alphabetically; joins media on logo_id for logo URLs
  • useSponsorOfTheWeek() — fetches the single sponsor with is_sponsor_of_the_week = true using .single()

Refactored hooks

  • useEvents / useUpcomingEvents / usePastEvents — switched from fetchFromCMS to Supabase; cover image joined from media via cover_image_id

Updated types (web/src/types/)

  • Event, Exec, Sponsor types updated to snake_case column names matching Payload's PostgreSQL schema (e.g. is_upcoming, cover_image_id → joined cover_image, is_sponsor_of_the_week)

UI connected to live data

  • ExecGrid — replaces execData.ts static array with useExecs(); shows 8 animated pulse skeletons while loading, falls back to /mascot.png if no photo uploaded
  • PastEventsSection — replaces pastEvents static array with usePastEvents(); maps Supabase Event rows to the PastEvent shape via a toPastEvent helper; search and category filters work against live data; shows skeleton cards while loading

pastEventsData.ts — static pastEvents array removed; PastEvent/EventFilter types, EVENT_FILTERS, and new CATEGORY_TO_TAG map kept (still used by PastEventCard and PastEventsSection)

Type of change

  • Feature
  • Bug fix
  • Chore / config
  • Hotfix

Checklist

  • My branch follows the naming convention (feature/, fix/, chore/, hotfix/)
  • My commit messages follow the conventional commits format
  • CI checks pass

Linked Issues

Closes #
Addresses #
Related to #

@oorjagandhi oorjagandhi requested review from henryhlly and joengy June 3, 2026 01:52
import { useExecs } from '@/hooks/useExecs'

const SKELETON_KEYS = [
'sk-1',

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is this array only used for skeleton card indexing, cuz if so no need to create a hardcoded array. I think there are easier ways to just create an array of increasing numbers.

const LOAD_MORE_STEP = 6

// Maps a Supabase Event row to the shape PastEventCard expects
function toPastEvent(event: Event): PastEvent {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why do we need a mapping function the PastEventCard should handle generic events?

…ckend-data-integration

chore: merging main into branch to update db schema

@henryhlly henryhlly left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is way better, good shit dave, just a couple of questions then Ill approve

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.

2 participants