Skip to content

feat: add ThemeFontControl component for managing homepage fonts#1169

Open
manaskumar3003 wants to merge 4 commits intoHiEventsDev:developfrom
manaskumar3003:feature/homepage-font-picker
Open

feat: add ThemeFontControl component for managing homepage fonts#1169
manaskumar3003 wants to merge 4 commits intoHiEventsDev:developfrom
manaskumar3003:feature/homepage-font-picker

Conversation

@manaskumar3003
Copy link
Copy Markdown

What changes I've made

Added a font-family selector to the event and organizer homepage designers so organizers can pick a font for their public homepage and live-preview it before saving.

  • Backend
    • New HomepageFontFamily enum (backend/app/DomainObjects/Enums/HomepageFontFamily.php) defining the curated set of supported fonts.
    • Validation for homepage_theme_settings.font_family added to UpdateEventSettingsRequest and PartialUpdateOrganizerSettingsRequest, restricted to enum values.
    • Unit test HomepageFontFamilyTest covering the enum.
  • Frontend
    • New ThemeFontControl component used by both HomepageDesigner and OrganizerHomepageDesigner for selecting/previewing a font.
    • New constants/homepageFonts.ts — single source of truth on the frontend (Bunny Fonts family slugs, weights, and CSS fallback stacks). Kept in sync with the backend enum.
    • New utilites/fontLoader.ts — dynamically injects the Bunny Fonts stylesheet for the chosen family when rendering the homepage or the designer preview, so only selected fonts are downloaded.
    • themeUtils.ts applies the selected font stack to the homepage theme; EventHomepage, OrganizerHomepage, and their SCSS were updated to consume it.
    • types.ts extended with the font_family field on homepage theme settings.
    • Translations added for all supported locales (en, de, es, fr, hu, it, nl, pl, pt, pt-br, ru, se, tr, vi, zh-cn, zh-hk).

Why I've made these changes

The homepage designer previously only let organizers customize colors and background — the typography was locked to a single default, which made self-hosted instances feel same-y and limited branding options. Adding a curated font picker gives organizers a cheap, high-impact way to personalize their event and organizer pages without allowing arbitrary font URLs (which would be a security and performance risk). The font list is deliberately curated and kept in sync between the backend enum and the frontend constant so that invalid values can't reach the database and so the designer only shows fonts we actually know how to load.

How I've tested these changes

  • Ran the backend unit test suite (incl. the new HomepageFontFamilyTest): docker compose -f docker-compose.dev.yml exec backend php artisan test --testsuite=Unit — all pass.
  • Ran npx tsc --noEmit in the frontend — no new type errors introduced by this change.
  • Manually verified in the designer:
    • Selecting each font updates the live preview and the published homepage renders with that font after saving.
    • Posting an invalid font_family value to PATCH /event-settings / the organizer settings endpoint returns a 422 with the "selected font is not supported" message.
    • Only the chosen font is fetched from Bunny Fonts on page load (verified via Network tab).
    • Fallback stack kicks in correctly if the remote font fails to load.

Checklist

  • I have read the contributing guidelines.
  • My code follows the coding standards of the project.
  • I have tested my changes, and they work as expected.
  • I understand that this PR will be closed if I do not follow the contributor guidelines and if this PR template is left unedited.

- Created ThemeFontControl component to allow users to select and preview fonts.
- Added styles for font options in ThemeFontControl.module.scss.
- Introduced constants for homepage fonts in homepageFonts.ts, including font properties and stacks.
- Implemented font loading utility in fontLoader.ts to ensure selected fonts are loaded dynamically.
@manaskumar3003
Copy link
Copy Markdown
Author

I have read the CLA Document and I hereby sign the CLA

@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Apr 18, 2026

All contributors have signed the CLA ✍️ ✅
Posted by the CLA Assistant Lite bot.

@manaskumar3003
Copy link
Copy Markdown
Author

recheck

@daveearley
Copy link
Copy Markdown
Contributor

Great addition, thank you!

One suggestion would be to automatically use the organiser's font when creating an event. That way there's consistency between the organiser page and the event pages.

Other than that, everything looks good.

Extend the existing homepage_theme_settings snapshot in
CreateEventService::createEventSettings() to also copy the organizer's
font_family. Previously only accent, background, mode, and
background_type were inherited, so new events always rendered in the
default Outfit font even when the organizer had picked a different
typeface for their own page.

New behaviour: a new event's homepage_theme_settings.font_family is
initialised from organizer.homepage_theme_settings.font_family at
creation time. When the organizer has no font set, the key is omitted
and the frontend falls back to the default. Subsequent changes to the
organizer font do not propagate to already-created events — this
matches the snapshot semantics of the other theme keys.

Adds two unit tests in CreateEventServiceTest:
- testCreateEventInheritsOrganizerFontFamily: asserts the key is
  written when the organizer has a font set
- testCreateEventOmitsFontFamilyWhenOrganizerHasNone: asserts the
  default path stays clean when the organizer has no font
@manaskumar3003
Copy link
Copy Markdown
Author

@daveearley i have made changes but due to changes in main repo now we have merge conflicts

…icts

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@daveearley
Copy link
Copy Markdown
Contributor

Thanks @manaskumar3003! I've fixed the conflicts

@manaskumar3003
Copy link
Copy Markdown
Author

When will it get merged btw?

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