feat(cms): add Homepage CTA section global configuration - #38
feat(cms): add Homepage CTA section global configuration#38leonyllukejayme wants to merge 1 commit into
Conversation
| import { CollectionSlug, getCollectionGroupLabel } from '@/constants/collections' | ||
|
|
||
| export const CTASection: GlobalConfig = { | ||
| slug: 'cta-section', |
There was a problem hiding this comment.
Let's use a constant from src/constants/globals.ts for the slug instead of a hardcoded string.
Also, let's update the literal slug value to 'durianpy-website-cta-section' to avoid any potential naming collisions. To keep the UI clean, we should explicitly set the label to GLOBAL_LABELS[GLOBALS.DURIANPY_WEBSITE_CTA_SECTION] (or "CTA Section") so the longer slug doesn't show up in the admin panel.
There was a problem hiding this comment.
Once the #37 PR is merged (which introduces the src/constants/globals.ts file), let's make sure to add this new global there. It should look something like this:
export const GLOBALS = {
// ... existing globals
DURIANPY_WEBSITE_CTA_SECTION: 'durianpy-website-cta-section',
} as const
// ...
export const GLOBAL_LABELS: Record<GlobalSlug, string> = {
// ... existing labels
[GLOBALS.DURIANPY_WEBSITE_CTA_SECTION]: 'CTA Section',
}We can wait for that PR to be finished before making this specific edit to avoid merge conflicts. Once ready, we can import them to set slug: GLOBALS.DURIANPY_WEBSITE_CTA_SECTION and label: GLOBAL_LABELS[GLOBALS.DURIANPY_WEBSITE_CTA_SECTION].
| group: getCollectionGroupLabel('durianpy-website'), | ||
| }, | ||
|
|
||
| access: { |
There was a problem hiding this comment.
Let's refactor the access control to use the same higher-order function pattern we use in other collections, rather than casting the string to CollectionSlug.
It should look something like this:
const checkCTASectionAccess = (accessType?: AccessType) => (access: AccessArgs) =>
checkCollectionAccess(access, GLOBALS.DURIANPY_WEBSITE_CTA_SECTION, accessType)
// ... inside the config:
access: {
read: anyone,
update: checkCTASectionAccess('update'),
},
ASPactores
left a comment
There was a problem hiding this comment.
@leonyllukejayme Kindly check comments. You may coordinate with @jpornillos for the globals.ts edits.
cc: @seangaaab
| import { CollectionSlug, getCollectionGroupLabel } from '@/constants/collections' | ||
|
|
||
| export const CTASection: GlobalConfig = { | ||
| slug: 'cta-section', |
There was a problem hiding this comment.
Once the #37 PR is merged (which introduces the src/constants/globals.ts file), let's make sure to add this new global there. It should look something like this:
export const GLOBALS = {
// ... existing globals
DURIANPY_WEBSITE_CTA_SECTION: 'durianpy-website-cta-section',
} as const
// ...
export const GLOBAL_LABELS: Record<GlobalSlug, string> = {
// ... existing labels
[GLOBALS.DURIANPY_WEBSITE_CTA_SECTION]: 'CTA Section',
}We can wait for that PR to be finished before making this specific edit to avoid merge conflicts. Once ready, we can import them to set slug: GLOBALS.DURIANPY_WEBSITE_CTA_SECTION and label: GLOBAL_LABELS[GLOBALS.DURIANPY_WEBSITE_CTA_SECTION].
📝 Overview
Add a Homepage CTA section global configuration
🚀 Type of Change
🧱 CMS & Database Changes
Skip this section if no CMS or database changes were made.
payload migrate:createand saved the file.📊 Data Structure
Describe the new fields/tables or drag-and-drop a screenshot here:
🧪 Testing & Validation
📸 Visual Evidence (Mandatory)
Important
Visual proof is required to demonstrate that the approved test cases from the issue were successfully met.
Please provide screenshots, screen recordings (GIFs/Videos), or sample API outputs proving that the feature satisfies all approved test cases and do not introduce regressions.
Tests

API Endpoint (published)

Icons

(draft)

📋 Final Checklist
mainand resolved conflicts.🧠 Extra Notes / Questions
Add any additional context or questions for the reviewers here.