Skip to content

feat(cms): add or align schema for CTA component#204

Merged
Ur-imazing merged 6 commits intomainfrom
feat/148-cta-schema
Mar 5, 2026
Merged

feat(cms): add or align schema for CTA component#204
Ur-imazing merged 6 commits intomainfrom
feat/148-cta-schema

Conversation

@Ur-imazing
Copy link
Copy Markdown
Contributor

@Ur-imazing Ur-imazing commented Mar 5, 2026

Resolves #148

Summary

  • Remove deprecated widthPercent from CTA component schema
  • Add variant enum (primary, secondary) for web styling
  • Make heading and body optional (optional heading/description per issue)
  • Add sections.cta to container-slot content dynamic zone
  • Regenerate GraphQL schema and @forge/graphql client

Contracts Changed

  • yes

Regeneration Required

  • yes

Validation

  • Contracts validated
  • Generated code verified (no manual edits)
  • pnpm run check:generated passes (after regeneration)

Made with Cursor

Summary by CodeRabbit

  • New Features

    • CTA components gain style variants (primary, secondary) replacing width-based sizing.
    • CTA blocks can be placed in container slot layouts.
    • Media collection components gain new layout options: grid, hero, and player.
  • Updates

    • CTA heading, body, and button link are now optional; CTA body supports rich text.

- Remove deprecated widthPercent from CTA component
- Add variant enum (primary, secondary)
- Make heading and body optional
- Add sections.cta to container-slot content dynamic zone

Resolves #148

Made-with: Cursor
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

Warning

Rate limit exceeded

@Ur-imazing has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 7 minutes and 28 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: c30c1f77-93b2-4640-a0fb-64cca42a8f37

📥 Commits

Reviewing files that changed from the base of the PR and between 4e99d2a and 42dba42.

📒 Files selected for processing (2)
  • apps/cms/src/components/sections/container-slot.json
  • apps/cms/src/components/sections/cta.json

Walkthrough

Makes CTA fields optional (heading, body, buttonLink), removes widthPercent, adds variant enum (primary/secondary), registers CTA in container-slot dynamic zone, and updates GraphQL types/inputs/filters and generated typings accordingly.

Changes

Cohort / File(s) Summary
CTA component JSON
apps/cms/src/components/sections/cta.json
Removed widthPercent; made heading, body, and buttonLink optional; changed body to richtext; added optional variant enumeration (primary, secondary).
Container slot component JSON
apps/cms/src/components/sections/container-slot.json
Updated description string; added sections.cta to dynamicZone components.
GraphQL schema
apps/cms/schema.graphql
Updated ComponentSectionsCta (nullable body, heading, buttonLink; removed widthPercent; added variant: ENUM_COMPONENTSECTIONSCTA_VARIANT); added ENUM_COMPONENTSECTIONSCTA_VARIANT; expanded ENUM_COMPONENTSECTIONSMEDIACOLLECTION_VARIANT; added ComponentSectionsCta to ContainerSlotContentDynamicZone; updated CTA inputs/filters.
Generated type defs
packages/graphql/src/graphql-env.d.ts
Added ENUM_COMPONENTSECTIONSCTA_VARIANT; updated ComponentSectionsCta object and its Input/Filters shapes; included ComponentSectionsCta in ContainerSlotContentDynamicZone possibleTypes.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'feat(cms): add or align schema for CTA component' directly matches the main objective and accurately summarizes the PR's primary change of updating the CTA component schema.
Linked Issues check ✅ Passed The PR successfully implements all coding requirements from issue #148: CTA schema is defined with required fields (label/buttonLabel, link/buttonLink, optional heading/description) and variant enum (primary/secondary), component is registered in container-slot, and GraphQL is regenerated.
Out of Scope Changes check ✅ Passed All changes are within scope: modifications to cta.json and container-slot.json align with issue #148 requirements, schema updates follow the linked issue objectives, and GraphQL regeneration is expected for contract changes.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch feat/148-cta-schema

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

🧹 Nitpick comments (2)
apps/cms/src/components/sections/cta.json (1)

25-29: Consider a default CTA variant to avoid null-style branches.

Since variant is optional, a default can keep rendering behavior consistent when editors do not choose one.

Suggested tweak
     "variant": {
       "type": "enumeration",
       "enum": ["primary", "secondary"],
-      "required": false
+      "required": false,
+      "default": "primary"
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/cms/src/components/sections/cta.json` around lines 25 - 29, The schema's
optional "variant" field can result in inconsistent rendering; set a default to
ensure fallback behavior. Update the "variant" property in cta.json (the
"variant" enumeration) to include a "default" (e.g., "primary") so editors who
omit the field still get a deterministic CTA variant at runtime.
apps/cms/src/components/sections/container-slot.json (1)

6-6: Update the description example list to include CTA.

Line [6] gives examples of dynamic content types, but Line [23] now enables CTA. Consider adding CTA to the description to keep editor-facing metadata accurate.

Suggested tweak
-    "description": "Single slot with grid span and dynamic content (e.g. media collection, text, related questions, Bible quotes carousel)"
+    "description": "Single slot with grid span and dynamic content (e.g. media collection, text, related questions, CTA, Bible quotes carousel)"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/cms/src/components/sections/container-slot.json` at line 6, Update the
"description" value in container-slot.json to include "CTA" in the example list
so editor-facing metadata matches the enabled CTA functionality; locate the
"description" property in the container-slot.json content (the string starting
with "Single slot with grid span and dynamic content (e.g. ...") and append or
insert "CTA" into the parenthetical examples alongside media collection, text,
related questions, and Bible quotes carousel.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@apps/cms/src/components/sections/container-slot.json`:
- Line 6: Update the "description" value in container-slot.json to include "CTA"
in the example list so editor-facing metadata matches the enabled CTA
functionality; locate the "description" property in the container-slot.json
content (the string starting with "Single slot with grid span and dynamic
content (e.g. ...") and append or insert "CTA" into the parenthetical examples
alongside media collection, text, related questions, and Bible quotes carousel.

In `@apps/cms/src/components/sections/cta.json`:
- Around line 25-29: The schema's optional "variant" field can result in
inconsistent rendering; set a default to ensure fallback behavior. Update the
"variant" property in cta.json (the "variant" enumeration) to include a
"default" (e.g., "primary") so editors who omit the field still get a
deterministic CTA variant at runtime.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: fd85adaa-14b0-42d8-8a1c-478c0af044d8

📥 Commits

Reviewing files that changed from the base of the PR and between f800031 and 6af5cfe.

📒 Files selected for processing (4)
  • apps/cms/schema.graphql
  • apps/cms/src/components/sections/container-slot.json
  • apps/cms/src/components/sections/cta.json
  • packages/graphql/src/graphql-env.d.ts

- container-slot: include both sections.cta and sections.bible-quotes-carousel
- schema.graphql / graphql-env.d.ts: ContainerSlotContentDynamicZone union includes both ComponentSectionsCta and ComponentSectionsBibleQuotesCarousel

Made-with: Cursor
Allow the CTA component body to accept rich text (RTF) so editors can
use formatted content (bold, links, etc.) in the Strapi admin instead
of plain text only.

Made-with: Cursor
When buttonLink is empty, the CTA button acts as an accordion trigger:
the body (richtext) holds the expandable content. When buttonLink is set,
the CTA is a traditional button and body is typically left empty.
Regenerated schema.graphql so buttonLink is nullable in GraphQL.

Made-with: Cursor
@Ur-imazing
Copy link
Copy Markdown
Contributor Author

Follow-up commits (why they were made)

1. feat(cms): cta body as richtext for rich content

  • The CTA component body was changed from text to richtext so editors can use formatted content (bold, links, etc.) in the Strapi admin instead of plain text only.

2. feat(cms): make cta buttonLink optional for accordion-style usage

  • buttonLink is now optional to support two patterns:
    • No link: The button acts as an accordion trigger; body (richtext) holds the expandable content.
    • With link: Traditional CTA button; body is typically left empty.
  • schema.graphql was regenerated so buttonLink is nullable in GraphQL.

@Ur-imazing
Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Mar 5, 2026

✅ Actions performed

Review triggered.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
apps/cms/src/components/sections/cta.json (1)

26-29: Set a default for variant to keep styling deterministic.

variant is optional with no default, so new CTA entries can remain null, forcing downstream fallback logic. Adding "default": "primary" will stabilize rendering for future entries. Note that existing records with null values will not be auto-backfilled and may require a manual migration.

Proposed schema tweak
     "variant": {
       "type": "enumeration",
       "enum": ["primary", "secondary"],
+      "default": "primary",
       "required": false
     }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@apps/cms/src/components/sections/cta.json` around lines 26 - 29, The
"variant" field in the CTA schema is optional and has no default, causing
null/unstable styling; update the "variant" property in
apps/cms/src/components/sections/cta.json (the "variant" enumeration block) to
include a default value of "primary" (e.g., add "default": "primary") while
keeping "required": false and the existing enum ["primary","secondary"] so new
records default to "primary"; note this does not backfill existing null records
which will need a separate migration if required.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@apps/cms/src/components/sections/cta.json`:
- Around line 12-16: The web consumer
(apps/web/src/components/sections/CTASection.tsx) still treats body as a plain
string and doesn't query or use variant, so update the GraphQL fragment used by
CTASection.tsx to include the variant field and ensure the fragment’s body field
is fetched as the richtext shape; in the component add null guards around
heading and body (avoid rendering empty <h2> when heading is missing) and
replace the direct <p>{body}</p> rendering with the project’s richtext renderer
(e.g., renderRichText or the app’s canonical richtext component) to correctly
render richtext objects; also consume or handle the variant field in
CTASection.tsx (use it to pick styles/markup or document it as unused) so the
component and schema stay aligned.

---

Nitpick comments:
In `@apps/cms/src/components/sections/cta.json`:
- Around line 26-29: The "variant" field in the CTA schema is optional and has
no default, causing null/unstable styling; update the "variant" property in
apps/cms/src/components/sections/cta.json (the "variant" enumeration block) to
include a default value of "primary" (e.g., add "default": "primary") while
keeping "required": false and the existing enum ["primary","secondary"] so new
records default to "primary"; note this does not backfill existing null records
which will need a separate migration if required.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 82fa145c-205b-4523-8ed2-1403c2678831

📥 Commits

Reviewing files that changed from the base of the PR and between 1a0f55d and 4e99d2a.

📒 Files selected for processing (2)
  • apps/cms/schema.graphql
  • apps/cms/src/components/sections/cta.json
🚧 Files skipped from review as they are similar to previous changes (1)
  • apps/cms/schema.graphql

Comment thread apps/cms/src/components/sections/cta.json
- CTA variant: add default "primary" so new entries get deterministic styling
  when editors omit the field (CodeRabbit nitpick).
- Container-slot: add CTA to description example list so editor-facing
  metadata matches enabled components (CodeRabbit nitpick).

Made-with: Cursor
@Ur-imazing
Copy link
Copy Markdown
Contributor Author

CodeRabbit feedback – addressed within #148 bounded context

In-scope (done in this PR):

  • Nitpick – CTA variant default: Added "default": "primary" to the CTA variant enum in cta.json so new entries get deterministic styling when editors omit the field.
  • Nitpick – container-slot description: Updated the container-slot info.description to include "CTA" in the example list so editor-facing metadata matches the enabled components.

Out of scope for this PR (bounded context):
Issue #148 and epic #175 are CMS/schema only; the epic explicitly states "no web UI changes in this epic." The major finding (updating the web consumer in apps/web/src/components/sections/CTASection.tsx to query variant, add null guards for optional fields, and render body with a richtext renderer) is therefore out of scope for this PR. Web consumer alignment will be handled in the web epic (#176) or a dedicated follow-up issue. This PR deliberately stays within the CMS bounded context.

@Ur-imazing Ur-imazing merged commit 3a97229 into main Mar 5, 2026
12 of 13 checks passed
@Ur-imazing Ur-imazing deleted the feat/148-cta-schema branch March 5, 2026 03:46
Kneesal pushed a commit to Kneesal/forge that referenced this pull request Mar 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cms): add or align schema for CTA component

1 participant