Skip to content

feature: fetching sponsor of the week - #198

Merged
joengy merged 11 commits into
mainfrom
feature/editable-texts
Oct 11, 2026
Merged

joengy merged 11 commits into
mainfrom
feature/editable-texts

Conversation

@GladwynChua

Copy link
Copy Markdown
Contributor

What does this PR do?

fetching sponsors. Overwrites upcoming events

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 #

@joengy joengy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left some comments for how you're dealing with the database, they are quite detailed but if you need any additional help I'm happy to help however next week I might not have as much time because its systems week for me.

Comment thread cms/src/collections/Sponsors.ts
Comment thread web/src/app/sponsors/page.tsx Outdated
Comment thread web/src/app/sponsors/page.tsx
@GladwynChua

Copy link
Copy Markdown
Contributor Author

Made the changes, let me know if there are any improvements still required.

JotinderBhamra
JotinderBhamra previously approved these changes Oct 5, 2026

@JotinderBhamra JotinderBhamra 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.

good job gladwyn looks good, might need big boy joe to check the backend and see there isnt any looping issues tho.

@joengy joengy left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I left a few comments for you to address Gladwyn, they aren't anything too complex but if you need help just lmk

Comment thread cms/src/payload.config.ts
},
},
collections: [Users, Media, Events, EventRegistrations, Sponsors, Execs, Members],
globals: [SiteSettings],

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This global needs a migration. Without one, prod won't have the site_settings / site_settings_home_join_paragraphs / site_settings_about_team_paragraphs tables, since we only run prodMigrations there. See the summary comment for how to generate it.

@@ -0,0 +1,21 @@
import { MigrateDownArgs, MigrateUpArgs, sql } from '@payloadcms/db-postgres'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This looks hand-written. It doesn't have a matching .json snapshot like the other migrations, so Payload's next migrate:create will diff against the event_rsvps snapshot and generate category again. Can you delete this file and regenerate it with migrate:create? It can go in the same migration as site-settings.

Comment thread cms/src/globals/HomePage.ts Outdated
@@ -0,0 +1,28 @@
import type { GlobalConfig } from 'payload'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

These aren't registered in payload.config.ts, and SiteSettings seems to have replaced them. Can we delete them?

Comment thread web/src/lib/homePageContent.ts Outdated
@@ -0,0 +1,30 @@
import { fetchFromCMS } from '@/lib/api'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Same here: nothing imports these now that siteSettings.ts exists, so they can go.

Comment thread .tmp/seed-site-settings.ts Outdated
@@ -0,0 +1,48 @@
import { getPayload } from 'payload'

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This duplicates cms/seed-site-settings.ts and probably shouldn't be committed. Maybe add .tmp/ to .gitignore?

Comment thread web/src/lib/sponsors.ts Outdated
Comment on lines +30 to +31
if (CMS_URL === undefined) {
throw new Error('CMS_URL is not defined in the environment variables.')
return []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This used to throw when CMS_URL was missing, and now it silently returns []. A misconfigured deploy would show an empty sponsors grid with no sign of why. Could we at least console.error here like the catch block below does?

Also, this reads process.env.CMS_URL, but lib/api.ts (used by fetchSiteSettings) reads NEXT_PUBLIC_CMS_URL. If prod only sets one of them, half the pages fall back to defaults. Could fetchSponsors use fetchFromCMS from lib/api.ts so there's a single source?

Comment thread web/src/lib/siteSettings.ts Outdated
data.eventsHeroSubtitle ||
'Join us for exciting events, cultural celebrations, and community gatherings throughout the year.',
}
} catch {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Two small things:

  • Can we log the error here? Right now a broken CMS connection is invisible.
  • The default text is duplicated between the success path and this catch block, and it's also in the CMS field defaults, the seed script and the JoinCard/ExecGrid default props. Maybe pull it into a single DEFAULT_SITE_SETTINGS object and use it in both branches here? Then the components don't need their own defaults either.

})

// Use the CMS event when available; otherwise retain Ice Kachang.
const event = data?.event ?? fallbackEvent

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

When there's no upcoming event, or the request fails, this shows the April Ice Kachang event as if it's still upcoming. Before, the events page said "No upcoming events right now". Is that intentional? I'd lean towards keeping the "no upcoming events" message so we don't advertise a past event.

Comment thread package.json Outdated
Comment on lines +8 to +9
"drizzle-kit": "0.31.10",
"drizzle-orm": "0.44.7",

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Are drizzle-kit/drizzle-orm needed at the root? drizzle-kit is already added to cms/package.json, and nothing at the root uses them.

Comment thread web/src/components/JoinCard.tsx Outdated
get involved.
</p>
{paragraphs.map((paragraph) => (
<p key={paragraph}>{paragraph}</p>

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

key={paragraph} will clash if two paragraphs have the same text. Using the index as the key is fine here.

@vercel

vercel Bot commented Oct 10, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ssa Ready Ready Preview Oct 11, 2026 7:18am UTC

An empty (or 0) event price now means a free event: registration is
confirmed straight away without Stripe, the card shows "Free", and
the success page has a free-registration state.
@joengy
joengy merged commit 589d148 into main Oct 11, 2026
4 of 5 checks passed

This branch was successfully deployed

1 active deployment
Preview — c1cb6991 Deployed Oct 11, 2026 by vercel[bot]
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.

3 participants