Skip to content

🎨 Changed the sidebar trial banner to be configurable via hostSettings - #29604

Merged
9larsons merged 2 commits into
TryGhost:mainfrom
magicpages:make-upgrade-banner-configurable
Jul 28, 2026
Merged

9larsons merged 2 commits into
TryGhost:mainfrom
magicpages:make-upgrade-banner-configurable

Conversation

@betschki

Copy link
Copy Markdown
Contributor
  • the sidebar trial banner hardcodes Ghost(Pro) branding, copy and a #/pro/billing/plans link, none of which apply to managed hosting providers other than Ghost(Pro)
  • it renders purely off the subscription payload the billing app posts into Admin, so any host configuring hostSettings.billing gets it as soon as one of their sites is on trial
  • adds optional title, message, upgradeUrl, logo, logoDark and logoAlt fields under hostSettings.billing.upgradeBanner, each falling back to Ghost's current default so behaviour is unchanged unless a host overrides it
  • {{days}} in a custom message is replaced with the emphasised trial days remaining, so hosts keep the countdown the default copy has
  • a configured logo without alt text renders as decorative instead of inheriting the "Ghost Pro" alt text

Got some code for us? Awesome 🎊!

Please take a minute to explain the change you're making:

  • Why are you making it?
  • What does it do?
  • Why is this something Ghost users or developers need?

Please check your PR against these items:

  • I've read and followed the Contributor Guide
  • I've explained my change
  • I've written an automated test to prove my change works

We appreciate your contribution! 🙏

no ref

- the sidebar trial banner hardcodes Ghost(Pro) branding, "full power of
  Ghost" copy and a `#/pro/billing/plans` link, none of which apply to
  managed hosting providers other than Ghost(Pro)
- it renders purely off the subscription payload the billing app posts
  into Admin, so any host configuring hostSettings.billing gets it as
  soon as one of their sites is on trial
- adds optional title, message, upgradeUrl, logo, logoDark and logoAlt
  fields under hostSettings.billing.upgradeBanner, each falling back to
  Ghost's current default so behaviour is unchanged unless a host
  overrides it
- {{days}} in a custom message is replaced with the emphasised trial days
  remaining, so hosts keep the countdown the default copy has
- a configured logo without alt text renders as decorative instead of
  inheriting the "Ghost Pro" alt text
@coderabbitai

coderabbitai Bot commented Jul 27, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: c76fb2e3-44de-4eb8-b47e-be0574c8d6ef

📥 Commits

Reviewing files that changed from the base of the PR and between 8756541 and 65ead2b.

📒 Files selected for processing (2)
  • apps/admin/src/layout/app-sidebar/upgrade-banner.test.tsx
  • apps/admin/src/layout/app-sidebar/upgrade-banner.tsx
🚧 Files skipped from review as they are similar to previous changes (2)
  • apps/admin/src/layout/app-sidebar/upgrade-banner.test.tsx
  • apps/admin/src/layout/app-sidebar/upgrade-banner.tsx

Walkthrough

The billing configuration now supports optional upgrade-banner title, message, URL, logos, dark-mode logo, and alt text. UpgradeBanner reads these settings, replaces {{days}} when present, selects logo fallbacks, and uses configurable links and copy. New tests cover defaults, overrides, placeholder behavior, branding assets, and dark-mode logo fallback.

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: making the sidebar trial banner configurable via hostSettings.
Description check ✅ Passed The description matches the implemented banner configurability, placeholder handling, and default fallbacks.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

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.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@apps/admin/src/layout/app-sidebar/upgrade-banner.tsx`:
- Around line 18-21: Update the message formatting logic around message,
daysIndex, messageBeforeDays, and messageAfterDays to replace every
DAYS_PLACEHOLDER occurrence, rather than splitting only at the first match.
Preserve the configured message and default behavior, and add a regression test
confirming multiple {{days}} placeholders are all rendered correctly.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro Plus

Run ID: 676b07ae-9e86-41f5-8c95-fa7815f75761

📥 Commits

Reviewing files that changed from the base of the PR and between e7b5960 and 8756541.

📒 Files selected for processing (3)
  • apps/admin-x-framework/src/api/config.ts
  • apps/admin/src/layout/app-sidebar/upgrade-banner.test.tsx
  • apps/admin/src/layout/app-sidebar/upgrade-banner.tsx

Comment thread apps/admin/src/layout/app-sidebar/upgrade-banner.tsx Outdated
no ref

- a custom message using {{days}} more than once rendered the second and
  later occurrences literally, because the message was split around the
  first match only
- splits on every occurrence instead, so each one gets the emphasised day
  count
@nx-cloud

nx-cloud Bot commented Jul 28, 2026 •

Copy link
Copy Markdown

🤖 Nx Cloud AI Fix

Ensure the fix-ci command is configured to always run in your CI pipeline to get automatic fixes in future runs. For more information, please see https://nx.dev/ci/features/self-healing-ci


View your CI Pipeline Execution ↗ for commit 65ead2b

Command Status Duration Result
nx run @tryghost/admin:test:acceptance ✅ Succeeded 8m 25s View ↗
nx run-many -t test:unit -p @tryghost/admin-x-f... ✅ Succeeded 4m 53s View ↗
nx run ghost-admin:test ✅ Succeeded 2m 52s View ↗
nx run @tryghost/admin:build ✅ Succeeded 1m 57s View ↗
nx run ghost-monorepo:lint:boundaries ✅ Succeeded 20s View ↗
nx run-many -t lint -p @tryghost/admin-x-framew... ✅ Succeeded 1m 31s View ↗
nx run-many --target=build --projects=tag:publi... ✅ Succeeded 1s View ↗
nx run @tryghost/activitypub:test:acceptance ✅ Succeeded 45s View ↗

💡 Verify your cache is correct by running tasks in a sandbox. Read docs ↗


☁️ Nx Cloud last updated this comment at 2026-07-28 19:30:12 UTC

@codecov

codecov Bot commented Jul 28, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 74.82%. Comparing base (e7b5960) to head (65ead2b).
⚠️ Report is 44 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #29604      +/-   ##
==========================================
- Coverage   74.82%   74.82%   -0.01%     
==========================================
  Files        1608     1608              
  Lines      141725   141725              
  Branches    17337    17337              
==========================================
- Hits       106052   106050       -2     
- Misses      34631    34632       +1     
- Partials     1042     1043       +1     
Flag Coverage Δ
admin-tests 55.62% <ø> (-0.02%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@9larsons
9larsons enabled auto-merge (squash) July 28, 2026 19:27
@9larsons
9larsons merged commit 0c03704 into TryGhost:main Jul 28, 2026
45 checks passed
@betschki
betschki deleted the make-upgrade-banner-configurable branch July 28, 2026 19:35
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