Add global font selection with per-section override

Extracts the system-font list already used by RichTextEditor for mail
templates into a shared hifi-src/src/utils/fontOptions.js (frontend) and
App\Support\Fonts (backend), so it can drive two new pickers with a
consistent set of options.

Global: a new app_settings.site_font setting, exposed as an admin dropdown
in WebsiteSettings.jsx. tailwind.config.js now defines font-sans as
var(--site-font, ui-sans-serif, system-ui, sans-serif); Tailwind's
preflight already applies font-sans globally to <html>, so this alone
makes the chosen font cascade to virtually every text on the public site
without touching individual components. PublicLayout.jsx sets the CSS
variable from the fetched site settings.

Per-section override: a new home_sections.font_family column, editable
per homepage section in HomeSections.jsx ("Standard" = inherit the global
font). Home.jsx applies it as an inline style on each section's wrapper,
which naturally wins over the CSS-variable-driven global default when
set. Reveal.jsx gained an optional style prop (merged into its own
transform/opacity style) so the four flowing-text sections, which use it
directly as their wrapper, can receive the override too.

Verified locally: migration adds both columns without touching existing
rows, and both settings round-trip correctly through the database.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Maaxxs 2026-09-10 00:12:01 +02:00
parent 040a00a0d7
commit 17f331c35e
20 changed files with 208 additions and 81 deletions

View file

@ -46,6 +46,7 @@ const DEFAULT_SITE_SETTINGS = {
package_wheel_hint_interval: 8, package_wheel_hint_interval: 8,
gallery_card_text_x: 0, gallery_card_text_x: 0,
gallery_card_text_y: 100, gallery_card_text_y: 100,
site_font: null,
}; };
// Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG // Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG
@ -65,6 +66,17 @@ export default function PublicLayout() {
api.get('/site-settings').then(setSiteSettings).catch(() => {}); api.get('/site-settings').then(setSiteSettings).catch(() => {});
}, []); }, []);
// Globale Schriftart als CSS-Variable auf <html> - tailwind.config.js definiert font-sans
// als var(--site-font, ...Systemschrift...), dadurch greift die Auswahl automatisch auf
// praktisch jeden Text der Seite, ohne einzelne Komponenten anzufassen.
useEffect(() => {
if (siteSettings.site_font) {
document.documentElement.style.setProperty('--site-font', siteSettings.site_font);
} else {
document.documentElement.style.removeProperty('--site-font');
}
}, [siteSettings.site_font]);
if (status === null || authLoading) { if (status === null || authLoading) {
return <div className="min-h-screen bg-white dark:bg-neutral-950" />; return <div className="min-h-screen bg-white dark:bg-neutral-950" />;
} }

View file

@ -24,13 +24,13 @@ const shineVariants = {
// Trigger-based reveal: each element fades/slides/un-blurs into place the // Trigger-based reveal: each element fades/slides/un-blurs into place the
// first time it enters the viewport, then stays put. Calm and predictable // first time it enters the viewport, then stays put. Calm and predictable
// on repeated scrolling in either direction (no re-triggering, no jitter). // on repeated scrolling in either direction (no re-triggering, no jitter).
export default function Reveal({ children, direction = 'up', className = '', index = 0, shine = false }) { export default function Reveal({ children, direction = 'up', className = '', index = 0, shine = false, style }) {
const delay = Math.min(index * 0.09, 0.45); const delay = Math.min(index * 0.09, 0.45);
return ( return (
<motion.div <motion.div
className={className} className={className}
style={{ position: 'relative', overflow: 'hidden' }} style={{ position: 'relative', overflow: 'hidden', ...style }}
initial="hidden" initial="hidden"
whileInView="visible" whileInView="visible"
viewport={{ once: true, amount: 0.25, margin: '-100px' }} viewport={{ once: true, amount: 0.25, margin: '-100px' }}

View file

@ -5,19 +5,7 @@ import { Underline } from '@tiptap/extension-underline';
import { Link } from '@tiptap/extension-link'; import { Link } from '@tiptap/extension-link';
import { TextStyle } from '@tiptap/extension-text-style'; import { TextStyle } from '@tiptap/extension-text-style';
import { FontFamily } from '@tiptap/extension-font-family'; import { FontFamily } from '@tiptap/extension-font-family';
import { FONT_OPTIONS } from '../utils/fontOptions.js';
// Bewusst klassische, auf jedem Geraet vorinstallierte Schriftarten statt eigens
// gehosteter Web-Fonts: Mail-Clients laden eigene @font-face-Schriften oft gar nicht
// und fallen dann unvorhersehbar zurueck - mit Systemschriften kommt die Wahl garantiert
// so an, wie sie im Editor aussieht, und es muss nichts extern nachgeladen werden.
const FONT_OPTIONS = [
{ label: 'Systemschrift', value: '' },
{ label: 'Serifenlos (Arial)', value: 'Arial, Helvetica, sans-serif' },
{ label: 'Serif (Georgia)', value: 'Georgia, "Times New Roman", serif' },
{ label: 'Klassisch (Times New Roman)', value: '"Times New Roman", Times, serif' },
{ label: 'Modern (Verdana)', value: 'Verdana, Geneva, sans-serif' },
{ label: 'Schreibmaschine (Courier New)', value: '"Courier New", Courier, monospace' },
];
function ToolbarButton({ active, onClick, title, children }) { function ToolbarButton({ active, onClick, title, children }) {
return ( return (

View file

@ -16,6 +16,7 @@ const SiteSettingsContext = createContext({
ga_measurement_id: null, ga_measurement_id: null,
gallery_card_text_x: 0, gallery_card_text_x: 0,
gallery_card_text_y: 100, gallery_card_text_y: 100,
site_font: null,
}); });
export const SiteSettingsProvider = SiteSettingsContext.Provider; export const SiteSettingsProvider = SiteSettingsContext.Provider;

View file

@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { api } from '../../api/client.js'; import { api } from '../../api/client.js';
import RichTextEditor from '../../components/RichTextEditor.jsx'; import RichTextEditor from '../../components/RichTextEditor.jsx';
import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js';
import { FONT_OPTIONS } from '../../utils/fontOptions.js';
const SECTIONS = [ const SECTIONS = [
{ slug: 'hero', label: 'Hero (ganz oben)' }, { slug: 'hero', label: 'Hero (ganz oben)' },
@ -330,6 +331,21 @@ export default function HomeSections() {
</p> </p>
</div> </div>
</div> </div>
<div>
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">
Schriftart (für beide Sprachen gleich)
</label>
<select
value={active.font_family || ''}
onChange={(e) => update('font_family', e.target.value || null)}
className="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"
>
<option value="">Standard (globale Schriftart)</option>
{FONT_OPTIONS.filter((f) => f.value).map((f) => (
<option key={f.label} value={f.value}>{f.label}</option>
))}
</select>
</div>
</div> </div>
{active.updated_at && ( {active.updated_at && (

View file

@ -2,6 +2,7 @@ import { useEffect, useRef, useState } from 'react';
import { api } from '../../../api/client.js'; import { api } from '../../../api/client.js';
import ImageUploadField from '../../../components/ImageUploadField.jsx'; import ImageUploadField from '../../../components/ImageUploadField.jsx';
import { dragAnchorStyle } from '../../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../../utils/dragAnchorPosition.js';
import { FONT_OPTIONS } from '../../../utils/fontOptions.js';
const DAYS = [ const DAYS = [
{ key: 'mon', label: 'Montag' }, { key: 'mon', label: 'Montag' },
@ -34,6 +35,7 @@ const emptyForm = {
package_wheel_hint_interval: 8, package_wheel_hint_interval: 8,
gallery_card_text_x: 0, gallery_card_text_x: 0,
gallery_card_text_y: 100, gallery_card_text_y: 100,
site_font: '',
}; };
const PACKAGE_CARD_THEMES = [ const PACKAGE_CARD_THEMES = [
@ -127,6 +129,7 @@ export default function WebsiteSettings() {
package_wheel_hint_interval: res.package_wheel_hint_interval || 8, package_wheel_hint_interval: res.package_wheel_hint_interval || 8,
gallery_card_text_x: res.gallery_card_text_x ?? 0, gallery_card_text_x: res.gallery_card_text_x ?? 0,
gallery_card_text_y: res.gallery_card_text_y ?? 100, gallery_card_text_y: res.gallery_card_text_y ?? 100,
site_font: res.site_font || '',
}) })
) )
.finally(() => setLoading(false)); .finally(() => setLoading(false));
@ -269,6 +272,23 @@ export default function WebsiteSettings() {
</div> </div>
</section> </section>
<section className="rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900">
<h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Schriftart</h2>
<p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400">
Gilt für die gesamte Website. Einzelne Startseiten-Sektionen können unter „Startseite“
davon abweichen.
</p>
<select
value={form.site_font}
onChange={(e) => update('site_font', e.target.value)}
className="w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900"
>
{FONT_OPTIONS.map((f) => (
<option key={f.label} value={f.value}>{f.label}</option>
))}
</select>
</section>
<section className="rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900"> <section className="rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900">
<h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Kontaktdaten</h2> <h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Kontaktdaten</h2>
<p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400"> <p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400">

View file

@ -30,7 +30,7 @@ const ALIGN_MARGIN_X = { left: '', center: 'mx-auto', right: 'ml-auto' };
const EMPTY_SECTION = { const EMPTY_SECTION = {
eyebrow_de: '', eyebrow_en: '', title_de: '', title_en: '', body_html_de: '', body_html_en: '', eyebrow_de: '', eyebrow_en: '', title_de: '', title_en: '', body_html_de: '', body_html_en: '',
text_align: 'center', text_align_x: 50, text_align_y: 50, text_align: 'center', text_align_x: 50, text_align_y: 50,
button_label_de: '', button_label_en: '', button_url: '', button_label_de: '', button_label_en: '', button_url: '', font_family: null,
}; };
/** Rendert nur, wenn sowohl Beschriftung als auch Ziel gesetzt sind - interne Ziele (mit "/") /** Rendert nur, wenn sowohl Beschriftung als auch Ziel gesetzt sind - interne Ziele (mit "/")
@ -88,6 +88,7 @@ export default function Home() {
alignY: s.text_align_y, alignY: s.text_align_y,
buttonLabel: s[`button_label_${language}`] || '', buttonLabel: s[`button_label_${language}`] || '',
buttonUrl: s.button_url || '', buttonUrl: s.button_url || '',
fontFamily: s.font_family || undefined,
}; };
}; };
@ -209,7 +210,10 @@ export default function Home() {
sollen sich nicht mit dieser statischen, per Drag gesetzten Position ueberschneiden). */} sollen sich nicht mit dieser statischen, per Drag gesetzten Position ueberschneiden). */}
<div <div
className="absolute w-full max-w-2xl px-4 text-center sm:px-6" className="absolute w-full max-w-2xl px-4 text-center sm:px-6"
style={dragAnchorStyle(section('hero').alignX, section('hero').alignY, { x: 50, y: 50 })} style={{
...dragAnchorStyle(section('hero').alignX, section('hero').alignY, { x: 50, y: 50 }),
fontFamily: section('hero').fontFamily,
}}
> >
<motion.div <motion.div
initial={{ opacity: 0, y: 20 }} initial={{ opacity: 0, y: 20 }}
@ -292,7 +296,10 @@ export default function Home() {
<div <div
className="absolute w-full max-w-3xl px-4 text-center sm:px-6" className="absolute w-full max-w-3xl px-4 text-center sm:px-6"
style={dragAnchorStyle(section('youtube').alignX, section('youtube').alignY, { x: 50, y: 50 })} style={{
...dragAnchorStyle(section('youtube').alignX, section('youtube').alignY, { x: 50, y: 50 }),
fontFamily: section('youtube').fontFamily,
}}
> >
<Reveal> <Reveal>
{section('youtube').eyebrow && ( {section('youtube').eyebrow && (
@ -329,7 +336,7 @@ export default function Home() {
style={{ maxHeight: 380 }} style={{ maxHeight: 380 }}
/> />
</Reveal> </Reveal>
<Reveal direction="right" index={1} className={ALIGN_TEXT[section('craft').align]}> <Reveal direction="right" index={1} className={ALIGN_TEXT[section('craft').align]} style={{ fontFamily: section('craft').fontFamily }}>
{section('craft').eyebrow && ( {section('craft').eyebrow && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('craft').eyebrow}</p> <p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('craft').eyebrow}</p>
)} )}
@ -342,7 +349,7 @@ export default function Home() {
</div> </div>
<div className="grid items-center gap-8 md:grid-cols-2"> <div className="grid items-center gap-8 md:grid-cols-2">
<Reveal direction="left" className={`order-2 md:order-1 ${ALIGN_TEXT[section('advice').align]}`}> <Reveal direction="left" className={`order-2 md:order-1 ${ALIGN_TEXT[section('advice').align]}`} style={{ fontFamily: section('advice').fontFamily }}>
{section('advice').eyebrow && ( {section('advice').eyebrow && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('advice').eyebrow}</p> <p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('advice').eyebrow}</p>
)} )}
@ -367,7 +374,7 @@ export default function Home() {
</section> </section>
<section className="mx-auto max-w-6xl px-4 py-16 sm:px-6"> <section className="mx-auto max-w-6xl px-4 py-16 sm:px-6">
<Reveal className={`mb-8 ${ALIGN_TEXT[section('insights').align]}`}> <Reveal className={`mb-8 ${ALIGN_TEXT[section('insights').align]}`} style={{ fontFamily: section('insights').fontFamily }}>
{section('insights').eyebrow && ( {section('insights').eyebrow && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('insights').eyebrow}</p> <p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('insights').eyebrow}</p>
)} )}
@ -434,6 +441,7 @@ export default function Home() {
direction="right" direction="right"
index={1} index={1}
className={`rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 ${ALIGN_TEXT[section('more').align]}`} className={`rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 ${ALIGN_TEXT[section('more').align]}`}
style={{ fontFamily: section('more').fontFamily }}
> >
{section('more').eyebrow && ( {section('more').eyebrow && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('more').eyebrow}</p> <p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400">{section('more').eyebrow}</p>

View file

@ -0,0 +1,13 @@
// Bewusst klassische, auf jedem Geraet vorinstallierte Schriftarten statt eigens gehosteter
// Web-Fonts: fuer E-Mail-Vorlagen laden Mail-Clients @font-face-Schriften oft gar nicht und
// fallen dann unvorhersehbar zurueck; fuer die Website selbst spart es zusaetzliche
// Ladevorgaenge. Von RichTextEditor (Mail-Vorlagen/Rechtstexte) und den Schriftart-Auswahlen
// fuer die Website (global + pro Startseiten-Sektion) gemeinsam genutzt.
export const FONT_OPTIONS = [
{ label: 'Systemschrift', value: '' },
{ label: 'Serifenlos (Arial)', value: 'Arial, Helvetica, sans-serif' },
{ label: 'Serif (Georgia)', value: 'Georgia, "Times New Roman", serif' },
{ label: 'Klassisch (Times New Roman)', value: '"Times New Roman", Times, serif' },
{ label: 'Modern (Verdana)', value: 'Verdana, Geneva, sans-serif' },
{ label: 'Schreibmaschine (Courier New)', value: '"Courier New", Courier, monospace' },
];

View file

@ -4,6 +4,13 @@ export default {
content: ['./index.html', './src/**/*.{js,jsx}'], content: ['./index.html', './src/**/*.{js,jsx}'],
theme: { theme: {
extend: { extend: {
// Greift die globale Website-Schriftart auf (siehe app_settings.site_font, gesetzt von
// SiteSettingsContext.jsx als CSS-Variable auf <html>) - ohne eigene Auswahl faellt es auf
// Tailwinds Standard-Systemschriftstapel zurueck. Tailwinds Preflight wendet font-sans
// bereits global auf <html> an, dadurch greift die Variable praktisch ueberall.
fontFamily: {
sans: 'var(--site-font, ui-sans-serif, system-ui, sans-serif)',
},
colors: { colors: {
brand: { brand: {
50: '#f5fbee', 50: '#f5fbee',

View file

@ -0,0 +1,13 @@
USE hifi_shop;
-- Schriftart-Auswahl: eine globale Standardschrift fuer die ganze Website (app_settings) plus
-- ein optionaler Override pro Startseiten-Sektion (home_sections), der die globale Schrift
-- ueberschreibt, wenn gesetzt. Additiv, nichts wird geloescht.
-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
-- unter Admin-Panel -> Einstellungen -> Datenbank.
ALTER TABLE app_settings
ADD COLUMN IF NOT EXISTS site_font VARCHAR(255) NULL AFTER gallery_card_text_y;
ALTER TABLE home_sections
ADD COLUMN IF NOT EXISTS font_family VARCHAR(255) NULL AFTER button_url;

View file

@ -38,6 +38,7 @@ CREATE TABLE app_settings (
package_wheel_hint_interval INT NOT NULL DEFAULT 8, package_wheel_hint_interval INT NOT NULL DEFAULT 8,
gallery_card_text_x TINYINT UNSIGNED NOT NULL DEFAULT 0, gallery_card_text_x TINYINT UNSIGNED NOT NULL DEFAULT 0,
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100, gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
site_font VARCHAR(255) NULL,
mail_host VARCHAR(255) NULL, mail_host VARCHAR(255) NULL,
mail_port INT NULL, mail_port INT NULL,
mail_username VARCHAR(255) NULL, mail_username VARCHAR(255) NULL,
@ -76,6 +77,7 @@ CREATE TABLE home_sections (
button_label_de VARCHAR(100) NULL, button_label_de VARCHAR(100) NULL,
button_label_en VARCHAR(100) NULL, button_label_en VARCHAR(100) NULL,
button_url VARCHAR(500) NULL, button_url VARCHAR(500) NULL,
font_family VARCHAR(255) NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB; ) ENGINE=InnoDB;

View file

@ -3,6 +3,7 @@
namespace App\Controllers; namespace App\Controllers;
use App\Config\Database; use App\Config\Database;
use App\Support\Fonts;
use App\Support\Http; use App\Support\Http;
/** /**
@ -27,6 +28,7 @@ class HomeSectionController
'text_align' => 'center', 'text_align' => 'center',
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => null, 'button_label_en' => null, 'button_url' => null, 'button_label_de' => null, 'button_label_en' => null, 'button_url' => null,
'font_family' => null,
], ],
'youtube' => [ 'youtube' => [
'eyebrow_de' => 'HifiPlanet präsentiert', 'eyebrow_en' => 'HifiPlanet presents', 'eyebrow_de' => 'HifiPlanet präsentiert', 'eyebrow_en' => 'HifiPlanet presents',
@ -37,6 +39,7 @@ class HomeSectionController
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => 'Jetzt ansehen', 'button_label_en' => 'Watch now', 'button_label_de' => 'Jetzt ansehen', 'button_label_en' => 'Watch now',
'button_url' => 'https://www.youtube.com/watch?v=ostj2mKDVUc', 'button_url' => 'https://www.youtube.com/watch?v=ostj2mKDVUc',
'font_family' => null,
], ],
'craft' => [ 'craft' => [
'eyebrow_de' => 'Handwerk', 'eyebrow_en' => 'Craftsmanship', 'eyebrow_de' => 'Handwerk', 'eyebrow_en' => 'Craftsmanship',
@ -46,6 +49,7 @@ class HomeSectionController
'text_align' => 'left', 'text_align' => 'left',
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => null, 'button_label_en' => null, 'button_url' => null, 'button_label_de' => null, 'button_label_en' => null, 'button_url' => null,
'font_family' => null,
], ],
'advice' => [ 'advice' => [
'eyebrow_de' => 'Beratung', 'eyebrow_en' => 'Consultation', 'eyebrow_de' => 'Beratung', 'eyebrow_en' => 'Consultation',
@ -55,6 +59,7 @@ class HomeSectionController
'text_align' => 'left', 'text_align' => 'left',
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => null, 'button_label_en' => null, 'button_url' => null, 'button_label_de' => null, 'button_label_en' => null, 'button_url' => null,
'font_family' => null,
], ],
'insights' => [ 'insights' => [
'eyebrow_de' => null, 'eyebrow_en' => null, 'eyebrow_de' => null, 'eyebrow_en' => null,
@ -64,6 +69,7 @@ class HomeSectionController
'text_align' => 'center', 'text_align' => 'center',
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => null, 'button_label_en' => null, 'button_url' => null, 'button_label_de' => null, 'button_label_en' => null, 'button_url' => null,
'font_family' => null,
], ],
'more' => [ 'more' => [
'eyebrow_de' => null, 'eyebrow_en' => null, 'eyebrow_de' => null, 'eyebrow_en' => null,
@ -74,12 +80,14 @@ class HomeSectionController
'text_align_x' => 50, 'text_align_y' => 50, 'text_align_x' => 50, 'text_align_y' => 50,
'button_label_de' => 'Alle Leistungen entdecken', 'button_label_en' => 'Discover all our services', 'button_label_de' => 'Alle Leistungen entdecken', 'button_label_en' => 'Discover all our services',
'button_url' => '/leistungen', 'button_url' => '/leistungen',
'font_family' => null,
], ],
]; ];
private const COLUMNS = [ private const COLUMNS = [
'eyebrow_de', 'eyebrow_en', 'title_de', 'title_en', 'body_html_de', 'body_html_en', 'eyebrow_de', 'eyebrow_en', 'title_de', 'title_en', 'body_html_de', 'body_html_en',
'text_align', 'text_align_x', 'text_align_y', 'button_label_de', 'button_label_en', 'button_url', 'text_align', 'text_align_x', 'text_align_y', 'button_label_de', 'button_label_en', 'button_url',
'font_family',
]; ];
/** Oeffentlich + Admin: alle Abschnitte auf einmal (DB-Stand oder Standardtext). */ /** Oeffentlich + Admin: alle Abschnitte auf einmal (DB-Stand oder Standardtext). */
@ -114,6 +122,13 @@ class HomeSectionController
$alignX = max(0, min(100, (int) ($body['text_align_x'] ?? 50))); $alignX = max(0, min(100, (int) ($body['text_align_x'] ?? 50)));
$alignY = max(0, min(100, (int) ($body['text_align_y'] ?? 50))); $alignY = max(0, min(100, (int) ($body['text_align_y'] ?? 50)));
// Schriftart-Override dieser Sektion - leer/ungueltig = "Standard" (faellt in Home.jsx
// auf die globale Website-Schriftart zurueck, siehe app_settings.site_font).
$fontFamily = (string) ($body['font_family'] ?? '');
if (!in_array($fontFamily, Fonts::VALUES, true)) {
$fontFamily = '';
}
$values = [ $values = [
'eyebrow_de' => trim($body['eyebrow_de'] ?? '') ?: null, 'eyebrow_de' => trim($body['eyebrow_de'] ?? '') ?: null,
'eyebrow_en' => trim($body['eyebrow_en'] ?? '') ?: null, 'eyebrow_en' => trim($body['eyebrow_en'] ?? '') ?: null,
@ -127,6 +142,7 @@ class HomeSectionController
'button_label_de' => trim($body['button_label_de'] ?? '') ?: null, 'button_label_de' => trim($body['button_label_de'] ?? '') ?: null,
'button_label_en' => trim($body['button_label_en'] ?? '') ?: null, 'button_label_en' => trim($body['button_label_en'] ?? '') ?: null,
'button_url' => trim($body['button_url'] ?? '') ?: null, 'button_url' => trim($body['button_url'] ?? '') ?: null,
'font_family' => $fontFamily ?: null,
]; ];
$db = Database::connection(); $db = Database::connection();

View file

@ -42,7 +42,7 @@ class SettingsController
'hero_image_path', 'hero_image_path',
'ga_measurement_id', 'ga_property_id', 'google_place_id', 'ga_measurement_id', 'ga_property_id', 'google_place_id',
'package_card_theme', 'package_card_layout', 'package_wheel_hint_interval', 'package_card_theme', 'package_card_layout', 'package_wheel_hint_interval',
'gallery_card_text_x', 'gallery_card_text_y', 'gallery_card_text_x', 'gallery_card_text_y', 'site_font',
'mail_host', 'mail_port', 'mail_username', 'mail_encryption', 'mail_host', 'mail_port', 'mail_username', 'mail_encryption',
'mail_from_email', 'mail_from_name', 'mail_notify_email', 'mail_from_email', 'mail_from_name', 'mail_notify_email',
'mail_customer_subject', 'mail_customer_body', 'mail_owner_subject', 'mail_owner_body', 'mail_customer_subject', 'mail_customer_body', 'mail_owner_subject', 'mail_owner_body',
@ -53,7 +53,7 @@ class SettingsController
'home_sections' => [ 'home_sections' => [
'id', 'slug', 'eyebrow_de', 'eyebrow_en', 'title_de', 'title_en', 'id', 'slug', 'eyebrow_de', 'eyebrow_en', 'title_de', 'title_en',
'body_html_de', 'body_html_en', 'text_align', 'text_align_x', 'text_align_y', 'body_html_de', 'body_html_en', 'text_align', 'text_align_x', 'text_align_y',
'button_label_de', 'button_label_en', 'button_url', 'updated_at', 'button_label_de', 'button_label_en', 'button_url', 'font_family', 'updated_at',
], ],
]; ];

View file

@ -3,6 +3,7 @@
namespace App\Controllers; namespace App\Controllers;
use App\Config\Database; use App\Config\Database;
use App\Support\Fonts;
use App\Support\Http; use App\Support\Http;
use App\Support\Uploads; use App\Support\Uploads;
@ -27,6 +28,7 @@ class SiteSettingsController
'package_wheel_hint_interval' => 8, 'package_wheel_hint_interval' => 8,
'gallery_card_text_x' => 0, 'gallery_card_text_x' => 0,
'gallery_card_text_y' => 100, 'gallery_card_text_y' => 100,
'site_font' => null,
]; ];
// Entspricht dem, was zuvor hart in Footer.jsx (isOpenNow() + die drei separaten // Entspricht dem, was zuvor hart in Footer.jsx (isOpenNow() + die drei separaten
@ -44,7 +46,7 @@ class SiteSettingsController
private const APP_SETTINGS_COLUMNS = 'phone, whatsapp, contact_email, address_street, address_zip, address_city, private const APP_SETTINGS_COLUMNS = 'phone, whatsapp, contact_email, address_street, address_zip, address_city,
logo_path, logo_dark_path, business_hours, hero_image_path, ga_measurement_id, logo_path, logo_dark_path, business_hours, hero_image_path, ga_measurement_id,
package_card_theme, package_card_layout, package_wheel_hint_interval, package_card_theme, package_card_layout, package_wheel_hint_interval,
gallery_card_text_x, gallery_card_text_y'; gallery_card_text_x, gallery_card_text_y, site_font';
public static function show(): void public static function show(): void
{ {
@ -99,6 +101,13 @@ class SiteSettingsController
$galleryCardTextX = max(0, min(100, (int) ($body['gallery_card_text_x'] ?? 0))); $galleryCardTextX = max(0, min(100, (int) ($body['gallery_card_text_x'] ?? 0)));
$galleryCardTextY = max(0, min(100, (int) ($body['gallery_card_text_y'] ?? 100))); $galleryCardTextY = max(0, min(100, (int) ($body['gallery_card_text_y'] ?? 100)));
// Globale Standard-Schriftart der Website - faellt auf Systemschrift (leerer String)
// zurueck, wenn ein unbekannter Wert ankommt, statt ihn ungeprueft zu speichern.
$siteFont = (string) ($body['site_font'] ?? '');
if (!in_array($siteFont, Fonts::VALUES, true)) {
$siteFont = '';
}
$newHeroImagePath = trim($body['hero_image_path'] ?? '') ?: null; $newHeroImagePath = trim($body['hero_image_path'] ?? '') ?: null;
$newLogoPath = trim($body['logo_path'] ?? '') ?: null; $newLogoPath = trim($body['logo_path'] ?? '') ?: null;
$newLogoDarkPath = trim($body['logo_dark_path'] ?? '') ?: null; $newLogoDarkPath = trim($body['logo_dark_path'] ?? '') ?: null;
@ -128,7 +137,7 @@ class SiteSettingsController
'UPDATE app_settings SET phone = ?, whatsapp = ?, contact_email = ?, address_street = ?, address_zip = ?, 'UPDATE app_settings SET phone = ?, whatsapp = ?, contact_email = ?, address_street = ?, address_zip = ?,
address_city = ?, logo_path = ?, logo_dark_path = ?, business_hours = ?, hero_image_path = ?, address_city = ?, logo_path = ?, logo_dark_path = ?, business_hours = ?, hero_image_path = ?,
ga_measurement_id = ?, package_card_theme = ?, package_card_layout = ?, package_wheel_hint_interval = ?, ga_measurement_id = ?, package_card_theme = ?, package_card_layout = ?, package_wheel_hint_interval = ?,
gallery_card_text_x = ?, gallery_card_text_y = ? gallery_card_text_x = ?, gallery_card_text_y = ?, site_font = ?
WHERE id = 1' WHERE id = 1'
); );
$stmt->execute([ $stmt->execute([
@ -148,6 +157,7 @@ class SiteSettingsController
$wheelHintInterval, $wheelHintInterval,
$galleryCardTextX, $galleryCardTextX,
$galleryCardTextY, $galleryCardTextY,
$siteFont ?: null,
]); ]);
Uploads::deleteIfOrphaned($old['hero_image_path'] ?? null, $newHeroImagePath); Uploads::deleteIfOrphaned($old['hero_image_path'] ?? null, $newHeroImagePath);

View file

@ -0,0 +1,17 @@
<?php
namespace App\Support;
/**
* Muss zu hifi-src/src/utils/fontOptions.js (FONT_OPTIONS) passen - dieselbe Liste wird dort
* vom Rich-Text-Editor (Mail-Vorlagen/Rechtstexte), der globalen Website-Schriftart und der
* Schriftart pro Startseiten-Sektion gemeinsam verwendet.
*/
class Fonts
{
public const VALUES = [
'', 'Arial, Helvetica, sans-serif', 'Georgia, "Times New Roman", serif',
'"Times New Roman", Times, serif', 'Verdana, Geneva, sans-serif',
'"Courier New", Courier, monospace',
];
}

View file

@ -55,6 +55,7 @@ class Schema
package_wheel_hint_interval INT NOT NULL DEFAULT 8, package_wheel_hint_interval INT NOT NULL DEFAULT 8,
gallery_card_text_x TINYINT UNSIGNED NOT NULL DEFAULT 0, gallery_card_text_x TINYINT UNSIGNED NOT NULL DEFAULT 0,
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100, gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
site_font VARCHAR(255) NULL,
mail_host VARCHAR(255) NULL, mail_host VARCHAR(255) NULL,
mail_port INT NULL, mail_port INT NULL,
mail_username VARCHAR(255) NULL, mail_username VARCHAR(255) NULL,
@ -102,6 +103,7 @@ class Schema
button_label_de VARCHAR(100) NULL, button_label_de VARCHAR(100) NULL,
button_label_en VARCHAR(100) NULL, button_label_en VARCHAR(100) NULL,
button_url VARCHAR(500) NULL, button_url VARCHAR(500) NULL,
font_family VARCHAR(255) NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
) ENGINE=InnoDB", ) ENGINE=InnoDB",
@ -359,6 +361,7 @@ class Schema
'package_wheel_hint_interval' => 'INT NOT NULL DEFAULT 8', 'package_wheel_hint_interval' => 'INT NOT NULL DEFAULT 8',
'gallery_card_text_x' => 'TINYINT UNSIGNED NOT NULL DEFAULT 0', 'gallery_card_text_x' => 'TINYINT UNSIGNED NOT NULL DEFAULT 0',
'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100', 'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100',
'site_font' => 'VARCHAR(255) NULL',
'mail_host' => 'VARCHAR(255) NULL', 'mail_host' => 'VARCHAR(255) NULL',
'mail_port' => 'INT NULL', 'mail_port' => 'INT NULL',
'mail_username' => 'VARCHAR(255) NULL', 'mail_username' => 'VARCHAR(255) NULL',
@ -395,6 +398,7 @@ class Schema
'button_label_de' => 'VARCHAR(100) NULL', 'button_label_de' => 'VARCHAR(100) NULL',
'button_label_en' => 'VARCHAR(100) NULL', 'button_label_en' => 'VARCHAR(100) NULL',
'button_url' => 'VARCHAR(500) NULL', 'button_url' => 'VARCHAR(500) NULL',
'font_family' => 'VARCHAR(255) NULL',
'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP', 'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
], ],
'services' => [ 'services' => [

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -43,9 +43,9 @@
"sameAs": ["https://www.youtube.com/@hifiplanet2812"] "sameAs": ["https://www.youtube.com/@hifiplanet2812"]
} }
</script> </script>
<script type="module" crossorigin src="/assets/index-CEZHSio1.js"></script> <script type="module" crossorigin src="/assets/index-CBt-zBNW.js"></script>
<link rel="modulepreload" crossorigin href="/assets/lucide-icons-Cg2IxtAO.js"> <link rel="modulepreload" crossorigin href="/assets/lucide-icons-Cg2IxtAO.js">
<link rel="stylesheet" crossorigin href="/assets/index-BhPW2e0c.css"> <link rel="stylesheet" crossorigin href="/assets/index-DSF_8N3Q.css">
</head> </head>
<body class="bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100"> <body class="bg-white text-slate-900 dark:bg-slate-950 dark:text-slate-100">
<div id="root"></div> <div id="root"></div>