Live-Bearbeiten-Modus: Texte direkt auf der Website ändern

Eingeloggte Admins schalten über den Stift in der Navbar (oder "Website live
bearbeiten" im Dashboard) einen Bearbeiten-Modus ein und ändern Texte direkt
auf der Seite. Gesammelte Änderungen gehen mit "Speichern" an PUT /live-edit,
das jede Änderung gegen Feld-Whitelist und Berechtigung prüft und alles in
einer Transaktion schreibt.

- Startseite: Vorspann, Überschriften, Texte, Buttons inkl. Ziel, FAQ, Partner
- Leistungen, Paketkacheln (Name, Preistext, Stichpunkte), Marken, Modelle,
  Galerie-Marken/-Projekte, Impressum/Datenschutz/AGB
- Feste Texte (Buttons, Menü, Beschriftungen) je Seite über eine Liste,
  gespeichert in der neuen Tabelle text_overrides (Auto-Migration)
- Bearbeitet wird jeweils die gerade angezeigte Sprache
- .schema-version wird nicht mehr versioniert und vom Self-Update geschont

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015Dgc8etkq7JkjyZgD2DEbv
This commit is contained in:
Max Olchov 2026-10-19 22:31:25 +00:00
parent 29d128273e
commit ad3d1b081d
No known key found for this signature in database
96 changed files with 3267 additions and 2140 deletions

5
.gitignore vendored
View file

@ -35,6 +35,11 @@
# (GitUpdateService) - pro Umgebung unterschiedlich, wird automatisch geschrieben. # (GitUpdateService) - pro Umgebung unterschiedlich, wird automatisch geschrieben.
/hifi/api/config/update-state.php /hifi/api/config/update-state.php
# Merker der automatischen Datenbank-Nachruestung (SchemaController::ensureCurrent) - pro
# Umgebung unterschiedlich, wird automatisch geschrieben.
/hifi/api/config/.schema-version
/hifi/api/config/.schema-version.lock
# Dateien des Download-Bereichs (Songs usw., vom Admin hochgeladen) - koennen sehr gross # Dateien des Download-Bereichs (Songs usw., vom Admin hochgeladen) - koennen sehr gross
# sein und sind Inhalte der jeweiligen Umgebung, kein Code. Der Ordner samt Schutz-.htaccess # sein und sind Inhalte der jeweiligen Umgebung, kein Code. Der Ordner samt Schutz-.htaccess
# wird vom DownloadController beim ersten Upload selbst angelegt. # wird vom DownloadController beim ersten Upload selbst angelegt.

View file

@ -1,15 +1,43 @@
import { useState } from 'react'; import { useState } from 'react';
import { motion, AnimatePresence } from 'framer-motion'; import { motion, AnimatePresence } from 'framer-motion';
import { useLiveEdit } from '../context/LiveEditContext.jsx';
import { useLanguage } from '../context/LanguageContext.jsx';
import { EditableText } from './live/Editable.jsx';
export default function Accordion({ items }) { // Eintraege mit "id" (FAQ aus der Datenbank) lassen sich im Live-Bearbeiten-Modus direkt
// aendern - dann sind alle Antworten aufgeklappt und die Frage ist kein Button mehr.
export default function Accordion({ items, entity = 'faqs' }) {
const [openIndex, setOpenIndex] = useState(null); const [openIndex, setOpenIndex] = useState(null);
const live = useLiveEdit();
const { language } = useLanguage();
if (live.canEdit(entity)) {
return (
<div className="divide-y divide-neutral-200 rounded-xl border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900">
{items.map((item, i) => (
<div key={item.id ?? i} className="space-y-3 px-5 py-4">
<EditableText entity={entity} id={item.id} field="question" value={item.question} as="p" className="block font-medium text-neutral-900 dark:text-white" placeholder="Frage" />
<EditableText entity={entity} id={item.id} field="answer" value={item.answer} as="p" multiline className="block whitespace-pre-line text-sm text-neutral-600 dark:text-neutral-300" placeholder="Antwort" />
</div>
))}
</div>
);
}
return ( return (
<div className="divide-y divide-neutral-200 rounded-xl border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900"> <div className="divide-y divide-neutral-200 rounded-xl border border-neutral-200 bg-white dark:divide-neutral-800 dark:border-neutral-800 dark:bg-neutral-900">
{items.map((item, i) => { {items.map((raw, i) => {
const isOpen = openIndex === i; const isOpen = openIndex === i;
// Im Bearbeiten-Modus gespeicherte Aenderungen sofort zeigen (die Liste selbst ist vom Laden).
const item = raw.id
? {
...raw,
question: live.getValue(entity, raw.id, 'question', language, raw.question),
answer: live.getValue(entity, raw.id, 'answer', language, raw.answer),
}
: raw;
return ( return (
<div key={item.question}> <div key={item.id ?? item.question}>
<button <button
onClick={() => setOpenIndex(isOpen ? null : i)} onClick={() => setOpenIndex(isOpen ? null : i)}
className="flex w-full items-center justify-between gap-4 px-5 py-4 text-left" className="flex w-full items-center justify-between gap-4 px-5 py-4 text-left"

View file

@ -0,0 +1,44 @@
import { useEffect, useState } from 'react';
import { api } from '../api/client.js';
import usePageMeta from '../hooks/usePageMeta.js';
import { EditableHtml, EditableText } from './live/Editable.jsx';
/** Gemeinsame Darstellung von Impressum, Datenschutz und AGB (Texte aus legal_pages). */
export default function LegalPageView({ slug, fallbackTitle, description }) {
const [page, setPage] = useState(null);
useEffect(() => {
api.get(`/legal-pages/${slug}`).then(setPage).catch(() => {});
}, [slug]);
usePageMeta({
title: page?.title || fallbackTitle,
description,
path: `/${slug}`,
});
if (!page) return null;
return (
<div className="mx-auto max-w-3xl px-4 py-12 sm:px-6">
<EditableText
entity="legal_pages"
id={slug}
field="title"
lang="de"
value={page.title}
as="h1"
className="mb-8 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl"
/>
<EditableHtml
entity="legal_pages"
id={slug}
field="body_html"
lang="de"
value={page.body_html}
label={page.title}
className="legal-content text-sm text-neutral-600 dark:text-neutral-300"
/>
</div>
);
}

View file

@ -1,11 +1,12 @@
import { useEffect, useRef, useState } from 'react'; import { useEffect, useRef, useState } from 'react';
import { createPortal } from 'react-dom'; import { createPortal } from 'react-dom';
import { Link, useLocation } from 'react-router-dom'; import { Link, useLocation } from 'react-router-dom';
import { LayoutDashboard, MessageCircle, Phone, ShoppingBag } from 'lucide-react'; import { LayoutDashboard, MessageCircle, Pencil, Phone, ShoppingBag } from 'lucide-react';
import ThemeToggle from './ThemeToggle.jsx'; import ThemeToggle from './ThemeToggle.jsx';
import { useAuth } from '../context/AuthContext.jsx'; import { useAuth } from '../context/AuthContext.jsx';
import { useIsAreaHidden, useSiteSettings } from '../context/SiteSettingsContext.jsx'; import { useIsAreaHidden, useSiteSettings } from '../context/SiteSettingsContext.jsx';
import { useLanguage } from '../context/LanguageContext.jsx'; import { useLanguage } from '../context/LanguageContext.jsx';
import { useLiveEdit } from '../context/LiveEditContext.jsx';
import logoDark from '../assets/logo-dark.png'; import logoDark from '../assets/logo-dark.png';
import { telHref, waHref } from '../utils/contactLinks.js'; import { telHref, waHref } from '../utils/contactLinks.js';
import { trackEvent } from '../utils/analytics.js'; import { trackEvent } from '../utils/analytics.js';
@ -232,6 +233,28 @@ export default function Navbar() {
</Link> </Link>
); );
// Nur fuer eingeloggte Admins mit Inhalts-Rechten: Live-Bearbeiten-Modus an/aus (siehe
// context/LiveEditContext.jsx). Besucher sehen davon nichts.
const live = useLiveEdit();
const LiveEditToggle = live.available && (
<button
type="button"
onClick={() => live.setEnabled(!live.enabled)}
aria-pressed={live.enabled}
aria-label="Seite bearbeiten"
title={live.enabled ? 'Bearbeiten beenden' : 'Seite bearbeiten'}
className={`rounded-full p-2 transition ${
live.enabled
? 'bg-brand-500 text-white hover:bg-brand-600'
: transparent
? 'text-white hover:bg-white/10'
: 'text-neutral-300 hover:bg-neutral-800'
}`}
>
<Pencil className="h-5 w-5" />
</button>
);
// Fortlaufender Index fuer die gestaffelte Einflug-Animation - optionale Eintraege // Fortlaufender Index fuer die gestaffelte Einflug-Animation - optionale Eintraege
// (Downloads, Telefon, WhatsApp) verschieben so die nachfolgenden automatisch. // (Downloads, Telefon, WhatsApp) verschieben so die nachfolgenden automatisch.
let flyIndex = 0; let flyIndex = 0;
@ -273,6 +296,7 @@ export default function Navbar() {
</Link> </Link>
<div className="flex items-center justify-self-end gap-1"> <div className="flex items-center justify-self-end gap-1">
{LiveEditToggle}
{AdminIcon} {AdminIcon}
{!open && <LanguageSwitcher overHero={transparent} />} {!open && <LanguageSwitcher overHero={transparent} />}
<ThemeToggle overHero={transparent} forceDark /> <ThemeToggle overHero={transparent} forceDark />

View file

@ -14,6 +14,8 @@ import { CustomFontsProvider } from '../context/CustomFontsContext.jsx';
import CustomFontFaces from './CustomFontFaces.jsx'; import CustomFontFaces from './CustomFontFaces.jsx';
import PageImageLoader from './PageImageLoader.jsx'; import PageImageLoader from './PageImageLoader.jsx';
import { LanguageProvider } from '../context/LanguageContext.jsx'; import { LanguageProvider } from '../context/LanguageContext.jsx';
import { LiveEditProvider } from '../context/LiveEditContext.jsx';
import LiveEditBar from './live/LiveEditBar.jsx';
import { useAuth } from '../context/AuthContext.jsx'; import { useAuth } from '../context/AuthContext.jsx';
import { api } from '../api/client.js'; import { api } from '../api/client.js';
import { isPathHidden } from '../utils/siteAreas.js'; import { isPathHidden } from '../utils/siteAreas.js';
@ -181,13 +183,16 @@ export default function PublicLayout() {
if (status.global.enabled && !bypass && !isLegalPage) { if (status.global.enabled && !bypass && !isLegalPage) {
return ( return (
<LiveEditProvider serverOverrides={siteSettings.text_overrides}>
<LanguageProvider> <LanguageProvider>
<MaintenanceNotice message={status.global.message} fullScreen /> <MaintenanceNotice message={status.global.message} fullScreen />
</LanguageProvider> </LanguageProvider>
</LiveEditProvider>
); );
} }
return ( return (
<LiveEditProvider serverOverrides={siteSettings.text_overrides}>
<LanguageProvider> <LanguageProvider>
<MaintenanceProvider value={{ ...status, bypass }}> <MaintenanceProvider value={{ ...status, bypass }}>
<SiteSettingsProvider value={siteSettings}> <SiteSettingsProvider value={siteSettings}>
@ -216,11 +221,13 @@ export default function PublicLayout() {
<Footer /> <Footer />
<CookieConsentBanner /> <CookieConsentBanner />
<GoogleAnalytics /> <GoogleAnalytics />
<LiveEditBar />
</div> </div>
</CustomFontsProvider> </CustomFontsProvider>
</TextStylesProvider> </TextStylesProvider>
</SiteSettingsProvider> </SiteSettingsProvider>
</MaintenanceProvider> </MaintenanceProvider>
</LanguageProvider> </LanguageProvider>
</LiveEditProvider>
); );
} }

View file

@ -0,0 +1,172 @@
import { useLanguage } from '../../context/LanguageContext.jsx';
import { useLiveEdit } from '../../context/LiveEditContext.jsx';
// Bausteine fuer den Live-Bearbeiten-Modus (siehe context/LiveEditContext.jsx). Ausserhalb des
// Modus rendern sie genau das Element, das vorher an der Stelle stand - nur mit dem ggf. schon
// live geaenderten Wert. Im Modus wird der Text direkt auf der Seite editierbar (Klartext) bzw.
// oeffnet per Klick den Editor in der Bearbeiten-Leiste (Rich-Text und mehrzeilige Felder).
// Klicks im Modus duerfen keine Links/Buttons ausloesen, in denen der Text steht.
const swallow = (e) => {
e.preventDefault();
e.stopPropagation();
};
function insertPlainText(e) {
e.preventDefault();
const text = e.clipboardData.getData('text/plain');
document.execCommand('insertText', false, text);
}
/**
* Einzeiliger (oder mit multiline mehrzeiliger) Klartext, direkt im Element editierbar.
* entity/id/field wie in LiveEditController::ENTITIES; lang = Sprache des Felds (Standard:
* die gerade angezeigte Sprache).
*/
export function EditableText({
entity,
id,
field,
lang,
value,
as: Tag = 'span',
multiline = false,
placeholder = 'Text eingeben…',
className = '',
...rest
}) {
const { language } = useLanguage();
const live = useLiveEdit();
const fieldLang = lang || language;
const current = live.getValue(entity, id, field, fieldLang, value ?? '') ?? '';
if (!live.canEdit(entity)) {
return (
<Tag className={className} {...rest}>
{current}
</Tag>
);
}
const commit = (el) => {
const text = multiline ? el.innerText.replace(/\n{3,}/g, '\n\n').trim() : el.innerText.replace(/\s+/g, ' ').trim();
if (text !== current.trim()) live.setValue(entity, id, field, fieldLang, text);
// Leeren/Zusammenfassen von Leerraum auch sichtbar machen (React rendert gleiche Werte nicht neu).
if (el.innerText !== text) el.innerText = text;
};
return (
<Tag
// key: nach jeder uebernommenen Aenderung (und bei Sprachwechsel) frisch aufbauen - das
// Tippen im contentEditable ersetzt die Textknoten, die React kennt; ein normales Update
// koennte den Text sonst doppelt einsetzen.
key={`${fieldLang}:${current}`}
{...rest}
className={`${className} live-editable${live.hasPending(entity, id, field, fieldLang) ? ' live-editable-changed' : ''}`}
contentEditable
suppressContentEditableWarning
spellCheck
data-live-placeholder={placeholder}
onClick={swallow}
onPaste={insertPlainText}
onKeyDown={(e) => {
if (e.key === 'Enter' && !multiline) {
e.preventDefault();
e.currentTarget.blur();
} else if (e.key === 'Escape') {
e.currentTarget.innerText = current;
e.currentTarget.blur();
}
// Leertaste in einem <button> wuerde sonst den Button ausloesen statt ein Leerzeichen zu setzen.
e.stopPropagation();
}}
onKeyUp={(e) => e.stopPropagation()}
onBlur={(e) => commit(e.currentTarget)}
>
{current}
</Tag>
);
}
/** Fester Text aus dem i18n-Woerterbuch (z. B. "home.faqHeading"), direkt editierbar. */
export function EditableT({ k, ...rest }) {
const { t } = useLanguage();
return <EditableText entity="text" id={k} field="value" value={t(k)} placeholder="Leer = Standardtext" {...rest} />;
}
/** Rich-Text-Feld (HTML) - im Modus oeffnet ein Klick den Editor in der Bearbeiten-Leiste. */
export function EditableHtml({ entity, id, field, lang, value, label = 'Text', className = '', ...rest }) {
const { language } = useLanguage();
const live = useLiveEdit();
const fieldLang = lang || language;
const current = live.getValue(entity, id, field, fieldLang, value ?? '') ?? '';
if (!live.canEdit(entity)) {
return <div className={className} {...rest} dangerouslySetInnerHTML={{ __html: current }} />;
}
const open = (e) => {
swallow(e);
live.openEditor({ kind: 'html', entity, id, field, lang: fieldLang, label, original: current });
};
return (
<div
{...rest}
className={`${className} live-editable live-editable-block${live.hasPending(entity, id, field, fieldLang) ? ' live-editable-changed' : ''}`}
role="button"
tabIndex={0}
title="Klicken zum Bearbeiten"
onClick={open}
onKeyDown={(e) => e.key === 'Enter' && open(e)}
data-live-placeholder="Text hinzufügen…"
dangerouslySetInnerHTML={{ __html: current }}
/>
);
}
/**
* Umschliesst eine Darstellung, die sich nicht direkt editieren laesst (z. B. Paket-Stichpunkte
* aus einem mehrzeiligen Feld) - im Modus oeffnet ein Klick darauf einen Textbereich-Editor.
* kind: 'textarea' (mehrzeilig) oder 'input' (eine Zeile, z. B. eine Link-Adresse).
*/
export function EditableArea({ entity, id, field, lang, value, label, kind = 'textarea', hint, as: Tag = 'div', className = '', children, ...rest }) {
const { language } = useLanguage();
const live = useLiveEdit();
const fieldLang = lang || language;
if (!live.canEdit(entity)) {
return (
<Tag className={className} {...rest}>
{children}
</Tag>
);
}
const current = live.getValue(entity, id, field, fieldLang, value ?? '') ?? '';
const open = (e) => {
swallow(e);
live.openEditor({ kind, entity, id, field, lang: fieldLang, label, hint, original: current });
};
return (
<Tag
{...rest}
className={`${className} live-editable live-editable-block${live.hasPending(entity, id, field, fieldLang) ? ' live-editable-changed' : ''}`}
role="button"
tabIndex={0}
title={`${label} bearbeiten`}
onClickCapture={open}
onKeyDown={(e) => e.key === 'Enter' && open(e)}
>
{children}
</Tag>
);
}
/** Wert eines Felds inkl. noch nicht gespeicherter Live-Aenderungen (fuer abgeleitete Darstellungen). */
export function useLiveValue(entity, id, field, value, lang) {
const { language } = useLanguage();
const live = useLiveEdit();
return live.getValue(entity, id, field, lang || language, value);
}

View file

@ -0,0 +1,237 @@
import { lazy, Suspense, useEffect, useMemo, useState } from 'react';
import { useLocation } from 'react-router-dom';
import { Check, ListTree, Pencil, RotateCcw, X } from 'lucide-react';
import { useLiveEdit } from '../../context/LiveEditContext.jsx';
import { useLanguage } from '../../context/LanguageContext.jsx';
import { dictionaries } from '../../i18n/index.js';
// Der Rich-Text-Editor (Tiptap) ist gross und wird nur im Bearbeiten-Modus gebraucht.
const RichTextEditor = lazy(() => import('../RichTextEditor.jsx'));
const LANGUAGE_NAMES = { de: 'Deutsch', en: 'Englisch' };
// Texte, die auf jeder Seite vorkommen - in der Liste "Feste Texte" ans Ende.
const SHARED_PREFIXES = ['nav.', 'footer.', 'cookieConsent.', 'languageToggle.', 'themeToggle.', 'maintenance.'];
const isShared = (key) => SHARED_PREFIXES.some((prefix) => key.startsWith(prefix));
function lookup(dict, key) {
return key.split('.').reduce((obj, part) => (obj == null ? undefined : obj[part]), dict);
}
/** Editor fuer Rich-Text und mehrzeilige Felder - Aenderungen erscheinen sofort auf der Seite. */
function FieldEditor({ editor }) {
const live = useLiveEdit();
const { entity, id, field, lang, kind, label, hint, original } = editor;
// Stand beim Oeffnen, damit "Abbrechen" genau dorthin zurueckkehrt.
const [initial] = useState(() => ({ value: original, wasPending: live.hasPending(entity, id, field, lang) }));
const [value, setValue] = useState(original);
const change = (next) => {
setValue(next);
live.setValue(entity, id, field, lang, next);
};
const cancel = () => {
if (initial.wasPending) live.setValue(entity, id, field, lang, initial.value);
else live.resetValue(entity, id, field, lang);
live.closeEditor();
};
return (
<div className="pointer-events-auto w-full rounded-xl border border-neutral-200 bg-white p-4 text-neutral-900 shadow-2xl dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-100 sm:w-[min(92vw,520px)]">
<div className="mb-2 flex items-center justify-between gap-3">
<p className="text-sm font-semibold">
{label} <span className="font-normal text-neutral-500">({LANGUAGE_NAMES[lang]})</span>
</p>
<button type="button" onClick={cancel} aria-label="Abbrechen" className="rounded p-1 text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800">
<X className="h-4 w-4" />
</button>
</div>
{hint && <p className="mb-2 text-xs text-neutral-500 dark:text-neutral-400">{hint}</p>}
{kind === 'html' ? (
<div className="max-h-[45vh] overflow-y-auto rounded-md border border-neutral-300 dark:border-neutral-700">
<Suspense fallback={<p className="p-3 text-sm text-neutral-500">Editor lädt…</p>}>
<RichTextEditor value={value} onChange={change} />
</Suspense>
</div>
) : kind === 'input' ? (
<input
autoFocus
value={value}
onChange={(e) => change(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-800"
/>
) : (
<textarea
autoFocus
rows={7}
value={value}
onChange={(e) => change(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-800"
/>
)}
<div className="mt-3 flex justify-end gap-2">
<button type="button" onClick={cancel} className="rounded-md border border-neutral-300 px-3 py-1.5 text-sm font-medium hover:bg-neutral-50 dark:border-neutral-700 dark:hover:bg-neutral-800">
Abbrechen
</button>
<button type="button" onClick={live.closeEditor} className="rounded-md bg-brand-500 px-3 py-1.5 text-sm font-semibold text-white hover:bg-brand-600">
Übernehmen
</button>
</div>
</div>
);
}
/** Liste der festen Texte (Buttons, Beschriftungen, Menue ...) der aktuellen Seite. */
function TextPanel({ onClose }) {
const live = useLiveEdit();
const { language, t } = useLanguage();
const location = useLocation();
const [query, setQuery] = useState('');
const [tick, setTick] = useState(0);
// t() merkt sich beim Rendern, welche Texte die Seite benutzt - nach einem Seitenwechsel
// kurz warten, bis die neue Seite (inkl. nachgeladener Daten) einmal gerendert hat.
useEffect(() => {
const timer = setTimeout(() => setTick((n) => n + 1), 400);
return () => clearTimeout(timer);
}, [location.pathname]);
const keys = useMemo(
() =>
live
.usedTextKeys(location.pathname)
.filter((key) => typeof lookup(dictionaries.de, key) === 'string')
.sort((a, b) => isShared(a) - isShared(b) || a.localeCompare(b)),
// eslint-disable-next-line react-hooks/exhaustive-deps
[location.pathname, tick, live.usedTextKeys]
);
const needle = query.trim().toLowerCase();
const shown = keys.filter((key) => !needle || key.toLowerCase().includes(needle) || t(key).toLowerCase().includes(needle));
return (
<div className="pointer-events-auto flex max-h-[60vh] w-full flex-col rounded-xl border border-neutral-200 bg-white text-neutral-900 shadow-2xl dark:border-neutral-700 dark:bg-neutral-900 dark:text-neutral-100 sm:w-[min(92vw,520px)]">
<div className="flex items-center justify-between gap-3 border-b border-neutral-200 p-4 pb-3 dark:border-neutral-800">
<div>
<p className="text-sm font-semibold">Feste Texte auf dieser Seite <span className="font-normal text-neutral-500">({LANGUAGE_NAMES[language]})</span></p>
<p className="text-xs text-neutral-500 dark:text-neutral-400">Buttons, Beschriftungen, Menü und Fußzeile. Leer lassen = Standardtext.</p>
</div>
<button type="button" onClick={onClose} aria-label="Schließen" className="rounded p-1 text-neutral-500 hover:bg-neutral-100 dark:hover:bg-neutral-800">
<X className="h-4 w-4" />
</button>
</div>
<div className="px-4 pt-3">
<input
type="search"
value={query}
onChange={(e) => setQuery(e.target.value)}
placeholder="Suchen…"
className="w-full rounded-md border border-neutral-300 bg-white px-3 py-1.5 text-sm dark:border-neutral-700 dark:bg-neutral-800"
/>
</div>
<ul className="flex-1 space-y-3 overflow-y-auto p-4">
{shown.length === 0 && <li className="text-sm text-neutral-500">Keine Texte gefunden.</li>}
{shown.map((key, i) => {
const builtIn = lookup(dictionaries[language], key) ?? lookup(dictionaries.de, key);
const overridden = live.textOverride(language, key) !== undefined;
const value = t(key);
return (
<li key={key}>
{isShared(key) && (i === 0 || !isShared(shown[i - 1])) && (
<p className="mb-3 border-t border-neutral-200 pt-3 text-xs font-semibold uppercase tracking-wide text-neutral-500 dark:border-neutral-800">
Auf allen Seiten (Menü, Fußzeile, Cookie-Hinweis)
</p>
)}
<div className="mb-1 flex items-center justify-between gap-2">
<label htmlFor={`live-text-${key}`} className="truncate font-mono text-[11px] text-neutral-500" title={key}>
{key}
</label>
{overridden && (
<button
type="button"
onClick={() => live.setValue('text', key, 'value', language, '')}
className="flex shrink-0 items-center gap-1 text-[11px] text-neutral-500 hover:text-brand-600"
title={`Standard: ${builtIn}`}
>
<RotateCcw className="h-3 w-3" /> Standard
</button>
)}
</div>
<textarea
id={`live-text-${key}`}
rows={value.length > 60 ? 3 : 1}
value={value}
onChange={(e) => live.setValue('text', key, 'value', language, e.target.value === builtIn ? '' : e.target.value)}
className={`w-full resize-y rounded-md border bg-white px-2.5 py-1.5 text-sm dark:bg-neutral-800 ${
overridden ? 'border-amber-400 dark:border-amber-500' : 'border-neutral-300 dark:border-neutral-700'
}`}
/>
</li>
);
})}
</ul>
</div>
);
}
/** Leiste unten im Bearbeiten-Modus: Speichern/Verwerfen/Beenden plus Editoren. */
export default function LiveEditBar() {
const live = useLiveEdit();
const { language } = useLanguage();
const [showTexts, setShowTexts] = useState(false);
if (!live.enabled) return null;
const leave = () => {
if (live.pendingCount && !window.confirm('Es gibt ungespeicherte Änderungen. Bearbeiten trotzdem beenden? Die Änderungen gehen dann verloren.')) return;
live.discard();
live.setEnabled(false);
};
const editorKey = live.editor && `${live.editor.entity}|${live.editor.id}|${live.editor.field}|${live.editor.lang}`;
return (
<div className="pointer-events-none fixed inset-x-0 bottom-0 z-[150] flex flex-col items-end gap-2 p-2 sm:p-4">
{live.editor ? <FieldEditor key={editorKey} editor={live.editor} /> : showTexts && <TextPanel onClose={() => setShowTexts(false)} />}
<div className="pointer-events-auto flex w-full flex-wrap items-center justify-between gap-2 rounded-xl border border-neutral-700 bg-neutral-950/95 px-3 py-2.5 text-sm text-neutral-100 shadow-2xl backdrop-blur sm:px-4">
<div className="flex min-w-0 items-center gap-2">
<Pencil className="h-4 w-4 shrink-0 text-brand-400" />
<p className="min-w-0 truncate">
<span className="font-semibold">Bearbeiten</span>
<span className="hidden text-neutral-400 sm:inline"> · {LANGUAGE_NAMES[language]} · gestrichelte Stellen anklicken</span>
</p>
</div>
<div className="flex flex-wrap items-center gap-2">
{live.error && <span className="max-w-xs text-xs text-red-400">{live.error}</span>}
<button
type="button"
onClick={() => {
live.closeEditor();
setShowTexts((v) => !v);
}}
className={`flex items-center gap-1.5 rounded-md border px-3 py-1.5 font-medium ${showTexts ? 'border-brand-400 text-brand-300' : 'border-neutral-700 hover:bg-neutral-800'}`}
>
<ListTree className="h-4 w-4" />
<span className="hidden sm:inline">Feste Texte</span>
</button>
{live.pendingCount > 0 && (
<button type="button" onClick={live.discard} className="rounded-md border border-neutral-700 px-3 py-1.5 font-medium hover:bg-neutral-800">
Verwerfen
</button>
)}
<button
type="button"
onClick={live.save}
disabled={!live.pendingCount || live.saving}
className="flex items-center gap-1.5 rounded-md bg-brand-500 px-3 py-1.5 font-semibold text-white hover:bg-brand-600 disabled:opacity-50"
>
<Check className="h-4 w-4" />
{live.saving ? 'Speichere…' : live.pendingCount ? `Speichern (${live.pendingCount})` : 'Gespeichert'}
</button>
<button type="button" onClick={leave} aria-label="Bearbeiten beenden" title="Bearbeiten beenden" className="rounded-md p-1.5 text-neutral-400 hover:bg-neutral-800 hover:text-white">
<X className="h-4 w-4" />
</button>
</div>
</div>
</div>
);
}

View file

@ -1,5 +1,6 @@
import { createContext, useContext, useEffect, useState } from 'react'; import { createContext, useContext, useEffect, useState } from 'react';
import { dictionaries } from '../i18n/index.js'; import { dictionaries } from '../i18n/index.js';
import { useLiveEdit } from './LiveEditContext.jsx';
function detectDefaultLanguage() { function detectDefaultLanguage() {
const stored = localStorage.getItem('hifi-lang'); const stored = localStorage.getItem('hifi-lang');
@ -28,6 +29,9 @@ const LanguageContext = createContext({
export function LanguageProvider({ children }) { export function LanguageProvider({ children }) {
const [language, setLanguage] = useState(detectDefaultLanguage); const [language, setLanguage] = useState(detectDefaultLanguage);
// Im Live-Bearbeiten-Modus geaenderte feste Texte (text_overrides) haben Vorrang vor dem
// Woerterbuch - nur fuer reine Texte, nicht fuer Listen oder Funktionen wie metaDescription(name).
const { textOverride, trackTextKey } = useLiveEdit();
useEffect(() => { useEffect(() => {
document.documentElement.setAttribute('lang', language); document.documentElement.setAttribute('lang', language);
@ -39,6 +43,11 @@ export function LanguageProvider({ children }) {
const t = (key) => { const t = (key) => {
const dict = dictionaries[language] || dictionaries.de; const dict = dictionaries[language] || dictionaries.de;
const value = lookup(dict, key); const value = lookup(dict, key);
if (typeof value === 'string' || (value === undefined && typeof lookup(dictionaries.de, key) === 'string')) {
trackTextKey(key);
const override = textOverride(language, key);
if (override !== undefined) return override;
}
if (value !== undefined) return value; if (value !== undefined) return value;
const fallback = lookup(dictionaries.de, key); const fallback = lookup(dictionaries.de, key);
return fallback !== undefined ? fallback : key; return fallback !== undefined ? fallback : key;

View file

@ -0,0 +1,235 @@
import { createContext, useCallback, useContext, useEffect, useMemo, useRef, useState } from 'react';
import { api } from '../api/client.js';
import { useAuth } from './AuthContext.jsx';
// Live-Bearbeiten-Modus der Website: eingeloggte Admins schalten ihn in der Navbar ein und
// aendern Texte direkt auf der Seite (components/live/Editable.jsx). Aenderungen sammeln sich
// hier als "pending" und gehen mit einem Klick auf "Speichern" gesammelt an PUT /live-edit
// (LiveEditController.php), das jede Aenderung einzeln gegen Feld-Whitelist und Berechtigung
// prueft. Bereits gespeicherte Werte bleiben als "committed" bis zum Neuladen ueber den
// (dann veralteten) Daten der Seite liegen, damit nichts zurueckspringt.
//
// Schluessel einer Aenderung: entity|id|field|lang - entity "text" sind die festen Texte aus
// dem i18n-Woerterbuch (id = Schluessel wie "home.faqHeading", field = "value").
// Muss zu LiveEditController::ENTITIES passen.
export const ENTITY_PERMISSIONS = {
home_sections: 'content.manage',
faqs: 'content.manage',
partners: 'content.manage',
text: 'content.manage',
services: 'services.manage',
packages: 'packages.manage',
brands: 'brands.manage',
car_models: 'models.manage',
gallery_brands: 'gallery.manage',
gallery_projects: 'gallery.manage',
gallery_photos: 'gallery.manage',
legal_pages: 'settings.manage',
};
const STORAGE_KEY = 'hifi-live-edit';
const EMPTY_OVERRIDES = { de: {}, en: {} };
const changeKey = (entity, id, field, lang) => `${entity}|${id}|${field}|${lang}`;
function readEnabled() {
try {
// Link "Website live bearbeiten" im Admin-Dashboard (/?bearbeiten=1, oeffnet neuen Tab).
const params = new URLSearchParams(window.location.search);
if (params.get('bearbeiten') === '1') {
sessionStorage.setItem(STORAGE_KEY, '1');
params.delete('bearbeiten');
const query = params.toString();
window.history.replaceState(window.history.state, '', window.location.pathname + (query ? `?${query}` : '') + window.location.hash);
return true;
}
return sessionStorage.getItem(STORAGE_KEY) === '1';
} catch {
return false;
}
}
const noop = () => {};
const LiveEditContext = createContext({
available: false,
enabled: false,
setEnabled: noop,
canEdit: () => false,
getValue: (entity, id, field, lang, original) => original,
setValue: noop,
resetValue: noop,
hasPending: () => false,
textOverride: () => undefined,
trackTextKey: noop,
usedTextKeys: () => [],
pendingCount: 0,
saving: false,
error: '',
save: async () => {},
discard: noop,
editor: null,
openEditor: noop,
closeEditor: noop,
});
export function LiveEditProvider({ serverOverrides, children }) {
const { user, hasPermission } = useAuth();
const available = !!user && Object.values(ENTITY_PERMISSIONS).some((p) => hasPermission(p));
const [enabledState, setEnabledState] = useState(readEnabled);
const enabled = available && enabledState;
const [pending, setPending] = useState({});
const [committed, setCommitted] = useState({});
const [saving, setSaving] = useState(false);
const [error, setError] = useState('');
const [editor, setEditor] = useState(null);
// Welche festen Texte (t('...')) auf welcher Seite gerendert wurden - fuer die Liste
// "Feste Texte" in der Bearbeiten-Leiste. Nur im Bearbeiten-Modus gesammelt; ein Ref statt
// State, weil t() waehrend des Renderns aufgerufen wird.
const enabledRef = useRef(enabled);
enabledRef.current = enabled;
const textKeys = useRef(new Map());
const setEnabled = useCallback((value) => {
setEnabledState(value);
try {
sessionStorage.setItem(STORAGE_KEY, value ? '1' : '0');
} catch {
// ohne sessionStorage bleibt der Modus eben nur bis zum Neuladen an
}
if (!value) setEditor(null);
}, []);
const canEdit = useCallback(
(entity) => enabled && !!ENTITY_PERMISSIONS[entity] && hasPermission(ENTITY_PERMISSIONS[entity]),
[enabled, hasPermission]
);
const getValue = useCallback(
(entity, id, field, lang, original) => {
const key = changeKey(entity, id, field, lang);
if (key in pending) return pending[key];
if (key in committed) return committed[key];
return original;
},
[pending, committed]
);
const setValue = useCallback((entity, id, field, lang, value) => {
setError('');
setPending((current) => ({ ...current, [changeKey(entity, id, field, lang)]: value }));
}, []);
const resetValue = useCallback((entity, id, field, lang) => {
setPending((current) => {
const key = changeKey(entity, id, field, lang);
if (!(key in current)) return current;
const next = { ...current };
delete next[key];
return next;
});
}, []);
const hasPending = useCallback((entity, id, field, lang) => changeKey(entity, id, field, lang) in pending, [pending]);
const overrides = serverOverrides || EMPTY_OVERRIDES;
const textOverride = useCallback(
(lang, key) => {
const k = changeKey('text', key, 'value', lang);
const value = k in pending ? pending[k] : k in committed ? committed[k] : overrides[lang]?.[key];
// Leer = auf den eingebauten Text zuruecksetzen.
return value ? value : undefined;
},
[pending, committed, overrides]
);
const trackTextKey = useCallback((key) => {
if (!enabledRef.current) return;
const path = window.location.pathname;
const paths = textKeys.current.get(key);
if (paths) paths.add(path);
else textKeys.current.set(key, new Set([path]));
}, []);
const usedTextKeys = useCallback((path) => {
const keys = [];
textKeys.current.forEach((paths, key) => {
if (paths.has(path)) keys.push(key);
});
return keys.sort();
}, []);
const pendingCount = Object.keys(pending).length;
const save = useCallback(async () => {
const entries = Object.entries(pending);
if (!entries.length) return;
const changes = entries.map(([key, value]) => {
const [entity, id, field, lang] = key.split('|');
return { entity, id, field, lang, value: value ?? '' };
});
setSaving(true);
setError('');
try {
await api.put('/live-edit', { changes });
setCommitted((current) => ({ ...current, ...pending }));
setPending({});
} catch (err) {
setError(err.status === 401 ? 'Deine Anmeldung ist abgelaufen. Bitte im Admin-Bereich neu anmelden, die Änderungen bleiben hier so lange erhalten.' : err.message);
} finally {
setSaving(false);
}
}, [pending]);
const discard = useCallback(() => {
setPending({});
setError('');
setEditor(null);
}, []);
const openEditor = useCallback((config) => setEditor(config), []);
const closeEditor = useCallback(() => setEditor(null), []);
// Browser warnt beim Schliessen/Neuladen, solange etwas ungespeichert ist.
useEffect(() => {
if (!pendingCount) return undefined;
const handler = (e) => {
e.preventDefault();
e.returnValue = '';
};
window.addEventListener('beforeunload', handler);
return () => window.removeEventListener('beforeunload', handler);
}, [pendingCount]);
const value = useMemo(
() => ({
available,
enabled,
setEnabled,
canEdit,
getValue,
setValue,
resetValue,
hasPending,
textOverride,
trackTextKey,
usedTextKeys,
pendingCount,
saving,
error,
save,
discard,
editor,
openEditor,
closeEditor,
}),
[available, enabled, setEnabled, canEdit, getValue, setValue, resetValue, hasPending, textOverride, trackTextKey, usedTextKeys, pendingCount, saving, error, save, discard, editor, openEditor, closeEditor]
);
return <LiveEditContext.Provider value={value}>{children}</LiveEditContext.Provider>;
}
export function useLiveEdit() {
return useContext(LiveEditContext);
}

View file

@ -319,3 +319,33 @@ html.hifi-cursor-on :is(input, textarea, [contenteditable='true']) {
padding: 0.1rem 0.3rem; padding: 0.1rem 0.3rem;
font-size: 0.85em; font-size: 0.85em;
} }
/* Live-Bearbeiten-Modus (components/live/Editable.jsx): gestrichelter Rahmen um alles, was sich
anklicken und aendern laesst; geaenderte, noch nicht gespeicherte Stellen in Bernstein. */
.live-editable {
outline: 1px dashed rgba(132, 204, 22, 0.75);
outline-offset: 3px;
border-radius: 2px;
cursor: text;
transition: outline-color 0.15s, background-color 0.15s;
}
.live-editable-block {
cursor: pointer;
}
.live-editable:hover {
outline: 2px dashed rgb(132, 204, 22);
background-color: rgba(132, 204, 22, 0.08);
}
.live-editable:focus {
outline: 2px solid rgb(132, 204, 22);
background-color: rgba(132, 204, 22, 0.1);
}
.live-editable-changed,
.live-editable-changed:hover {
outline-color: rgb(245, 158, 11);
}
.live-editable:empty::before {
content: attr(data-live-placeholder);
opacity: 0.5;
font-style: italic;
}

View file

@ -261,6 +261,17 @@ function QuickLinks({ hasPermission }) {
> >
Website ansehen ↗ Website ansehen ↗
</a> </a>
{/* Texte direkt auf der Seite aendern (Bearbeiten-Modus, siehe LiveEditContext). */}
{['content.manage', 'services.manage', 'packages.manage', 'gallery.manage', 'settings.manage'].some(hasPermission) && (
<a
href="/?bearbeiten=1"
target="_blank"
rel="noopener noreferrer"
className="rounded-md bg-brand-500 px-3 py-2 text-sm font-semibold text-white hover:bg-brand-600"
>
✎ Website live bearbeiten ↗
</a>
)}
</div> </div>
</section> </section>
); );

View file

@ -1,29 +1,5 @@
import { useEffect, useState } from 'react'; import LegalPageView from '../../components/LegalPageView.jsx';
import { api } from '../../api/client.js';
import usePageMeta from '../../hooks/usePageMeta.js';
export default function AGB() { export default function AGB() {
const [page, setPage] = useState(null); return <LegalPageView slug="agb" fallbackTitle="AGB" description="Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach." />;
useEffect(() => {
api.get('/legal-pages/agb').then(setPage).catch(() => {});
}, []);
usePageMeta({
title: page?.title || 'AGB',
description: 'Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach.',
path: '/agb',
});
if (!page) return null;
return (
<div className="mx-auto max-w-3xl px-4 py-12 sm:px-6">
<h1 className="mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{page.title}</h1>
<div
className="legal-content text-sm text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: page.body_html }}
/>
</div>
);
} }

View file

@ -10,6 +10,7 @@ import { fieldStyle, useTextStyle, useTextStylesMap } from '../../context/TextSt
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx'; import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
import errorMessage from '../../utils/errorMessage.js'; import errorMessage from '../../utils/errorMessage.js';
import NotFound from './NotFound.jsx'; import NotFound from './NotFound.jsx';
import { EditableText } from '../../components/live/Editable.jsx';
export default function BrandPage() { export default function BrandPage() {
const { brandSlug } = useParams(); const { brandSlug } = useParams();
@ -82,12 +83,15 @@ export default function BrandPage() {
className="h-full w-full object-cover transition duration-300 group-hover:scale-105" className="h-full w-full object-cover transition duration-300 group-hover:scale-105"
/> />
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" /> <div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" />
<span <EditableText
entity="car_models"
id={model.id}
field="name"
lang="de"
value={model.name}
className="absolute inset-x-0 bottom-0 p-4 text-center text-lg font-extrabold text-white" className="absolute inset-x-0 bottom-0 p-4 text-center text-lg font-extrabold text-white"
style={fieldStyle(textStyles, `car_models.${model.id}.name`)} style={fieldStyle(textStyles, `car_models.${model.id}.name`)}
> />
{model.name}
</span>
</Link> </Link>
) : ( ) : (
<Link <Link
@ -96,7 +100,7 @@ export default function BrandPage() {
style={tileSize} style={tileSize}
className="flex shrink-0 flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100" className="flex shrink-0 flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100"
> >
<span style={fieldStyle(textStyles, `car_models.${model.id}.name`)}>{model.name}</span> <EditableText entity="car_models" id={model.id} field="name" lang="de" value={model.name} style={fieldStyle(textStyles, `car_models.${model.id}.name`)} />
</Link> </Link>
) )
)} )}

View file

@ -1,29 +1,5 @@
import { useEffect, useState } from 'react'; import LegalPageView from '../../components/LegalPageView.jsx';
import { api } from '../../api/client.js';
import usePageMeta from '../../hooks/usePageMeta.js';
export default function Datenschutz() { export default function Datenschutz() {
const [page, setPage] = useState(null); return <LegalPageView slug="datenschutz" fallbackTitle="Datenschutzerklärung" description="Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO." />;
useEffect(() => {
api.get('/legal-pages/datenschutz').then(setPage).catch(() => {});
}, []);
usePageMeta({
title: page?.title || 'Datenschutzerklärung',
description: 'Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO.',
path: '/datenschutz',
});
if (!page) return null;
return (
<div className="mx-auto max-w-3xl px-4 py-12 sm:px-6">
<h1 className="mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{page.title}</h1>
<div
className="legal-content text-sm text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: page.body_html }}
/>
</div>
);
} }

View file

@ -7,6 +7,7 @@ import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js';
import errorMessage from '../../utils/errorMessage.js'; import errorMessage from '../../utils/errorMessage.js';
import NotFound from './NotFound.jsx'; import NotFound from './NotFound.jsx';
import { EditableText } from '../../components/live/Editable.jsx';
export default function GalleryBrandPage() { export default function GalleryBrandPage() {
const { brandSlug } = useParams(); const { brandSlug } = useParams();
@ -64,12 +65,15 @@ export default function GalleryBrandPage() {
<div className="flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800" /> <div className="flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800" />
)} )}
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" /> <div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" />
<span <EditableText
entity="gallery_projects"
id={project.id}
field="name"
lang="de"
value={project.name}
className="absolute whitespace-nowrap p-4 text-lg font-extrabold text-white" className="absolute whitespace-nowrap p-4 text-lg font-extrabold text-white"
style={dragAnchorStyle(cardTextX, cardTextY, { x: 0, y: 100 })} style={dragAnchorStyle(cardTextX, cardTextY, { x: 0, y: 100 })}
> />
{project.name}
</span>
</Link> </Link>
))} ))}
</div> </div>

View file

@ -6,6 +6,7 @@ import { useLanguage } from '../../context/LanguageContext.jsx';
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx'; import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js';
import errorMessage from '../../utils/errorMessage.js'; import errorMessage from '../../utils/errorMessage.js';
import { EditableText, EditableT } from '../../components/live/Editable.jsx';
export default function GalleryOverview() { export default function GalleryOverview() {
const [brands, setBrands] = useState(null); const [brands, setBrands] = useState(null);
@ -25,10 +26,8 @@ export default function GalleryOverview() {
return ( return (
<div className="mx-auto max-w-6xl px-4 py-12 sm:px-6"> <div className="mx-auto max-w-6xl px-4 py-12 sm:px-6">
<h1 className="mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{t('galleryOverview.title')}</h1> <EditableT k="galleryOverview.title" as="h1" className="mb-2 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl" />
<p className="mb-8 text-neutral-600 dark:text-neutral-300"> <EditableT k="galleryOverview.intro" as="p" className="mb-8 block text-neutral-600 dark:text-neutral-300" />
{t('galleryOverview.intro')}
</p>
{error && <p className="text-red-600">{typeof error === 'string' ? error : errorMessage(error, t)}</p>} {error && <p className="text-red-600">{typeof error === 'string' ? error : errorMessage(error, t)}</p>}
{!brands && !error && <p className="text-neutral-500 dark:text-neutral-400">{t('galleryOverview.loading')}</p>} {!brands && !error && <p className="text-neutral-500 dark:text-neutral-400">{t('galleryOverview.loading')}</p>}
@ -53,12 +52,15 @@ export default function GalleryOverview() {
<div className="flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800" /> <div className="flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800" />
)} )}
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" /> <div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" />
<span <EditableText
entity="gallery_brands"
id={brand.id}
field="name"
lang="de"
value={brand.name}
className="absolute whitespace-nowrap p-4 text-lg font-extrabold text-white" className="absolute whitespace-nowrap p-4 text-lg font-extrabold text-white"
style={dragAnchorStyle(cardTextX, cardTextY, { x: 0, y: 100 })} style={dragAnchorStyle(cardTextX, cardTextY, { x: 0, y: 100 })}
> />
{brand.name}
</span>
</Link> </Link>
))} ))}
</div> </div>

View file

@ -7,6 +7,7 @@ import Lightbox from '../../components/Lightbox.jsx';
import { useLanguage } from '../../context/LanguageContext.jsx'; import { useLanguage } from '../../context/LanguageContext.jsx';
import errorMessage from '../../utils/errorMessage.js'; import errorMessage from '../../utils/errorMessage.js';
import NotFound from './NotFound.jsx'; import NotFound from './NotFound.jsx';
import { EditableText, EditableT } from '../../components/live/Editable.jsx';
export default function GalleryProjectPage() { export default function GalleryProjectPage() {
const { brandSlug, projectSlug } = useParams(); const { brandSlug, projectSlug } = useParams();
@ -50,7 +51,7 @@ export default function GalleryProjectPage() {
<Link to="/galerie" className="hover:text-brand-500">{t('galleryProjectPage.breadcrumbGallery')}</Link> /{' '} <Link to="/galerie" className="hover:text-brand-500">{t('galleryProjectPage.breadcrumbGallery')}</Link> /{' '}
<Link to={`/galerie/${brandSlug}`} className="hover:text-brand-500">{data.project.brand_name}</Link> / {data.project.name} <Link to={`/galerie/${brandSlug}`} className="hover:text-brand-500">{data.project.brand_name}</Link> / {data.project.name}
</p> </p>
<h1 className="mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{data.project.name}</h1> <EditableText entity="gallery_projects" id={data.project.id} field="name" lang="de" value={data.project.name} as="h1" className="mb-8 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl" />
{data.photos.length === 0 && ( {data.photos.length === 0 && (
<p className="text-neutral-500 dark:text-neutral-400">{t('galleryProjectPage.empty')}</p> <p className="text-neutral-500 dark:text-neutral-400">{t('galleryProjectPage.empty')}</p>
@ -79,14 +80,14 @@ export default function GalleryProjectPage() {
{/* Wer hier einen Umbau sieht, der gefaellt, soll direkt anfragen koennen. */} {/* Wer hier einen Umbau sieht, der gefaellt, soll direkt anfragen koennen. */}
<div className="mt-12 flex flex-col items-start gap-4 rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 sm:flex-row sm:items-center sm:justify-between"> <div className="mt-12 flex flex-col items-start gap-4 rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 sm:flex-row sm:items-center sm:justify-between">
<div> <div>
<h2 className="text-lg font-bold text-neutral-900 dark:text-white">{t('galleryProjectPage.ctaTitle')}</h2> <EditableT k="galleryProjectPage.ctaTitle" as="h2" className="block text-lg font-bold text-neutral-900 dark:text-white" />
<p className="mt-1 text-sm text-neutral-600 dark:text-neutral-300">{t('galleryProjectPage.ctaText')}</p> <EditableT k="galleryProjectPage.ctaText" as="p" className="mt-1 block text-sm text-neutral-600 dark:text-neutral-300" />
</div> </div>
<Link <Link
to={`/kontakt?${new URLSearchParams({ topic: t('galleryProjectPage.ctaTopic')(data.project.name) }).toString()}`} to={`/kontakt?${new URLSearchParams({ topic: t('galleryProjectPage.ctaTopic')(data.project.name) }).toString()}`}
className="shrink-0 rounded-md bg-brand-500 px-5 py-3 text-sm font-semibold text-white shadow-sm hover:bg-brand-600" className="shrink-0 rounded-md bg-brand-500 px-5 py-3 text-sm font-semibold text-white shadow-sm hover:bg-brand-600"
> >
{t('galleryProjectPage.ctaButton')} <EditableT k="galleryProjectPage.ctaButton" />
</Link> </Link>
</div> </div>

View file

@ -12,6 +12,8 @@ import { isPathHidden } from '../../utils/siteAreas.js';
import { useTextStyle } from '../../context/TextStylesContext.jsx'; import { useTextStyle } from '../../context/TextStylesContext.jsx';
import { useLanguage } from '../../context/LanguageContext.jsx'; import { useLanguage } from '../../context/LanguageContext.jsx';
import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js'; import { dragAnchorStyle } from '../../utils/dragAnchorPosition.js';
import { useLiveEdit } from '../../context/LiveEditContext.jsx';
import { EditableArea, EditableHtml, EditableT, EditableText } from '../../components/live/Editable.jsx';
import defaultHeroImage from '../../assets/photos/gallery-dash2.webp'; import defaultHeroImage from '../../assets/photos/gallery-dash2.webp';
import galleryAmp from '../../assets/photos/gallery-amp-purple.webp'; import galleryAmp from '../../assets/photos/gallery-amp-purple.webp';
import gallerySpeaker from '../../assets/photos/gallery-speaker.webp'; import gallerySpeaker from '../../assets/photos/gallery-speaker.webp';
@ -40,8 +42,31 @@ const EMPTY_SECTION = {
/** 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 "/")
* bleiben in der SPA, alles andere oeffnet extern in einem neuen Tab. Zeigt das Ziel auf eine * bleiben in der SPA, alles andere oeffnet extern in einem neuen Tab. Zeigt das Ziel auf eine
* im Dashboard ausgeblendete Seite, entfaellt der Button (er wuerde nur zur Startseite fuehren). */ * im Dashboard ausgeblendete Seite, entfaellt der Button (er wuerde nur zur Startseite fuehren). */
function SectionButton({ label, url, className, style }) { function SectionButton({ slug, label, url, className, style }) {
const { hidden_areas: hiddenAreas } = useSiteSettings(); const { hidden_areas: hiddenAreas } = useSiteSettings();
const live = useLiveEdit();
// Im Bearbeiten-Modus immer sichtbar (auch ohne Text/Ziel), damit man ihn befuellen kann.
if (slug && live.canEdit('home_sections')) {
return (
<span className="inline-flex flex-wrap items-center justify-center gap-2">
<EditableText entity="home_sections" id={slug} field="button_label" value={label} className={className} style={style} placeholder="Button-Text (leer = kein Button)" />
<EditableArea
entity="home_sections"
id={slug}
field="button_url"
lang="de"
value={url}
kind="input"
label="Button-Ziel"
hint="Interne Seite mit / am Anfang (z. B. /leistungen) oder volle Adresse (https://...)."
as="span"
className="rounded bg-black/60 px-2 py-1 text-xs font-medium text-white"
>
Ziel: {url || '–'}
</EditableArea>
</span>
);
}
if (!label || !url) return null; if (!label || !url) return null;
if (isPathHidden(url, hiddenAreas)) return null; if (isPathHidden(url, hiddenAreas)) return null;
if (url.startsWith('/')) { if (url.startsWith('/')) {
@ -76,6 +101,8 @@ export default function Home() {
const heroImage = heroImagePath || defaultHeroImage; const heroImage = heroImagePath || defaultHeroImage;
const { t, language } = useLanguage(); const { t, language } = useLanguage();
const isHidden = useIsAreaHidden(); const isHidden = useIsAreaHidden();
const live = useLiveEdit();
const editing = live.canEdit('home_sections');
const showVehicles = !isHidden('page.vehicles'); const showVehicles = !isHidden('page.vehicles');
const stats = t('home.stats'); const stats = t('home.stats');
@ -92,15 +119,16 @@ export default function Home() {
const fallbackTitle = homeSectionsFailed ? { hero: t('home.heroTitle'), craft: t('home.craftTitle') }[slug] || '' : ''; const fallbackTitle = homeSectionsFailed ? { hero: t('home.heroTitle'), craft: t('home.craftTitle') }[slug] || '' : '';
const fallbackBody = homeSectionsFailed && slug === 'hero' ? `<p>${t('home.heroSubtitle')}</p>` : ''; const fallbackBody = homeSectionsFailed && slug === 'hero' ? `<p>${t('home.heroSubtitle')}</p>` : '';
return { return {
eyebrow: s[`eyebrow_${language}`] || '', // Inkl. noch nicht gespeicherter Live-Aenderungen (Bearbeiten-Modus).
title: s[`title_${language}`] || fallbackTitle, eyebrow: live.getValue('home_sections', slug, 'eyebrow', language, s[`eyebrow_${language}`] || ''),
bodyHtml: s[`body_html_${language}`] || fallbackBody, title: live.getValue('home_sections', slug, 'title', language, s[`title_${language}`] || fallbackTitle),
bodyHtml: live.getValue('home_sections', slug, 'body_html', language, s[`body_html_${language}`] || fallbackBody),
align: s.text_align || 'center', align: s.text_align || 'center',
// Nur fuer hero/youtube genutzt (echter Hintergrund) - siehe dragAnchorStyle-Aufrufe unten. // Nur fuer hero/youtube genutzt (echter Hintergrund) - siehe dragAnchorStyle-Aufrufe unten.
alignX: s.text_align_x, alignX: s.text_align_x,
alignY: s.text_align_y, alignY: s.text_align_y,
buttonLabel: s[`button_label_${language}`] || '', buttonLabel: live.getValue('home_sections', slug, 'button_label', language, s[`button_label_${language}`] || ''),
buttonUrl: s.button_url || '', buttonUrl: live.getValue('home_sections', slug, 'button_url', 'de', s.button_url || ''),
fontFamily: s.font_family || undefined, fontFamily: s.font_family || undefined,
}; };
}; };
@ -148,6 +176,7 @@ export default function Home() {
.then((rows) => { .then((rows) => {
setFaqs( setFaqs(
rows.map((f) => ({ rows.map((f) => ({
id: f.id,
question: language === 'de' ? f.question_de : f.question_en, question: language === 'de' ? f.question_de : f.question_en,
answer: language === 'de' ? f.answer_de : f.answer_en, answer: language === 'de' ? f.answer_de : f.answer_en,
})) }))
@ -246,23 +275,21 @@ export default function Home() {
className="fixed inset-x-0 bottom-0 z-20 border-t border-neutral-200 bg-white/95 px-4 py-3 shadow-[0_-8px_24px_rgba(0,0,0,0.08)] backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:px-6" className="fixed inset-x-0 bottom-0 z-20 border-t border-neutral-200 bg-white/95 px-4 py-3 shadow-[0_-8px_24px_rgba(0,0,0,0.08)] backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:px-6"
> >
<div className="mx-auto flex max-w-6xl items-center justify-between gap-3"> <div className="mx-auto flex max-w-6xl items-center justify-between gap-3">
<p className="hidden text-sm font-medium text-neutral-600 dark:text-neutral-300 sm:block"> <EditableT k="home.stickyCta" as="p" className="hidden text-sm font-medium text-neutral-600 dark:text-neutral-300 sm:block" />
{t('home.stickyCta')}
</p>
<div className="flex w-full gap-3 sm:w-auto"> <div className="flex w-full gap-3 sm:w-auto">
{showVehicles && ( {showVehicles && (
<Link <Link
to="/fahrzeuge" to="/fahrzeuge"
className="flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none" className="flex-1 rounded-md bg-brand-500 px-5 py-2.5 text-center text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 sm:flex-none"
> >
{t('home.selectVehicle')} <EditableT k="home.selectVehicle" />
</Link> </Link>
)} )}
<Link <Link
to="/kontakt" to="/kontakt"
className="flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none" className="flex-1 rounded-md border border-neutral-300 px-5 py-2.5 text-center text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800 sm:flex-none"
> >
{t('home.getInTouch')} <EditableT k="home.getInTouch" />
</Link> </Link>
</div> </div>
</div> </div>
@ -297,32 +324,25 @@ export default function Home() {
animate={{ opacity: 1, y: 0 }} animate={{ opacity: 1, y: 0 }}
transition={{ duration: 0.7, ease: 'easeOut' }} transition={{ duration: 0.7, ease: 'easeOut' }}
> >
{section('hero').eyebrow && ( {(section('hero').eyebrow || editing) && (
<p className="mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400" style={heroEyebrowStyle}> <EditableText entity="home_sections" id="hero" field="eyebrow" value={section('hero').eyebrow} as="p" className="mb-3 text-sm font-semibold uppercase tracking-wide text-brand-400" style={heroEyebrowStyle} placeholder="Vorspann (optional)" />
{section('hero').eyebrow}
</p>
)} )}
<h1 className="text-3xl font-extrabold tracking-tight text-white sm:text-5xl" style={heroTitleStyle}> <EditableText entity="home_sections" id="hero" field="title" value={section('hero').title} as="h1" className="text-3xl font-extrabold tracking-tight text-white sm:text-5xl" style={heroTitleStyle} placeholder="Überschrift" />
{section('hero').title} <EditableHtml entity="home_sections" id="hero" field="body_html" value={section('hero').bodyHtml} label="Text" className="legal-content mx-auto mt-4 max-w-2xl text-base text-neutral-200 sm:text-lg" />
</h1>
<div
className="legal-content mx-auto mt-4 max-w-2xl text-base text-neutral-200 sm:text-lg"
dangerouslySetInnerHTML={{ __html: section('hero').bodyHtml }}
/>
<div className="mt-8 flex flex-wrap items-center justify-center gap-3"> <div className="mt-8 flex flex-wrap items-center justify-center gap-3">
{showVehicles && ( {showVehicles && (
<Link <Link
to="/fahrzeuge" to="/fahrzeuge"
className="rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg" className="rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white shadow-sm transition hover:-translate-y-0.5 hover:bg-brand-600 hover:shadow-lg"
> >
{t('home.selectVehicle')} <EditableT k="home.selectVehicle" />
</Link> </Link>
)} )}
<Link <Link
to="/kontakt" to="/kontakt"
className="rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20" className="rounded-md border border-white/30 bg-white/10 px-6 py-3 text-sm font-semibold text-white backdrop-blur transition hover:-translate-y-0.5 hover:bg-white/20"
> >
{t('home.getInTouch')} <EditableT k="home.getInTouch" />
</Link> </Link>
</div> </div>
</motion.div> </motion.div>
@ -346,16 +366,14 @@ export default function Home() {
{!isHidden('home.partners') && ( {!isHidden('home.partners') && (
<section className="border-b border-neutral-200 py-8 dark:border-neutral-800"> <section className="border-b border-neutral-200 py-8 dark:border-neutral-800">
<div className="mx-auto max-w-6xl px-4 sm:px-6"> <div className="mx-auto max-w-6xl px-4 sm:px-6">
<p className="mb-4 text-center text-xs font-semibold uppercase tracking-wide text-neutral-400"> <EditableT k="home.brandsHeading" as="p" className="mb-4 block text-center text-xs font-semibold uppercase tracking-wide text-neutral-400" />
{t('home.brandsHeading')}
</p>
<div className="flex flex-wrap items-center justify-center gap-x-8 gap-y-3"> <div className="flex flex-wrap items-center justify-center gap-x-8 gap-y-3">
{partners.map((partner, i) => ( {partners.map((partner, i) => (
<Reveal key={partner.id} index={i}> <Reveal key={partner.id} index={i}>
{partner.logo_path ? ( {partner.logo_path ? (
<img src={partner.logo_path} alt={partner.name} className="h-8 max-w-[8rem] object-contain opacity-70 grayscale transition hover:opacity-100 hover:grayscale-0" /> <img src={partner.logo_path} alt={partner.name} className="h-8 max-w-[8rem] object-contain opacity-70 grayscale transition hover:opacity-100 hover:grayscale-0" />
) : ( ) : (
<span className="text-lg font-bold text-neutral-400 dark:text-neutral-600">{partner.name}</span> <EditableText entity="partners" id={partner.id} field="name" lang="de" value={partner.name} className="text-lg font-bold text-neutral-400 dark:text-neutral-600" />
)} )}
</Reveal> </Reveal>
))} ))}
@ -385,19 +403,13 @@ export default function Home() {
}} }}
> >
<Reveal> <Reveal>
{section('youtube').eyebrow && ( {(section('youtube').eyebrow || editing) && (
<p className="mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm" style={youtubeEyebrowStyle}> <EditableText entity="home_sections" id="youtube" field="eyebrow" value={section('youtube').eyebrow} as="p" className="mb-4 text-xs font-semibold uppercase tracking-[0.2em] text-neutral-200 sm:text-sm" style={youtubeEyebrowStyle} placeholder="Vorspann (optional)" />
{section('youtube').eyebrow}
</p>
)} )}
<h2 className="text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl" style={youtubeTitleStyle}> <EditableText entity="home_sections" id="youtube" field="title" value={section('youtube').title} as="h2" className="text-3xl font-bold uppercase tracking-wide text-white sm:text-5xl" style={youtubeTitleStyle} placeholder="Überschrift" />
{section('youtube').title} <EditableHtml entity="home_sections" id="youtube" field="body_html" value={section('youtube').bodyHtml} label="Text" className="legal-content mt-4 text-xs font-semibold uppercase tracking-wide text-neutral-200 sm:text-sm" />
</h2>
<div
className="legal-content mt-4 text-xs font-semibold uppercase tracking-wide text-neutral-200 sm:text-sm"
dangerouslySetInnerHTML={{ __html: section('youtube').bodyHtml }}
/>
<SectionButton <SectionButton
slug="youtube"
label={section('youtube').buttonLabel} label={section('youtube').buttonLabel}
url={section('youtube').buttonUrl} url={section('youtube').buttonUrl}
className="mt-8 inline-flex items-center justify-center rounded-full bg-white px-8 py-3 text-xs font-bold uppercase tracking-wide text-neutral-900 transition hover:-translate-y-0.5 hover:bg-neutral-100" className="mt-8 inline-flex items-center justify-center rounded-full bg-white px-8 py-3 text-xs font-bold uppercase tracking-wide text-neutral-900 transition hover:-translate-y-0.5 hover:bg-neutral-100"
@ -423,27 +435,21 @@ export default function Home() {
/> />
</Reveal> </Reveal>
<Reveal direction="right" index={1} className={ALIGN_TEXT[section('craft').align]} style={{ fontFamily: section('craft').fontFamily }}> <Reveal direction="right" index={1} className={ALIGN_TEXT[section('craft').align]} style={{ fontFamily: section('craft').fontFamily }}>
{section('craft').eyebrow && ( {(section('craft').eyebrow || editing) && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={craftEyebrowStyle}>{section('craft').eyebrow}</p> <EditableText entity="home_sections" id="craft" field="eyebrow" value={section('craft').eyebrow} as="p" className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={craftEyebrowStyle} placeholder="Vorspann (optional)" />
)} )}
<h2 className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={craftTitleStyle}>{section('craft').title}</h2> <EditableText entity="home_sections" id="craft" field="title" value={section('craft').title} as="h2" className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={craftTitleStyle} placeholder="Überschrift" />
<div <EditableHtml entity="home_sections" id="craft" field="body_html" value={section('craft').bodyHtml} label="Text" className="legal-content text-neutral-600 dark:text-neutral-300" />
className="legal-content text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: section('craft').bodyHtml }}
/>
</Reveal> </Reveal>
</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]}`} style={{ fontFamily: section('advice').fontFamily }}> <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 || editing) && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={adviceEyebrowStyle}>{section('advice').eyebrow}</p> <EditableText entity="home_sections" id="advice" field="eyebrow" value={section('advice').eyebrow} as="p" className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={adviceEyebrowStyle} placeholder="Vorspann (optional)" />
)} )}
<h2 className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={adviceTitleStyle}>{section('advice').title}</h2> <EditableText entity="home_sections" id="advice" field="title" value={section('advice').title} as="h2" className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={adviceTitleStyle} placeholder="Überschrift" />
<div <EditableHtml entity="home_sections" id="advice" field="body_html" value={section('advice').bodyHtml} label="Text" className="legal-content text-neutral-600 dark:text-neutral-300" />
className="legal-content text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: section('advice').bodyHtml }}
/>
</Reveal> </Reveal>
<Reveal direction="right" index={1} shine className="order-1 md:order-2 rounded-xl shadow-lg"> <Reveal direction="right" index={1} shine className="order-1 md:order-2 rounded-xl shadow-lg">
<img <img
@ -463,14 +469,11 @@ export default function Home() {
{!isHidden('home.insights') && ( {!isHidden('home.insights') && (
<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]}`} style={{ fontFamily: section('insights').fontFamily }}> <Reveal className={`mb-8 ${ALIGN_TEXT[section('insights').align]}`} style={{ fontFamily: section('insights').fontFamily }}>
{section('insights').eyebrow && ( {(section('insights').eyebrow || editing) && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={insightsEyebrowStyle}>{section('insights').eyebrow}</p> <EditableText entity="home_sections" id="insights" field="eyebrow" value={section('insights').eyebrow} as="p" className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={insightsEyebrowStyle} placeholder="Vorspann (optional)" />
)} )}
<h2 className="text-2xl font-bold text-neutral-900 dark:text-white" style={insightsTitleStyle}>{section('insights').title}</h2> <EditableText entity="home_sections" id="insights" field="title" value={section('insights').title} as="h2" className="text-2xl font-bold text-neutral-900 dark:text-white" style={insightsTitleStyle} placeholder="Überschrift" />
<div <EditableHtml entity="home_sections" id="insights" field="body_html" value={section('insights').bodyHtml} label="Text" className="legal-content mt-2 text-neutral-600 dark:text-neutral-300" />
className="legal-content mt-2 text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: section('insights').bodyHtml }}
/>
</Reveal> </Reveal>
<div className="grid grid-cols-2 gap-3 sm:grid-cols-3"> <div className="grid grid-cols-2 gap-3 sm:grid-cols-3">
{gallery.map((img, i) => ( {gallery.map((img, i) => (
@ -499,14 +502,14 @@ export default function Home() {
<h2 className="text-2xl font-bold text-neutral-900 dark:text-white"> <h2 className="text-2xl font-bold text-neutral-900 dark:text-white">
{googleReviews ? t('home.reviewsRatingDynamic')(googleReviews.rating, googleReviews.rating_count) : t('home.reviewsRating')} {googleReviews ? t('home.reviewsRatingDynamic')(googleReviews.rating, googleReviews.rating_count) : t('home.reviewsRating')}
</h2> </h2>
<p className="mt-1 text-neutral-600 dark:text-neutral-300">{t('home.reviewsText')}</p> <EditableT k="home.reviewsText" as="p" className="mt-1 text-neutral-600 dark:text-neutral-300" />
<a <a
href="https://www.google.com/maps/search/?api=1&query=Hifi+Planet+Amorbach+Boxbrunner+Stra%C3%9Fe+20a" href="https://www.google.com/maps/search/?api=1&query=Hifi+Planet+Amorbach+Boxbrunner+Stra%C3%9Fe+20a"
target="_blank" target="_blank"
rel="noopener noreferrer" rel="noopener noreferrer"
className="mt-2 inline-block text-sm font-medium text-brand-600 hover:underline dark:text-brand-400" className="mt-2 inline-block text-sm font-medium text-brand-600 hover:underline dark:text-brand-400"
> >
{t('home.reviewsLink')} <EditableT k="home.reviewsLink" />
</a> </a>
</Reveal> </Reveal>
<Reveal> <Reveal>
@ -535,15 +538,13 @@ export default function Home() {
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 }} style={{ fontFamily: section('more').fontFamily }}
> >
{section('more').eyebrow && ( {(section('more').eyebrow || editing) && (
<p className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={moreEyebrowStyle}>{section('more').eyebrow}</p> <EditableText entity="home_sections" id="more" field="eyebrow" value={section('more').eyebrow} as="p" className="mb-2 text-sm font-semibold uppercase tracking-wide text-brand-600 dark:text-brand-400" style={moreEyebrowStyle} placeholder="Vorspann (optional)" />
)} )}
<h2 className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={moreTitleStyle}>{section('more').title}</h2> <EditableText entity="home_sections" id="more" field="title" value={section('more').title} as="h2" className="mb-3 text-2xl font-bold text-neutral-900 dark:text-white" style={moreTitleStyle} placeholder="Überschrift" />
<div <EditableHtml entity="home_sections" id="more" field="body_html" value={section('more').bodyHtml} label="Text" className={`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${ALIGN_MARGIN_X[section('more').align]}`} />
className={`legal-content mb-8 max-w-2xl text-neutral-600 dark:text-neutral-300 ${ALIGN_MARGIN_X[section('more').align]}`}
dangerouslySetInnerHTML={{ __html: section('more').bodyHtml }}
/>
<SectionButton <SectionButton
slug="more"
label={section('more').buttonLabel} label={section('more').buttonLabel}
url={section('more').buttonUrl} url={section('more').buttonUrl}
className="inline-block rounded-md border border-neutral-300 px-6 py-3 text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800" className="inline-block rounded-md border border-neutral-300 px-6 py-3 text-sm font-semibold text-neutral-700 transition hover:-translate-y-0.5 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-200 dark:hover:bg-neutral-800"
@ -558,7 +559,7 @@ export default function Home() {
<section id="faq" className="scroll-mt-20 border-t border-neutral-300 py-16 dark:border-neutral-700"> <section id="faq" className="scroll-mt-20 border-t border-neutral-300 py-16 dark:border-neutral-700">
<div className="mx-auto max-w-3xl px-4 sm:px-6"> <div className="mx-auto max-w-3xl px-4 sm:px-6">
<Reveal className="mb-8 text-center"> <Reveal className="mb-8 text-center">
<h2 className="text-2xl font-bold text-neutral-900 dark:text-white">{t('home.faqHeading')}</h2> <EditableT k="home.faqHeading" as="h2" className="text-2xl font-bold text-neutral-900 dark:text-white" />
</Reveal> </Reveal>
<Reveal index={1}> <Reveal index={1}>
<Accordion items={faqs} /> <Accordion items={faqs} />

View file

@ -1,29 +1,5 @@
import { useEffect, useState } from 'react'; import LegalPageView from '../../components/LegalPageView.jsx';
import { api } from '../../api/client.js';
import usePageMeta from '../../hooks/usePageMeta.js';
export default function Impressum() { export default function Impressum() {
const [page, setPage] = useState(null); return <LegalPageView slug="impressum" fallbackTitle="Impressum" description="Impressum von HifiPlanet Amorbach gemäß § 5 DDG." />;
useEffect(() => {
api.get('/legal-pages/impressum').then(setPage).catch(() => {});
}, []);
usePageMeta({
title: page?.title || 'Impressum',
description: 'Impressum von HifiPlanet Amorbach gemäß § 5 DDG.',
path: '/impressum',
});
if (!page) return null;
return (
<div className="mx-auto max-w-3xl px-4 py-12 sm:px-6">
<h1 className="mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{page.title}</h1>
<div
className="legal-content text-sm text-neutral-600 dark:text-neutral-300"
dangerouslySetInnerHTML={{ __html: page.body_html }}
/>
</div>
);
} }

View file

@ -9,11 +9,14 @@ import { useMaintenance } from '../../context/MaintenanceContext.jsx';
import { useLanguage } from '../../context/LanguageContext.jsx'; import { useLanguage } from '../../context/LanguageContext.jsx';
import { api } from '../../api/client.js'; import { api } from '../../api/client.js';
import localized from '../../utils/localized.js'; import localized from '../../utils/localized.js';
import { EditableText, EditableT } from '../../components/live/Editable.jsx';
import { useLiveEdit } from '../../context/LiveEditContext.jsx';
export default function Leistungen() { export default function Leistungen() {
const [services, setServices] = useState([]); const [services, setServices] = useState([]);
const maintenance = useMaintenance(); const maintenance = useMaintenance();
const { t, language } = useLanguage(); const { t, language } = useLanguage();
const live = useLiveEdit();
useEffect(() => { useEffect(() => {
api.get('/services').then(setServices).catch(() => setServices([])); api.get('/services').then(setServices).catch(() => setServices([]));
@ -32,10 +35,8 @@ export default function Leistungen() {
return ( return (
<div className="mx-auto max-w-6xl px-4 py-12 sm:px-6"> <div className="mx-auto max-w-6xl px-4 py-12 sm:px-6">
{maintenance.services.enabled && maintenance.bypass && <MaintenanceBypassBanner inline />} {maintenance.services.enabled && maintenance.bypass && <MaintenanceBypassBanner inline />}
<h1 className="mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{t('leistungen.title')}</h1> <EditableT k="leistungen.title" as="h1" className="mb-2 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl" />
<p className="mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300"> <EditableT k="leistungen.intro" as="p" className="mb-10 block max-w-2xl text-neutral-600 dark:text-neutral-300" />
{t('leistungen.intro')}
</p>
<div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3"> <div className="grid gap-5 sm:grid-cols-2 lg:grid-cols-3">
{services.map((raw) => ({ {services.map((raw) => ({
@ -59,15 +60,20 @@ export default function Leistungen() {
</div> </div>
</div> </div>
<div className="p-6 pt-8"> <div className="p-6 pt-8">
<h2 className="mb-2 font-semibold text-neutral-900 dark:text-white">{service.title}</h2> <EditableText entity="services" id={service.id} field="title" value={service.title} as="h2" className="mb-2 block font-semibold text-neutral-900 dark:text-white" />
<p className="mb-3 text-sm text-neutral-600 dark:text-neutral-300">{service.description}</p> <EditableText entity="services" id={service.id} field="description" value={service.description} as="p" multiline className="mb-3 block text-sm text-neutral-600 dark:text-neutral-300" />
{/* Karten ohne eigenen CTA (alles ausser Car-Hifi, das auf /fahrzeuge zeigt) {/* Karten ohne eigenen CTA (alles ausser Car-Hifi, das auf /fahrzeuge zeigt)
landen auf dem Kontaktformular statt ins Leere zu laufen. */} landen auf dem Kontaktformular statt ins Leere zu laufen. */}
<Link <Link
to={service.cta_url || '/kontakt'} to={service.cta_url || '/kontakt'}
className="text-sm font-semibold text-brand-600 hover:underline dark:text-brand-400" className="text-sm font-semibold text-brand-600 hover:underline dark:text-brand-400"
> >
{service.cta_label || t('leistungen.contact')} → {live.canEdit('services') || service.cta_label ? (
<EditableText entity="services" id={service.id} field="cta_label" value={service.cta_label} placeholder={t('leistungen.contact')} />
) : (
t('leistungen.contact')
)}{' '}
→
</Link> </Link>
</div> </div>
</Reveal> </Reveal>
@ -75,10 +81,10 @@ export default function Leistungen() {
</div> </div>
<div className="mt-12 rounded-xl border border-neutral-200 bg-neutral-50 p-8 text-center dark:border-neutral-800 dark:bg-neutral-900/40"> <div className="mt-12 rounded-xl border border-neutral-200 bg-neutral-50 p-8 text-center dark:border-neutral-800 dark:bg-neutral-900/40">
<h2 className="mb-2 text-xl font-bold text-neutral-900 dark:text-white">{t('leistungen.notListedTitle')}</h2> <EditableT k="leistungen.notListedTitle" as="h2" className="mb-2 block text-xl font-bold text-neutral-900 dark:text-white" />
<p className="mb-5 text-neutral-600 dark:text-neutral-300">{t('leistungen.notListedText')}</p> <EditableT k="leistungen.notListedText" as="p" className="mb-5 block text-neutral-600 dark:text-neutral-300" />
<Link to="/kontakt" className="inline-block rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white hover:bg-brand-600"> <Link to="/kontakt" className="inline-block rounded-md bg-brand-500 px-6 py-3 text-sm font-semibold text-white hover:bg-brand-600">
{t('leistungen.contact')} <EditableT k="leistungen.contact" />
</Link> </Link>
</div> </div>
</div> </div>

View file

@ -41,6 +41,8 @@ import localized from '../../utils/localized.js';
import NotFound from './NotFound.jsx'; import NotFound from './NotFound.jsx';
import { telHref, waHref } from '../../utils/contactLinks.js'; import { telHref, waHref } from '../../utils/contactLinks.js';
import { trackEvent } from '../../utils/analytics.js'; import { trackEvent } from '../../utils/analytics.js';
import { useLiveEdit } from '../../context/LiveEditContext.jsx';
import { EditableArea, EditableText } from '../../components/live/Editable.jsx';
const hslToRgb = (h, s, l) => { const hslToRgb = (h, s, l) => {
s /= 100; s /= 100;
@ -130,6 +132,7 @@ const BADGE_STYLES = {
function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUrl, priceNote, t }) { function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUrl, priceNote, t }) {
const [expanded, setExpanded] = useState(false); const [expanded, setExpanded] = useState(false);
const editing = useLiveEdit().canEdit('packages');
const [truncated, setTruncated] = useState(false); const [truncated, setTruncated] = useState(false);
const listRef = useRef(null); const listRef = useRef(null);
const hiddenCount = bullets.length - VISIBLE_BULLETS; const hiddenCount = bullets.length - VISIBLE_BULLETS;
@ -246,7 +249,7 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
lineHeight: 1.1, lineHeight: 1.1,
}} }}
> >
{pkg.name} <EditableText entity="packages" id={pkg.id} field="name" lang="de" value={pkg.name} placeholder="Paketname" />
</div> </div>
<div <div
style={{ style={{
@ -271,6 +274,14 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
? 'linear-gradient(180deg, rgba(8,8,8,0.7) 0%, rgba(8,8,8,0.62) 94%, rgba(8,8,8,0) 100%)' ? 'linear-gradient(180deg, rgba(8,8,8,0.7) 0%, rgba(8,8,8,0.62) 94%, rgba(8,8,8,0) 100%)'
: 'linear-gradient(180deg, rgba(8,8,8,0.55) 0%, rgba(8,8,8,0.48) 92%, rgba(8,8,8,0) 100%)', : 'linear-gradient(180deg, rgba(8,8,8,0.55) 0%, rgba(8,8,8,0.48) 92%, rgba(8,8,8,0) 100%)',
}} }}
>
<EditableArea
entity="packages"
id={pkg.id}
field="description"
value={pkg.description}
label="Zusätzliche Stichpunkte"
hint="Eine Zeile = ein Stichpunkt (unter den Produkten). **fett** wird fett dargestellt. Die Produkte selbst pflegst du im Admin unter Pakete."
> >
<ul ref={listRef} className="space-y-1.5 text-left"> <ul ref={listRef} className="space-y-1.5 text-left">
{shownBullets.map((line, i) => ( {shownBullets.map((line, i) => (
@ -294,6 +305,7 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
</li> </li>
))} ))}
</ul> </ul>
</EditableArea>
{(expanded || hiddenCount > 0 || truncated) && ( {(expanded || hiddenCount > 0 || truncated) && (
<button <button
type="button" type="button"
@ -312,6 +324,21 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
</div> </div>
)} )}
{bullets.length === 0 && editing && (
<EditableArea
entity="packages"
id={pkg.id}
field="description"
value={pkg.description}
label="Zusätzliche Stichpunkte"
hint="Eine Zeile = ein Stichpunkt. **fett** wird fett dargestellt."
className="relative z-10 mx-5 mt-4 text-center text-xs"
style={{ gridRow: 2, color: BULLET_COLOR }}
>
+ Stichpunkte hinzufügen
</EditableArea>
)}
{/* Freiraum, damit das Straßenbild zur Geltung kommt. */} {/* Freiraum, damit das Straßenbild zur Geltung kommt. */}
<div className="relative z-10 flex-1" style={{ gridRow: 3 }} /> <div className="relative z-10 flex-1" style={{ gridRow: 3 }} />
@ -338,7 +365,18 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
...(pkg.price_text ? priceTextStyle : null), ...(pkg.price_text ? priceTextStyle : null),
}} }}
> >
{pkg.price_text || formatPrice(pkg.total_price)} {editing ? (
<EditableText
entity="packages"
id={pkg.id}
field="price_text"
value={pkg.price_text}
placeholder={formatPrice(pkg.total_price)}
title="Leer lassen = Preis automatisch aus den Produkten"
/>
) : (
pkg.price_text || formatPrice(pkg.total_price)
)}
</div> </div>
{/* Hinweis aus Admin -> Firmendaten (z. B. "inkl. MwSt. und Einbau"). */} {/* Hinweis aus Admin -> Firmendaten (z. B. "inkl. MwSt. und Einbau"). */}
{!pkg.price_text && priceNote && ( {!pkg.price_text && priceNote && (
@ -378,6 +416,7 @@ export default function ModelPage() {
const [error, setError] = useState(null); const [error, setError] = useState(null);
const maintenance = useMaintenance(); const maintenance = useMaintenance();
const { t, language } = useLanguage(); const { t, language } = useLanguage();
const live = useLiveEdit();
const { const {
package_card_theme: packageCardTheme, package_card_theme: packageCardTheme,
package_card_layout: packageCardLayout, package_card_layout: packageCardLayout,
@ -688,11 +727,13 @@ export default function ModelPage() {
const { model } = data; const { model } = data;
// Englische Fassungen (falls im Admin gepflegt) ersetzen die deutschen Texte. // Englische Fassungen (falls im Admin gepflegt) ersetzen die deutschen Texte.
// Dazu noch nicht gespeicherte Aenderungen aus dem Live-Bearbeiten-Modus.
const packages = data.packages.map((p) => ({ const packages = data.packages.map((p) => ({
...p, ...p,
description: localized(p, 'description', language), name: live.getValue('packages', p.id, 'name', 'de', p.name),
description: live.getValue('packages', p.id, 'description', language, localized(p, 'description', language)),
tagline: localized(p, 'tagline', language), tagline: localized(p, 'tagline', language),
price_text: localized(p, 'price_text', language), price_text: live.getValue('packages', p.id, 'price_text', language, localized(p, 'price_text', language)),
})); }));
// Preis-Rang innerhalb dieses Modells waehlt die Referenz-Stufe: die guenstigste Option // Preis-Rang innerhalb dieses Modells waehlt die Referenz-Stufe: die guenstigste Option
@ -752,7 +793,8 @@ export default function ModelPage() {
<Link to={`/fahrzeuge/${brandSlug}`} className="hover:text-brand-500">{model.brand_name}</Link> / <span style={modelNameStyle}>{model.name}</span> <Link to={`/fahrzeuge/${brandSlug}`} className="hover:text-brand-500">{model.brand_name}</Link> / <span style={modelNameStyle}>{model.name}</span>
</p> </p>
<h1 className={`text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl ${packages.length ? 'mb-2' : 'mb-8'}`}> <h1 className={`text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl ${packages.length ? 'mb-2' : 'mb-8'}`}>
{model.brand_name} <span style={modelNameStyle}>{model.name}</span> – {t('modelPage.titleSuffix')} {model.brand_name}{' '}
<EditableText entity="car_models" id={model.id} field="name" lang="de" value={model.name} style={modelNameStyle} /> – {t('modelPage.titleSuffix')}
</h1> </h1>
{packages.length === 0 && ( {packages.length === 0 && (

View file

@ -9,6 +9,7 @@ import { useLanguage } from '../../context/LanguageContext.jsx';
import { fieldStyle, useTextStylesMap } from '../../context/TextStylesContext.jsx'; import { fieldStyle, useTextStylesMap } from '../../context/TextStylesContext.jsx';
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx'; import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
import errorMessage from '../../utils/errorMessage.js'; import errorMessage from '../../utils/errorMessage.js';
import { EditableText, EditableT } from '../../components/live/Editable.jsx';
export default function VehicleSelect() { export default function VehicleSelect() {
const [brands, setBrands] = useState(null); const [brands, setBrands] = useState(null);
@ -37,10 +38,8 @@ export default function VehicleSelect() {
return ( return (
<div className="mx-auto max-w-6xl px-4 py-12 sm:px-6"> <div className="mx-auto max-w-6xl px-4 py-12 sm:px-6">
{maintenance.vehicles.enabled && maintenance.bypass && <MaintenanceBypassBanner inline />} {maintenance.vehicles.enabled && maintenance.bypass && <MaintenanceBypassBanner inline />}
<h1 className="mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl">{t('vehicleSelect.title')}</h1> <EditableT k="vehicleSelect.title" as="h1" className="mb-2 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl" />
<p className="mb-8 text-neutral-600 dark:text-neutral-300"> <EditableT k="vehicleSelect.intro" as="p" className="mb-8 block text-neutral-600 dark:text-neutral-300" />
{t('vehicleSelect.intro')}
</p>
{error && <p className="text-red-600">{typeof error === 'string' ? error : errorMessage(error, t)}</p>} {error && <p className="text-red-600">{typeof error === 'string' ? error : errorMessage(error, t)}</p>}
@ -76,12 +75,15 @@ export default function VehicleSelect() {
className="h-full w-full object-cover transition duration-300 group-hover:scale-105" className="h-full w-full object-cover transition duration-300 group-hover:scale-105"
/> />
<div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" /> <div className="absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95" />
<span <EditableText
entity="brands"
id={brand.id}
field="name"
lang="de"
value={brand.name}
className="absolute inset-x-0 bottom-0 p-4 text-center text-lg font-extrabold text-white" className="absolute inset-x-0 bottom-0 p-4 text-center text-lg font-extrabold text-white"
style={fieldStyle(textStyles, `brands.${brand.id}.name`)} style={fieldStyle(textStyles, `brands.${brand.id}.name`)}
> />
{brand.name}
</span>
</Link> </Link>
) : ( ) : (
<Link <Link
@ -90,7 +92,7 @@ export default function VehicleSelect() {
style={tileSize} style={tileSize}
className="flex shrink-0 flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100" className="flex shrink-0 flex-col items-center justify-center gap-3 rounded-xl border border-neutral-200 bg-white px-6 text-center font-semibold text-neutral-800 shadow-sm transition hover:-translate-y-0.5 hover:border-brand-500 hover:shadow-md dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-100"
> >
<span style={fieldStyle(textStyles, `brands.${brand.id}.name`)}>{brand.name}</span> <EditableText entity="brands" id={brand.id} field="name" lang="de" value={brand.name} style={fieldStyle(textStyles, `brands.${brand.id}.name`)} />
</Link> </Link>
) )
)} )}

View file

@ -0,0 +1,10 @@
-- Live-Bearbeiten-Modus: Ueberschreibungen fuer feste Texte (Buttons, Menue, Beschriftungen).
-- Wird beim ersten Aufruf nach dem Update automatisch angelegt (Schema.php) - diese Datei nur
-- fuer manuelles Nachruesten.
CREATE TABLE IF NOT EXISTS text_overrides (
lang CHAR(2) NOT NULL,
text_key VARCHAR(190) NOT NULL,
value TEXT NOT NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (lang, text_key)
) ENGINE=InnoDB;

View file

@ -324,3 +324,12 @@ CREATE TABLE content_translations (
value TEXT NOT NULL, value TEXT NOT NULL,
PRIMARY KEY (entity, entity_id, field, lang) PRIMARY KEY (entity, entity_id, field, lang)
) ENGINE=InnoDB; ) ENGINE=InnoDB;
-- Ueberschreibungen fuer feste Texte der Website (Live-Bearbeiten-Modus, siehe LiveEditController)
CREATE TABLE text_overrides (
lang CHAR(2) NOT NULL,
text_key VARCHAR(190) NOT NULL,
value TEXT NOT NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (lang, text_key)
) ENGINE=InnoDB;

View file

@ -41,6 +41,7 @@ use App\Controllers\SiteSettingsController;
use App\Controllers\TextStyleController; use App\Controllers\TextStyleController;
use App\Controllers\TwoFactorController; use App\Controllers\TwoFactorController;
use App\Controllers\UpdateController; use App\Controllers\UpdateController;
use App\Controllers\LiveEditController;
use App\Controllers\UploadController; use App\Controllers\UploadController;
use App\Middleware\AuthMiddleware; use App\Middleware\AuthMiddleware;
use App\Router; use App\Router;
@ -286,6 +287,8 @@ $router->get('/maintenance', fn($p) => MaintenanceController::status());
$router->post('/maintenance', $perm('settings.manage', fn($p) => MaintenanceController::update())); $router->post('/maintenance', $perm('settings.manage', fn($p) => MaintenanceController::update()));
$router->get('/site-settings', fn($p) => SiteSettingsController::show()); $router->get('/site-settings', fn($p) => SiteSettingsController::show());
// Live-Bearbeiten-Modus auf der Website: Berechtigung wird je Aenderung im Controller geprueft.
$router->put('/live-edit', $admin(fn($p) => LiveEditController::save()));
$router->post('/site-settings', $perm('settings.manage', fn($p) => SiteSettingsController::update())); $router->post('/site-settings', $perm('settings.manage', fn($p) => SiteSettingsController::update()));
$router->put('/site-settings/visibility', $anyPerm(['content.manage', 'settings.manage'], fn($p) => SiteSettingsController::updateVisibility())); $router->put('/site-settings/visibility', $anyPerm(['content.manage', 'settings.manage'], fn($p) => SiteSettingsController::updateVisibility()));

View file

@ -19,7 +19,7 @@ class HomeSectionController
{ {
public const ALLOWED_SLUGS = ['hero', 'youtube', 'craft', 'advice', 'insights', 'more']; public const ALLOWED_SLUGS = ['hero', 'youtube', 'craft', 'advice', 'insights', 'more'];
private const DEFAULTS = [ public const DEFAULTS = [
'hero' => [ 'hero' => [
'eyebrow_de' => 'Willkommen bei HifiPlanet', 'eyebrow_en' => 'Welcome to HifiPlanet', 'eyebrow_de' => 'Willkommen bei HifiPlanet', 'eyebrow_en' => 'Welcome to HifiPlanet',
'title_de' => 'Home of pure Sound', 'title_en' => 'Home of pure Sound', 'title_de' => 'Home of pure Sound', 'title_en' => 'Home of pure Sound',

View file

@ -0,0 +1,291 @@
<?php
namespace App\Controllers;
use App\Config\Database;
use App\Middleware\AuthMiddleware;
use App\Support\Http;
use App\Support\Translations;
/**
* Speichert Aenderungen aus dem Live-Bearbeiten-Modus der Website (Texte direkt auf der Seite
* anklicken und aendern, siehe hifi-src/src/context/LiveEditContext.jsx). Statt fuer jede
* Tabelle den vollen Datensatz ueber den jeweiligen Admin-Endpunkt neu zu schreiben, kommt hier
* eine Liste einzelner Feld-Aenderungen an ({entity, id, field, lang, value}) - jede wird gegen
* die Whitelist unten geprueft (Tabelle, Feld, Sprache, Berechtigung) und alles zusammen in
* einer Transaktion geschrieben.
*
* Zusaetzlich die "festen Texte" (Buttons, Menue, Formular-Beschriftungen ...), die sonst nur
* im i18n-Woerterbuch des Frontends stehen: Ueberschreibungen dafuer liegen in text_overrides
* und werden mit /site-settings an jeden Besucher ausgeliefert.
*/
class LiveEditController
{
private const MAX_CHANGES = 500;
// entity => Tabelle, Schluesselspalte, Berechtigung und je Feld, wie die Sprachen
// gespeichert sind: 'columns' = eigene Spalten <feld>_de/<feld>_en, 'translation' = Deutsch
// in der Spalte <feld>, Englisch in content_translations, 'single' = nur eine Spalte (gilt
// fuer beide Sprachen). 'html' = Rich-Text, sonst Klartext (wird getrimmt).
private const ENTITIES = [
'home_sections' => [
'table' => 'home_sections', 'key' => 'slug', 'permission' => 'content.manage',
'fields' => [
'eyebrow' => ['lang' => 'columns'],
'title' => ['lang' => 'columns'],
'body_html' => ['lang' => 'columns', 'html' => true],
'button_label' => ['lang' => 'columns'],
'button_url' => ['lang' => 'single'],
],
],
'faqs' => [
'table' => 'faqs', 'key' => 'id', 'permission' => 'content.manage',
'fields' => [
'question' => ['lang' => 'columns', 'required' => true],
'answer' => ['lang' => 'columns', 'required' => true],
],
],
'partners' => [
'table' => 'partners', 'key' => 'id', 'permission' => 'content.manage',
'fields' => ['name' => ['lang' => 'single', 'required' => true]],
],
'services' => [
'table' => 'services', 'key' => 'id', 'permission' => 'services.manage',
'fields' => [
'title' => ['lang' => 'translation', 'required' => true],
'description' => ['lang' => 'translation', 'required' => true],
'cta_label' => ['lang' => 'translation'],
],
],
'packages' => [
'table' => 'packages', 'key' => 'id', 'permission' => 'packages.manage',
'fields' => [
'name' => ['lang' => 'single', 'required' => true],
'description' => ['lang' => 'translation', 'multiline' => true],
'tagline' => ['lang' => 'translation'],
'price_text' => ['lang' => 'translation'],
],
],
'brands' => [
'table' => 'brands', 'key' => 'id', 'permission' => 'brands.manage',
'fields' => ['name' => ['lang' => 'single', 'required' => true]],
],
'car_models' => [
'table' => 'car_models', 'key' => 'id', 'permission' => 'models.manage',
'fields' => ['name' => ['lang' => 'single', 'required' => true]],
],
'gallery_brands' => [
'table' => 'gallery_brands', 'key' => 'id', 'permission' => 'gallery.manage',
'fields' => ['name' => ['lang' => 'single', 'required' => true]],
],
'gallery_projects' => [
'table' => 'gallery_projects', 'key' => 'id', 'permission' => 'gallery.manage',
'fields' => ['name' => ['lang' => 'single', 'required' => true]],
],
'gallery_photos' => [
'table' => 'gallery_photos', 'key' => 'id', 'permission' => 'gallery.manage',
'fields' => ['caption' => ['lang' => 'single']],
],
'legal_pages' => [
'table' => 'legal_pages', 'key' => 'slug', 'permission' => 'settings.manage',
'fields' => [
'title' => ['lang' => 'single', 'required' => true],
'body_html' => ['lang' => 'single', 'html' => true, 'required' => true],
],
],
];
// Feste Texte (i18n-Schluessel wie "home.faqHeading") - eigene Berechtigung wie die
// uebrigen Website-Inhalte.
private const TEXT_PERMISSION = 'content.manage';
private const TEXT_KEY_PATTERN = '/^[A-Za-z0-9_]+(\.[A-Za-z0-9_]+){1,5}$/';
private const TEXT_MAX_LENGTH = 2000;
/** Oeffentlich (ueber /site-settings): alle Ueberschreibungen als ['de' => [key => text], 'en' => [...]]. */
public static function textOverrides(): array
{
$result = ['de' => new \stdClass(), 'en' => new \stdClass()];
try {
$rows = Database::connection()->query('SELECT lang, text_key, value FROM text_overrides')->fetchAll();
} catch (\Throwable $e) {
return $result; // Tabelle fehlt noch - es gelten die eingebauten Texte
}
$byLang = ['de' => [], 'en' => []];
foreach ($rows as $row) {
if (isset($byLang[$row['lang']])) {
$byLang[$row['lang']][$row['text_key']] = $row['value'];
}
}
foreach ($byLang as $lang => $values) {
if ($values) {
$result[$lang] = $values;
}
}
return $result;
}
public static function save(): void
{
$userId = AuthMiddleware::requireAdmin();
$body = Http::jsonBody();
$changes = $body['changes'] ?? null;
if (!is_array($changes) || !$changes) {
Http::error('Keine Änderungen übermittelt.', 422);
}
if (count($changes) > self::MAX_CHANGES) {
Http::error('Zu viele Änderungen auf einmal - bitte zwischendurch speichern.', 422);
}
// Erst alles pruefen, dann schreiben - so landet nie ein halber Satz Aenderungen in der DB.
$permissionCache = [];
$can = function (string $permission) use ($userId, &$permissionCache): bool {
return $permissionCache[$permission] ??= AuthMiddleware::userHasPermission($userId, $permission);
};
$validated = [];
foreach ($changes as $i => $change) {
$validated[] = self::validate(is_array($change) ? $change : [], $can, $i + 1);
}
$db = Database::connection();
$db->beginTransaction();
try {
foreach ($validated as $change) {
self::apply($db, $change);
}
$db->commit();
} catch (\Throwable $e) {
$db->rollBack();
Http::error('Speichern fehlgeschlagen: ' . $e->getMessage(), 500);
}
Http::send(['ok' => true, 'saved' => count($validated)]);
}
private static function validate(array $change, callable $can, int $position): array
{
$entity = (string) ($change['entity'] ?? '');
$lang = (string) ($change['lang'] ?? 'de');
if (!in_array($lang, ['de', 'en'], true)) {
Http::error("Änderung $position: unbekannte Sprache.", 422);
}
$value = $change['value'] ?? '';
if (!is_string($value)) {
Http::error("Änderung $position: ungültiger Wert.", 422);
}
if ($entity === 'text') {
if (!$can(self::TEXT_PERMISSION)) {
Http::error('Keine Berechtigung, feste Texte zu ändern.', 403);
}
$key = (string) ($change['id'] ?? '');
if (!preg_match(self::TEXT_KEY_PATTERN, $key) || strlen($key) > 190) {
Http::error("Änderung $position: ungültiger Text-Schlüssel.", 422);
}
if (mb_strlen($value) > self::TEXT_MAX_LENGTH) {
Http::error("Änderung $position: Text ist zu lang.", 422);
}
return ['entity' => 'text', 'id' => $key, 'lang' => $lang, 'value' => trim($value)];
}
$config = self::ENTITIES[$entity] ?? null;
if ($config === null) {
Http::error("Änderung $position: dieser Bereich kann nicht live bearbeitet werden.", 422);
}
if (!$can($config['permission'])) {
Http::error('Keine Berechtigung für einen Teil der Änderungen.', 403);
}
$field = (string) ($change['field'] ?? '');
$fieldConfig = $config['fields'][$field] ?? null;
if ($fieldConfig === null) {
Http::error("Änderung $position: Feld \"$field\" kann nicht live bearbeitet werden.", 422);
}
$id = $change['id'] ?? null;
if ($config['key'] === 'id') {
$id = (int) $id;
if ($id <= 0) {
Http::error("Änderung $position: ungültiger Eintrag.", 422);
}
} else {
$id = (string) $id;
$allowed = $entity === 'home_sections' ? HomeSectionController::ALLOWED_SLUGS : PageContentController::ALLOWED_SLUGS;
if (!in_array($id, $allowed, true)) {
Http::error("Änderung $position: unbekannter Abschnitt.", 422);
}
}
if (empty($fieldConfig['html'])) {
$value = trim(empty($fieldConfig['multiline']) ? preg_replace('/\s*\n\s*/', ' ', $value) : $value);
}
$isEmpty = trim(strip_tags($value)) === '';
// Pflichtfelder duerfen auf Deutsch nicht leer werden; ein leeres Englisch heisst
// "deutschen Text verwenden" (bzw. bei faqs: leer lassen ist erlaubt).
if (!empty($fieldConfig['required']) && $isEmpty && ($lang === 'de' || $fieldConfig['lang'] === 'single')) {
Http::error("Änderung $position: dieses Feld darf nicht leer sein.", 422);
}
return [
'entity' => $entity, 'config' => $config, 'field' => $field, 'fieldConfig' => $fieldConfig,
'id' => $id, 'lang' => $lang, 'value' => $isEmpty ? '' : $value,
];
}
private static function apply(\PDO $db, array $change): void
{
if ($change['entity'] === 'text') {
if ($change['value'] === '') {
$db->prepare('DELETE FROM text_overrides WHERE lang = ? AND text_key = ?')
->execute([$change['lang'], $change['id']]);
} else {
$db->prepare(
'INSERT INTO text_overrides (lang, text_key, value) VALUES (?, ?, ?)
ON DUPLICATE KEY UPDATE value = VALUES(value)'
)->execute([$change['lang'], $change['id'], $change['value']]);
}
return;
}
$config = $change['config'];
$table = $config['table'];
$keyColumn = $config['key'];
$mode = $change['fieldConfig']['lang'];
$value = $change['value'];
if ($mode === 'translation' && $change['lang'] === 'en') {
Translations::saveFromBody($change['entity'], (int) $change['id'], [$change['field'] . '_en' => $value]);
return;
}
$column = $mode === 'columns' ? $change['field'] . '_' . $change['lang'] : $change['field'];
// Startseiten-Abschnitte und Rechtstexte haben bis zum ersten Speichern evtl. noch keine
// Zeile (dann zeigt die Seite die eingebauten Standardtexte) - erst damit anlegen.
if ($keyColumn === 'slug') {
self::ensureSlugRow($db, $change['entity'], $change['id']);
}
// Optionale Felder sind NULL-Spalten und bekommen bei leerem Text NULL (wie in den
// Admin-Formularen), Pflichtfelder sind NOT NULL (leer kommt dort nur bei faqs-Englisch an).
$stored = $value === '' && empty($change['fieldConfig']['required']) ? null : $value;
$stmt = $db->prepare("UPDATE `$table` SET `$column` = ? WHERE `$keyColumn` = ?");
$stmt->execute([$stored, $change['id']]);
}
private static function ensureSlugRow(\PDO $db, string $entity, string $slug): void
{
$table = $entity === 'home_sections' ? 'home_sections' : 'legal_pages';
$exists = $db->prepare("SELECT 1 FROM `$table` WHERE slug = ?");
$exists->execute([$slug]);
if ($exists->fetch()) {
return;
}
$defaults = $entity === 'home_sections'
? HomeSectionController::DEFAULTS[$slug]
: ['title' => PageContentController::DEFAULTS[$slug]['title'], 'body_html' => PageContentController::DEFAULTS[$slug]['body_html']];
$columns = array_keys($defaults);
$db->prepare(
"INSERT INTO `$table` (slug, " . implode(', ', $columns) . ') VALUES (?' . str_repeat(', ?', count($columns)) . ')'
)->execute(array_merge([$slug], array_values($defaults)));
}
}

View file

@ -16,7 +16,7 @@ class PageContentController
{ {
public const ALLOWED_SLUGS = ['impressum', 'datenschutz', 'agb']; public const ALLOWED_SLUGS = ['impressum', 'datenschutz', 'agb'];
private const DEFAULTS = [ public const DEFAULTS = [
'impressum' => [ 'impressum' => [
'title' => 'Impressum', 'title' => 'Impressum',
'body_html' => <<<'HTML' 'body_html' => <<<'HTML'

View file

@ -99,6 +99,9 @@ class SiteSettingsController
$result['hidden_areas'] = self::decodeHiddenAreas($row['hidden_areas'] ?? null); $result['hidden_areas'] = self::decodeHiddenAreas($row['hidden_areas'] ?? null);
// Navbar/Footer zeigen "Downloads" nur, wenn dort auch etwas zu finden ist. // Navbar/Footer zeigen "Downloads" nur, wenn dort auch etwas zu finden ist.
$result['has_downloads'] = DownloadController::hasVisible(); $result['has_downloads'] = DownloadController::hasVisible();
// Im Live-Bearbeiten-Modus geaenderte feste Texte - kommen hier mit, damit sie ohne
// eigenen Request (und mit dem localStorage-Cache von /site-settings) sofort greifen.
$result['text_overrides'] = LiveEditController::textOverrides();
Http::send($result); Http::send($result);
} }

View file

@ -46,6 +46,8 @@ class GitUpdateService
'api/config/setup.php', 'api/config/setup.php',
'api/config/ga-service-account.json', 'api/config/ga-service-account.json',
'api/config/update-state.php', 'api/config/update-state.php',
'api/config/.schema-version',
'api/config/.schema-version.lock',
'skills-lock.json', 'skills-lock.json',
]; ];
private const APPLY_DENYLIST_PREFIXES = ['api/uploads/', '_update/', '.claude/', '.agents/', '.git/']; private const APPLY_DENYLIST_PREFIXES = ['api/uploads/', '_update/', '.claude/', '.agents/', '.git/'];

View file

@ -378,6 +378,14 @@ class Schema
value TEXT NOT NULL, value TEXT NOT NULL,
PRIMARY KEY (entity, entity_id, field, lang) PRIMARY KEY (entity, entity_id, field, lang)
) ENGINE=InnoDB", ) ENGINE=InnoDB",
'text_overrides' => "CREATE TABLE text_overrides (
lang CHAR(2) NOT NULL,
text_key VARCHAR(190) NOT NULL,
value TEXT NOT NULL,
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
PRIMARY KEY (lang, text_key)
) ENGINE=InnoDB",
]; ];
// Erwartete Spalten je Tabelle (ohne Primary Key / Unique / Foreign-Key-Klauseln – // Erwartete Spalten je Tabelle (ohne Primary Key / Unique / Foreign-Key-Klauseln –
@ -683,6 +691,12 @@ class Schema
'lang' => 'CHAR(2) NOT NULL', 'lang' => 'CHAR(2) NOT NULL',
'value' => 'TEXT NOT NULL', 'value' => 'TEXT NOT NULL',
], ],
'text_overrides' => [
'lang' => 'CHAR(2) NOT NULL',
'text_key' => 'VARCHAR(190) NOT NULL',
'value' => 'TEXT NOT NULL',
'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
],
]; ];
// Einmalige Startdaten fuer eine Tabelle, die von SchemaController::runMigration() direkt // Einmalige Startdaten fuer eine Tabelle, die von SchemaController::runMigration() direkt

View file

@ -0,0 +1 @@
import{j as e}from"./index-DPjtOB4k.js";import{L as i}from"./LegalPageView-CftQhY6B.js";function n(){return e.jsx(i,{slug:"agb",fallbackTitle:"AGB",description:"Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach."})}export{n as default};

View file

@ -1 +0,0 @@
import{r as a,c as l,b as n,j as e}from"./index-Cc1wEeIX.js";function x(){const[t,s]=a.useState(null);return a.useEffect(()=>{l.get("/legal-pages/agb").then(s).catch(()=>{})},[]),n({title:(t==null?void 0:t.title)||"AGB",description:"Allgemeine Geschäftsbedingungen von HifiPlanet Amorbach.",path:"/agb"}),t?e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),e.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}export{x as default};

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

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

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import{r as a,c as l,b as n,j as e}from"./index-Cc1wEeIX.js";function u(){const[t,s]=a.useState(null);return a.useEffect(()=>{l.get("/legal-pages/datenschutz").then(s).catch(()=>{})},[]),n({title:(t==null?void 0:t.title)||"Datenschutzerklärung",description:"Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO.",path:"/datenschutz"}),t?e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),e.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}export{u as default};

View file

@ -0,0 +1 @@
import{j as t}from"./index-DPjtOB4k.js";import{L as e}from"./LegalPageView-CftQhY6B.js";function n(){return t.jsx(e,{slug:"datenschutz",fallbackTitle:"Datenschutzerklärung",description:"Datenschutzerklärung von HifiPlanet Amorbach gemäß Art. 13 DSGVO."})}export{n as default};

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{r,u as y,b as v,j as e,e as S,R as D,c as I}from"./index-Cc1wEeIX.js";import{f as _,a as E,b as F,i as L}from"./downloads-B9pqFegV.js";import{L as C,F as p,a as R,b as T,c as U,M,D as A}from"./music-B3GiJs_4.js";const K={audio:M,video:U,pdf:p,image:T,archive:R,document:p},n="hifi-downloads-password",z=()=>{try{return localStorage.getItem(n)||""}catch{return""}},f=t=>{try{t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}},g=t=>I.get("/downloads",t?{headers:{"X-Download-Password":encodeURIComponent(t)}}:void 0);function W(){const[t,i]=r.useState(null),[c,x]=r.useState(!1),[o,b]=r.useState(""),[j,m]=r.useState(!1),[u,h]=r.useState(!1),[d,w]=r.useState(null),{t:s,language:k}=y();r.useEffect(()=>{const a=z();g(a).then(l=>{l.locked?(a&&f(""),x(!0)):i(l.items)}).catch(l=>w(l))},[]);const N=async a=>{a.preventDefault(),h(!0),m(!1);try{const l=await g(o);l.locked?m(!0):(f(o),x(!1),i(l.items))}catch(l){w(l.message)}finally{h(!1)}};return v({title:s("downloadsPage.metaTitle"),description:s("downloadsPage.metaDescription"),path:"/downloads"}),e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:s("downloadsPage.title")}),e.jsx("p",{className:"mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.intro")}),d&&e.jsx("p",{className:"text-red-600",children:typeof d=="string"?d:S(d,s)}),!d&&!c&&t===null&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.loading")}),(t==null?void 0:t.length)===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.empty")}),c&&e.jsxs("form",{onSubmit:N,className:"max-w-md rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5 text-brand-500","aria-hidden":"true"}),e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:s("downloadsPage.lockedTitle")})]}),e.jsx("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.lockedText")}),e.jsx("label",{htmlFor:"downloads-password",className:"sr-only",children:s("downloadsPage.passwordLabel")}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{id:"downloads-password",type:"password",required:!0,autoComplete:"off",value:o,onChange:a=>b(a.target.value),placeholder:s("downloadsPage.passwordLabel"),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 dark:border-neutral-700 dark:bg-neutral-950 dark:text-white"}),e.jsx("button",{type:"submit",disabled:u,className:"shrink-0 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s(u?"downloadsPage.unlocking":"downloadsPage.unlock")})]}),j&&e.jsx("p",{className:"mt-2 text-sm text-red-600",role:"alert",children:s("downloadsPage.wrongPassword")})]}),e.jsx("div",{className:"space-y-4",children:t==null?void 0:t.map((a,l)=>{const P=K[_(a.file_name)];return e.jsx(D,{index:l%4,className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-brand-500/10 text-brand-600 dark:text-brand-400",children:e.jsx(P,{className:"h-6 w-6","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:a.title}),a.description&&e.jsx("p",{className:"mt-1 whitespace-pre-line text-sm text-neutral-600 dark:text-neutral-300",children:a.description}),e.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:[E(a.file_name).toUpperCase()," · ",F(a.file_size,k==="de"?"de-DE":"en-US")]}),L(a.file_name)&&e.jsx("audio",{controls:!0,preload:"none",src:a.file_path,className:"mt-3 w-full"})]}),e.jsxs("a",{href:a.file_path,download:a.file_name,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:[e.jsx(A,{className:"h-4 w-4","aria-hidden":"true"}),s("downloadsPage.download")]})]})},a.id)})})]})}export{W as default}; import{r,u as y,b as v,j as e,e as S,R as D,c as I}from"./index-DPjtOB4k.js";import{f as _,a as E,b as F,i as L}from"./downloads-B9pqFegV.js";import{L as C,F as p,a as R,b as T,c as U,M,D as A}from"./music-KHqYrHBN.js";const K={audio:M,video:U,pdf:p,image:T,archive:R,document:p},n="hifi-downloads-password",z=()=>{try{return localStorage.getItem(n)||""}catch{return""}},f=t=>{try{t?localStorage.setItem(n,t):localStorage.removeItem(n)}catch{}},g=t=>I.get("/downloads",t?{headers:{"X-Download-Password":encodeURIComponent(t)}}:void 0);function W(){const[t,i]=r.useState(null),[c,x]=r.useState(!1),[o,b]=r.useState(""),[j,m]=r.useState(!1),[u,h]=r.useState(!1),[d,w]=r.useState(null),{t:s,language:k}=y();r.useEffect(()=>{const a=z();g(a).then(l=>{l.locked?(a&&f(""),x(!0)):i(l.items)}).catch(l=>w(l))},[]);const N=async a=>{a.preventDefault(),h(!0),m(!1);try{const l=await g(o);l.locked?m(!0):(f(o),x(!1),i(l.items))}catch(l){w(l.message)}finally{h(!1)}};return v({title:s("downloadsPage.metaTitle"),description:s("downloadsPage.metaDescription"),path:"/downloads"}),e.jsxs("div",{className:"mx-auto max-w-4xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:s("downloadsPage.title")}),e.jsx("p",{className:"mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.intro")}),d&&e.jsx("p",{className:"text-red-600",children:typeof d=="string"?d:S(d,s)}),!d&&!c&&t===null&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.loading")}),(t==null?void 0:t.length)===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("downloadsPage.empty")}),c&&e.jsxs("form",{onSubmit:N,className:"max-w-md rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"mb-2 flex items-center gap-2",children:[e.jsx(C,{className:"h-5 w-5 text-brand-500","aria-hidden":"true"}),e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:s("downloadsPage.lockedTitle")})]}),e.jsx("p",{className:"mb-4 text-sm text-neutral-600 dark:text-neutral-300",children:s("downloadsPage.lockedText")}),e.jsx("label",{htmlFor:"downloads-password",className:"sr-only",children:s("downloadsPage.passwordLabel")}),e.jsxs("div",{className:"flex flex-col gap-2 sm:flex-row",children:[e.jsx("input",{id:"downloads-password",type:"password",required:!0,autoComplete:"off",value:o,onChange:a=>b(a.target.value),placeholder:s("downloadsPage.passwordLabel"),className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm text-neutral-900 dark:border-neutral-700 dark:bg-neutral-950 dark:text-white"}),e.jsx("button",{type:"submit",disabled:u,className:"shrink-0 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:s(u?"downloadsPage.unlocking":"downloadsPage.unlock")})]}),j&&e.jsx("p",{className:"mt-2 text-sm text-red-600",role:"alert",children:s("downloadsPage.wrongPassword")})]}),e.jsx("div",{className:"space-y-4",children:t==null?void 0:t.map((a,l)=>{const P=K[_(a.file_name)];return e.jsx(D,{index:l%4,className:"rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:e.jsxs("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start",children:[e.jsx("div",{className:"flex h-12 w-12 shrink-0 items-center justify-center rounded-full bg-brand-500/10 text-brand-600 dark:text-brand-400",children:e.jsx(P,{className:"h-6 w-6","aria-hidden":"true"})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:a.title}),a.description&&e.jsx("p",{className:"mt-1 whitespace-pre-line text-sm text-neutral-600 dark:text-neutral-300",children:a.description}),e.jsxs("p",{className:"mt-1 text-xs text-neutral-400",children:[E(a.file_name).toUpperCase()," · ",F(a.file_size,k==="de"?"de-DE":"en-US")]}),L(a.file_name)&&e.jsx("audio",{controls:!0,preload:"none",src:a.file_path,className:"mt-3 w-full"})]}),e.jsxs("a",{href:a.file_path,download:a.file_name,className:"inline-flex shrink-0 items-center justify-center gap-2 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:[e.jsx(A,{className:"h-4 w-4","aria-hidden":"true"}),s("downloadsPage.download")]})]})},a.id)})})]})}export{W as default};

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

@ -1 +0,0 @@
import{f as m,r as n,u as g,a as u,c as p,b as h,j as a,N as b,e as f,L as d,d as y}from"./index-Cc1wEeIX.js";function v(){const{brandSlug:s}=m(),[e,i]=n.useState(null),[l,o]=n.useState(null),{t}=g(),{gallery_card_text_x:x,gallery_card_text_y:c}=u();return n.useEffect(()=>{p.get(`/gallery-brands/${s}/projects`).then(i).catch(r=>o(r))},[s]),h({title:e?t("galleryBrandPage.metaTitle")(e.brand.name):t("galleryBrandPage.metaTitleFallback"),description:e?t("galleryBrandPage.metaDescription")(e.brand.name):void 0,path:`/galerie/${s}`}),l?l.status===404?a.jsx(b,{}):a.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:f(l,t)}):e?a.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[a.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[a.jsx(d,{to:"/galerie",className:"hover:text-brand-500",children:t("galleryBrandPage.breadcrumbGallery")})," / ",e.brand.name]}),a.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[e.brand.name," – ",t("galleryBrandPage.titleSuffix")]}),e.projects.length===0&&a.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:t("galleryBrandPage.empty")}),a.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:e.projects.map(r=>a.jsxs(d,{to:`/galerie/${s}/${r.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[r.cover_image_path?a.jsx("img",{src:r.cover_image_path,alt:r.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),a.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:y(x,c,{x:0,y:100}),children:r.name})]},r.id))})]}):a.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:t("galleryBrandPage.loading")})}export{v as default};

View file

@ -0,0 +1 @@
import{g,r as n,u as m,a as u,c as p,b as h,j as a,N as b,e as f,L as d,d as y,f as j}from"./index-DPjtOB4k.js";function N(){const{brandSlug:s}=g(),[e,i]=n.useState(null),[l,x]=n.useState(null),{t:r}=m(),{gallery_card_text_x:o,gallery_card_text_y:c}=u();return n.useEffect(()=>{p.get(`/gallery-brands/${s}/projects`).then(i).catch(t=>x(t))},[s]),h({title:e?r("galleryBrandPage.metaTitle")(e.brand.name):r("galleryBrandPage.metaTitleFallback"),description:e?r("galleryBrandPage.metaDescription")(e.brand.name):void 0,path:`/galerie/${s}`}),l?l.status===404?a.jsx(b,{}):a.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:f(l,r)}):e?a.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[a.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[a.jsx(d,{to:"/galerie",className:"hover:text-brand-500",children:r("galleryBrandPage.breadcrumbGallery")})," / ",e.brand.name]}),a.jsxs("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:[e.brand.name," – ",r("galleryBrandPage.titleSuffix")]}),e.projects.length===0&&a.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:r("galleryBrandPage.empty")}),a.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:e.projects.map(t=>a.jsxs(d,{to:`/galerie/${s}/${t.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[t.cover_image_path?a.jsx("img",{src:t.cover_image_path,alt:t.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):a.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),a.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),a.jsx(y,{entity:"gallery_projects",id:t.id,field:"name",lang:"de",value:t.name,className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:j(o,c,{x:0,y:100})})]},t.id))})]}):a.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:r("galleryBrandPage.loading")})}export{N as default};

File diff suppressed because one or more lines are too long

View file

@ -1 +0,0 @@
import{r as s,u as x,a as d,b as g,c as u,j as e,e as m,L as p,d as h}from"./index-Cc1wEeIX.js";function y(){const[r,i]=s.useState(null),[l,n]=s.useState(null),{t:a}=x(),{gallery_card_text_x:c,gallery_card_text_y:o}=d();return g({title:a("galleryOverview.metaTitle"),description:a("galleryOverview.metaDescription"),path:"/galerie"}),s.useEffect(()=>{u.get("/gallery-brands").then(i).catch(t=>n(t))},[]),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-2 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:a("galleryOverview.title")}),e.jsx("p",{className:"mb-8 text-neutral-600 dark:text-neutral-300",children:a("galleryOverview.intro")}),l&&e.jsx("p",{className:"text-red-600",children:typeof l=="string"?l:m(l,a)}),!r&&!l&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:a("galleryOverview.loading")}),r&&r.length===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:a("galleryOverview.empty")}),e.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:r==null?void 0:r.map(t=>e.jsxs(p,{to:`/galerie/${t.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:t.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),e.jsx("span",{className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:h(c,o,{x:0,y:100}),children:t.name})]},t.id))})]})}export{y as default};

View file

@ -0,0 +1 @@
import{r,u as d,a as g,b as u,c as m,j as e,E as i,e as p,L as v,d as h,f as y}from"./index-DPjtOB4k.js";function w(){const[a,o]=r.useState(null),[l,n]=r.useState(null),{t:s}=d(),{gallery_card_text_x:c,gallery_card_text_y:x}=g();return u({title:s("galleryOverview.metaTitle"),description:s("galleryOverview.metaDescription"),path:"/galerie"}),r.useEffect(()=>{m.get("/gallery-brands").then(o).catch(t=>n(t))},[]),e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[e.jsx(i,{k:"galleryOverview.title",as:"h1",className:"mb-2 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl"}),e.jsx(i,{k:"galleryOverview.intro",as:"p",className:"mb-8 block text-neutral-600 dark:text-neutral-300"}),l&&e.jsx("p",{className:"text-red-600",children:typeof l=="string"?l:p(l,s)}),!a&&!l&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.loading")}),a&&a.length===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:s("galleryOverview.empty")}),e.jsx("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:a==null?void 0:a.map(t=>e.jsxs(v,{to:`/galerie/${t.slug}`,className:"group relative block aspect-[4/3] overflow-hidden rounded-xl bg-neutral-900 shadow-sm transition hover:shadow-lg",children:[t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:t.name,className:"h-full w-full object-cover transition duration-300 group-hover:scale-105"}):e.jsx("div",{className:"flex h-full w-full items-center justify-center bg-neutral-200 dark:bg-neutral-800"}),e.jsx("div",{className:"absolute inset-0 bg-gradient-to-t from-black/85 via-black/10 to-transparent transition group-hover:from-black/95"}),e.jsx(h,{entity:"gallery_brands",id:t.id,field:"name",lang:"de",value:t.name,className:"absolute whitespace-nowrap p-4 text-lg font-extrabold text-white",style:y(c,x,{x:0,y:100})})]},t.id))})]})}export{w as default};

View file

@ -1,3 +1,3 @@
import{f as z,r as l,o as B,c as d,j as t,L as C}from"./index-Cc1wEeIX.js";import{S as M,s as D}from"./SortableList-DIXFCDYS.js";import{V as G}from"./ViewOnSite-CStAY6xT.js";import{r as L,M as A,f as I}from"./resizeImage-C6PvAwh0.js";import"./sortable.esm-D8IvDAze.js";import"./grip-vertical-0BUKE4NU.js";function J(){const{projectId:m}=z(),[u,h]=l.useState([]),[c,v]=l.useState(null),[x,j]=l.useState(""),[b,w]=l.useState(!1),[$,y]=l.useState(""),p=l.useRef(null),s=B(),f=()=>d.get(`/gallery-projects/${m}/photos`).then(h);l.useEffect(()=>{f(),d.get("/gallery-projects").then(e=>v(e.find(r=>String(r.id)===String(m))||null)).catch(()=>{})},[m]);const F=async e=>{const r=Array.from(e.target.files||[]);if(r.length===0)return;j(""),w(!0);let a=u.reduce((o,i)=>Math.max(o,Number(i.sort_order)||0),0),n=0;const g=[];for(let o=0;o<r.length;o++){y(`Foto ${o+1} von ${r.length} wird hochgeladen…`);try{const i=await L(r[o]);if(i.size>A)throw new Error(`zu groß (${I(i.size)}, max. 5 MB)`);const k=new FormData;k.append("file",i);const E=await d.post("/uploads",k);a+=10,await d.post("/gallery-photos",{gallery_project_id:Number(m),image_path:E.path,sort_order:a}),n++}catch(i){g.push(`${r[o].name}: ${i.message}`)}}w(!1),y(""),p.current&&(p.current.value=""),f(),g.length===0?s.success(n===1?"1 Foto hochgeladen.":`${n} Fotos hochgeladen.`):(j(`Nicht hochgeladen: import{g as z,r as l,q as B,c as d,j as t,L as C}from"./index-DPjtOB4k.js";import{S as M,s as D}from"./SortableList-BJ0lSjmQ.js";import{V as G}from"./ViewOnSite-BpPSiS-X.js";import{r as L,M as A,f as I}from"./resizeImage-C6PvAwh0.js";import"./sortable.esm-DcJMx5eJ.js";import"./grip-vertical-CUuB59gl.js";function J(){const{projectId:m}=z(),[u,h]=l.useState([]),[c,v]=l.useState(null),[f,j]=l.useState(""),[b,w]=l.useState(!1),[$,y]=l.useState(""),p=l.useRef(null),s=B(),x=()=>d.get(`/gallery-projects/${m}/photos`).then(h);l.useEffect(()=>{x(),d.get("/gallery-projects").then(e=>v(e.find(r=>String(r.id)===String(m))||null)).catch(()=>{})},[m]);const F=async e=>{const r=Array.from(e.target.files||[]);if(r.length===0)return;j(""),w(!0);let a=u.reduce((o,i)=>Math.max(o,Number(i.sort_order)||0),0),n=0;const g=[];for(let o=0;o<r.length;o++){y(`Foto ${o+1} von ${r.length} wird hochgeladen…`);try{const i=await L(r[o]);if(i.size>A)throw new Error(`zu groß (${I(i.size)}, max. 5 MB)`);const k=new FormData;k.append("file",i);const E=await d.post("/uploads",k);a+=10,await d.post("/gallery-photos",{gallery_project_id:Number(m),image_path:E.path,sort_order:a}),n++}catch(i){g.push(`${r[o].name}: ${i.message}`)}}w(!1),y(""),p.current&&(p.current.value=""),x(),g.length===0?s.success(n===1?"1 Foto hochgeladen.":`${n} Fotos hochgeladen.`):(j(`Nicht hochgeladen:
${g.join(` ${g.join(`
`)}`),s.error(`${n} hochgeladen, ${g.length} fehlgeschlagen.`))},P=(e,r)=>{h(a=>a.map(n=>n.id===e.id?{...n,caption:r}:n))},N=l.useRef(null),S=async e=>{if((e.caption||"")!==N.current)try{await d.put(`/gallery-photos/${e.id}`,{caption:e.caption,sort_order:e.sort_order}),s.success("Bildunterschrift gespeichert.")}catch(r){s.error(`Speichern fehlgeschlagen: ${r.message}`)}},_=async e=>{if(confirm("Foto wirklich entfernen?"))try{await d.delete(`/gallery-photos/${e}`),s.success("Foto entfernt."),f()}catch(r){s.error(`Entfernen fehlgeschlagen: ${r.message}`)}},R=async e=>{const r=u;h(e);try{h(await D("gallery-photos",e)),s.success("Reihenfolge gespeichert.")}catch(a){h(r),s.error(`Reihenfolge konnte nicht gespeichert werden: ${a.message}`)}};return t.jsxs("div",{children:[t.jsx("p",{className:"mb-2 text-sm",children:t.jsx(C,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[t.jsxs("h1",{className:"text-xl font-bold text-neutral-900 dark:text-white",children:["Fotos im Projekt",c?`: ${c.brand_name} ${c.name}`:""]}),c&&t.jsx(G,{to:`/galerie/${c.brand_slug}/${c.slug}`})]}),t.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),t.jsx("input",{ref:p,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:F,disabled:b,className:"text-sm"}),t.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"JPG, PNG oder WebP, große Fotos werden automatisch verkleinert."}),b&&t.jsx("p",{className:"mt-2 text-sm text-neutral-500","aria-live":"polite",children:$})]}),x&&t.jsx("p",{className:"mb-4 whitespace-pre-line text-sm text-red-600",children:x}),u.length>1&&t.jsx("p",{className:"mb-3 text-xs text-neutral-500 dark:text-neutral-400",children:"Reihenfolge am Griff per Ziehen ändern."}),t.jsx(M,{items:u,onReorder:R,as:"grid",className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:(e,r)=>t.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("img",{src:e.image_path,alt:e.caption||"",className:"aspect-square w-full object-cover",loading:"lazy"}),t.jsxs("div",{className:"space-y-2 p-3",children:[t.jsx("input",{value:e.caption||"",onChange:a=>P(e,a.target.value),onFocus:()=>{N.current=e.caption||""},onBlur:()=>S(e),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r,t.jsx("button",{onClick:()=>_(e.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]})}),u.length===0&&t.jsx("p",{className:"py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})}export{J as default}; `)}`),s.error(`${n} hochgeladen, ${g.length} fehlgeschlagen.`))},P=(e,r)=>{h(a=>a.map(n=>n.id===e.id?{...n,caption:r}:n))},N=l.useRef(null),S=async e=>{if((e.caption||"")!==N.current)try{await d.put(`/gallery-photos/${e.id}`,{caption:e.caption,sort_order:e.sort_order}),s.success("Bildunterschrift gespeichert.")}catch(r){s.error(`Speichern fehlgeschlagen: ${r.message}`)}},_=async e=>{if(confirm("Foto wirklich entfernen?"))try{await d.delete(`/gallery-photos/${e}`),s.success("Foto entfernt."),x()}catch(r){s.error(`Entfernen fehlgeschlagen: ${r.message}`)}},R=async e=>{const r=u;h(e);try{h(await D("gallery-photos",e)),s.success("Reihenfolge gespeichert.")}catch(a){h(r),s.error(`Reihenfolge konnte nicht gespeichert werden: ${a.message}`)}};return t.jsxs("div",{children:[t.jsx("p",{className:"mb-2 text-sm",children:t.jsx(C,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),t.jsxs("div",{className:"mb-4 flex items-center justify-between gap-3",children:[t.jsxs("h1",{className:"text-xl font-bold text-neutral-900 dark:text-white",children:["Fotos im Projekt",c?`: ${c.brand_name} ${c.name}`:""]}),c&&t.jsx(G,{to:`/galerie/${c.brand_slug}/${c.slug}`})]}),t.jsxs("div",{className:"mb-6 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Fotos hinzufügen (Mehrfachauswahl möglich)"}),t.jsx("input",{ref:p,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:F,disabled:b,className:"text-sm"}),t.jsx("p",{className:"mt-1 text-xs text-neutral-400",children:"JPG, PNG oder WebP, große Fotos werden automatisch verkleinert."}),b&&t.jsx("p",{className:"mt-2 text-sm text-neutral-500","aria-live":"polite",children:$})]}),f&&t.jsx("p",{className:"mb-4 whitespace-pre-line text-sm text-red-600",children:f}),u.length>1&&t.jsx("p",{className:"mb-3 text-xs text-neutral-500 dark:text-neutral-400",children:"Reihenfolge am Griff per Ziehen ändern."}),t.jsx(M,{items:u,onReorder:R,as:"grid",className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:(e,r)=>t.jsxs("div",{className:"overflow-hidden rounded-xl border border-neutral-200 bg-white dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsx("img",{src:e.image_path,alt:e.caption||"",className:"aspect-square w-full object-cover",loading:"lazy"}),t.jsxs("div",{className:"space-y-2 p-3",children:[t.jsx("input",{value:e.caption||"",onChange:a=>P(e,a.target.value),onFocus:()=>{N.current=e.caption||""},onBlur:()=>S(e),placeholder:"Bildunterschrift (optional)",className:"w-full rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsxs("div",{className:"flex items-center justify-between gap-2",children:[r,t.jsx("button",{onClick:()=>_(e.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]})}),u.length===0&&t.jsx("p",{className:"py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})}export{J as default};

View file

@ -1 +0,0 @@
import{u as g,r as x,g as j,j as e,f as b,c as w,b as f,N as k,e as v,L as u,R as y}from"./index-Cc1wEeIX.js";function P({photos:l,index:s,onClose:t,onNavigate:n}){const{t:i}=g();if(x.useEffect(()=>{if(s==null)return;const r=a=>{a.key==="Escape"&&t(),a.key==="ArrowRight"&&n(1),a.key==="ArrowLeft"&&n(-1)};return window.addEventListener("keydown",r),()=>window.removeEventListener("keydown",r)},[s,t,n]),s==null)return null;const d=l[s],c=r=>r.stopPropagation();return j.createPortal(e.jsxs("div",{className:"fixed inset-0 z-[200] flex items-center justify-center bg-black/90 p-4",onClick:t,children:[e.jsx("button",{onClick:r=>{c(r),t()},"aria-label":i("lightbox.close"),className:"absolute right-4 top-4 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-7 w-7",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 6l12 12M18 6 6 18"})})}),l.length>1&&e.jsx("button",{onClick:r=>{c(r),n(-1)},"aria-label":i("lightbox.previous"),className:"absolute left-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:left-4",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m15 18-6-6 6-6"})})}),e.jsx("img",{src:d.image_path,alt:d.caption||"",onClick:c,className:"max-h-[85vh] max-w-full rounded-lg object-contain"}),l.length>1&&e.jsx("button",{onClick:r=>{c(r),n(1)},"aria-label":i("lightbox.next"),className:"absolute right-2 top-1/2 -translate-y-1/2 rounded-full p-2 text-white/80 hover:bg-white/10 hover:text-white sm:right-4",children:e.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",className:"h-8 w-8",children:e.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m9 18 6-6-6-6"})})}),d.caption&&e.jsx("p",{onClick:c,className:"absolute bottom-4 left-1/2 -translate-x-1/2 rounded-full bg-black/60 px-4 py-1.5 text-sm text-white",children:d.caption})]}),document.body)}function L(){const{brandSlug:l,projectSlug:s}=b(),[t,n]=x.useState(null),[i,d]=x.useState(null),[c,r]=x.useState(null),{t:a}=g();x.useEffect(()=>{w.get(`/gallery-brands/${l}/${s}/photos`).then(n).catch(o=>d(o))},[l,s]),f({title:t?`${t.project.name} – ${t.project.brand_name}`:a("galleryProjectPage.metaTitleFallback"),description:t?a("galleryProjectPage.metaDescription")(t.project.name):void 0,path:`/galerie/${l}/${s}`});const p=o=>{r(h=>{const m=t.photos.length;return(h+o+m)%m})};return i?i.status===404?e.jsx(k,{}):e.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-red-600 sm:px-6",children:v(i,a)}):t?e.jsxs("div",{className:"mx-auto max-w-6xl px-4 py-12 sm:px-6",children:[e.jsxs("p",{className:"mb-1 text-sm text-neutral-500 dark:text-neutral-400",children:[e.jsx(u,{to:"/galerie",className:"hover:text-brand-500",children:a("galleryProjectPage.breadcrumbGallery")})," /"," ",e.jsx(u,{to:`/galerie/${l}`,className:"hover:text-brand-500",children:t.project.brand_name})," / ",t.project.name]}),e.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.project.name}),t.photos.length===0&&e.jsx("p",{className:"text-neutral-500 dark:text-neutral-400",children:a("galleryProjectPage.empty")}),e.jsx("div",{className:"grid grid-cols-2 gap-3 sm:grid-cols-3",children:t.photos.map((o,h)=>e.jsx(y,{index:h%6,shine:!0,className:"aspect-square overflow-hidden rounded-xl",children:e.jsx("button",{onClick:()=>r(h),className:"block h-full w-full","aria-label":o.caption||a("galleryProjectPage.enlargeImage"),children:e.jsx("img",{src:o.image_path,alt:o.caption||"",loading:"lazy",decoding:"async",className:"h-full w-full object-cover transition duration-300 hover:scale-105"})})},o.id))}),e.jsxs("div",{className:"mt-12 flex flex-col items-start gap-4 rounded-2xl border border-neutral-200 bg-white p-6 shadow-sm dark:border-neutral-800 dark:bg-neutral-900 sm:flex-row sm:items-center sm:justify-between",children:[e.jsxs("div",{children:[e.jsx("h2",{className:"text-lg font-bold text-neutral-900 dark:text-white",children:a("galleryProjectPage.ctaTitle")}),e.jsx("p",{className:"mt-1 text-sm text-neutral-600 dark:text-neutral-300",children:a("galleryProjectPage.ctaText")})]}),e.jsx(u,{to:`/kontakt?${new URLSearchParams({topic:a("galleryProjectPage.ctaTopic")(t.project.name)}).toString()}`,className:"shrink-0 rounded-md bg-brand-500 px-5 py-3 text-sm font-semibold text-white shadow-sm hover:bg-brand-600",children:a("galleryProjectPage.ctaButton")})]}),e.jsx(P,{photos:t.photos,index:c,onClose:()=>r(null),onNavigate:p})]}):e.jsx("p",{className:"mx-auto max-w-6xl px-4 py-12 text-neutral-500 sm:px-6",children:a("galleryProjectPage.loading")})}export{L as default};

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

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{r,c as u,j as e}from"./index-Cc1wEeIX.js";function h({compact:m=!1}){const[n,i]=r.useState(!1),[s,l]=r.useState(null),[d,o]=r.useState(""),[t,c]=r.useState(null);r.useEffect(()=>{u.get("/settings/compress-status").then(a=>c(a.gd_available)).catch(()=>c(!1))},[]);const b=async()=>{i(!0),o(""),l(null);try{l(await u.post("/settings/compress-uploads",{}))}catch(a){o(a.message)}finally{i(!1)}};return e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:"Bilder optimieren"}),t!==null&&e.jsx("span",{className:`rounded-full px-3 py-1 text-xs font-semibold ${t?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"}`,children:t?"Aktiv":"Nicht verfügbar"})]}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:m?"Verkleinert alle bereits hochgeladenen Fotos, damit die Seite schneller lädt. Neue Bilder werden automatisch verkleinert.":"Neu hochgeladene Bilder werden automatisch verkleinert und komprimiert. Dieser Button holt das für alle bereits vorhandenen Bilder nach – nützlich, wenn die Seite durch zu hoch aufgelöste Fotos spürbar langsam lädt."}),t===!1&&e.jsx("p",{className:"mb-4 rounded-md bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:'Diese Funktion braucht die PHP-Erweiterung "gd", die auf diesem Server aktuell nicht aktiv ist. Bei den meisten Hostern (auch All-Inkl) ist sie Teil jeder PHP-Version – bitte beim Hoster-Support nachfragen bzw. prüfen, ob in den Hosting-Einstellungen eine andere PHP-Version ausgewählt werden muss.'}),e.jsx("button",{type:"button",onClick:b,disabled:n||t===!1,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:n?"Optimiert… bitte warten":"Bestehende Bilder optimieren"}),d&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:d}),s&&e.jsxs("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:[s.processed," Bild(er) verkleinert: ",(s.before_bytes/1024/1024).toFixed(1)," MB"," → ",(s.after_bytes/1024/1024).toFixed(1)," MB."]})]})}export{h as I}; import{r,c as u,j as e}from"./index-DPjtOB4k.js";function h({compact:m=!1}){const[n,i]=r.useState(!1),[s,l]=r.useState(null),[d,o]=r.useState(""),[t,c]=r.useState(null);r.useEffect(()=>{u.get("/settings/compress-status").then(a=>c(a.gd_available)).catch(()=>c(!1))},[]);const b=async()=>{i(!0),o(""),l(null);try{l(await u.post("/settings/compress-uploads",{}))}catch(a){o(a.message)}finally{i(!1)}};return e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[e.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:"Bilder optimieren"}),t!==null&&e.jsx("span",{className:`rounded-full px-3 py-1 text-xs font-semibold ${t?"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300":"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"}`,children:t?"Aktiv":"Nicht verfügbar"})]}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:m?"Verkleinert alle bereits hochgeladenen Fotos, damit die Seite schneller lädt. Neue Bilder werden automatisch verkleinert.":"Neu hochgeladene Bilder werden automatisch verkleinert und komprimiert. Dieser Button holt das für alle bereits vorhandenen Bilder nach – nützlich, wenn die Seite durch zu hoch aufgelöste Fotos spürbar langsam lädt."}),t===!1&&e.jsx("p",{className:"mb-4 rounded-md bg-amber-50 p-3 text-sm text-amber-800 dark:bg-amber-900/20 dark:text-amber-300",children:'Diese Funktion braucht die PHP-Erweiterung "gd", die auf diesem Server aktuell nicht aktiv ist. Bei den meisten Hostern (auch All-Inkl) ist sie Teil jeder PHP-Version – bitte beim Hoster-Support nachfragen bzw. prüfen, ob in den Hosting-Einstellungen eine andere PHP-Version ausgewählt werden muss.'}),e.jsx("button",{type:"button",onClick:b,disabled:n||t===!1,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:n?"Optimiert… bitte warten":"Bestehende Bilder optimieren"}),d&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:d}),s&&e.jsxs("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:[s.processed," Bild(er) verkleinert: ",(s.before_bytes/1024/1024).toFixed(1)," MB"," → ",(s.after_bytes/1024/1024).toFixed(1)," MB."]})]})}export{h as I};

File diff suppressed because one or more lines are too long

View file

@ -0,0 +1 @@
import{j as s}from"./index-DPjtOB4k.js";import{L as e}from"./LegalPageView-CftQhY6B.js";function i(){return s.jsx(e,{slug:"impressum",fallbackTitle:"Impressum",description:"Impressum von HifiPlanet Amorbach gemäß § 5 DDG."})}export{i as default};

View file

@ -1 +0,0 @@
import{r as s,c as l,b as r,j as e}from"./index-Cc1wEeIX.js";function n(){const[t,a]=s.useState(null);return s.useEffect(()=>{l.get("/legal-pages/impressum").then(a).catch(()=>{})},[]),r({title:(t==null?void 0:t.title)||"Impressum",description:"Impressum von HifiPlanet Amorbach gemäß § 5 DDG.",path:"/impressum"}),t?e.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[e.jsx("h1",{className:"mb-8 text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl",children:t.title}),e.jsx("div",{className:"legal-content text-sm text-neutral-600 dark:text-neutral-300",dangerouslySetInnerHTML:{__html:t.body_html}})]}):null}export{n as default};

View file

@ -0,0 +1 @@
import{r as l,c as n,b as r,j as a,d,i as m}from"./index-DPjtOB4k.js";function c({slug:e,fallbackTitle:s,description:i}){const[t,x]=l.useState(null);return l.useEffect(()=>{n.get(`/legal-pages/${e}`).then(x).catch(()=>{})},[e]),r({title:(t==null?void 0:t.title)||s,description:i,path:`/${e}`}),t?a.jsxs("div",{className:"mx-auto max-w-3xl px-4 py-12 sm:px-6",children:[a.jsx(d,{entity:"legal_pages",id:e,field:"title",lang:"de",value:t.title,as:"h1",className:"mb-8 block text-2xl font-bold text-neutral-900 dark:text-white sm:text-3xl"}),a.jsx(m,{entity:"legal_pages",id:e,field:"body_html",lang:"de",value:t.body_html,label:t.title,className:"legal-content text-sm text-neutral-600 dark:text-neutral-300"})]}):null}export{c as L};

View file

@ -1 +0,0 @@
import{r as s,c as b,j as e}from"./index-Cc1wEeIX.js";import{R as v}from"./RichTextEditor-BGWsKoCk.js";const j=[{slug:"impressum",label:"Impressum"},{slug:"datenschutz",label:"Datenschutzerklärung"},{slug:"agb",label:"AGB"}];function k(){const[d,u]=s.useState(null),[r,h]=s.useState("impressum"),[c,i]=s.useState(!1),[o,n]=s.useState(""),[g,l]=s.useState(!1);if(s.useEffect(()=>{b.get("/legal-pages").then(u)},[]),!d)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const a=d[r],m=(t,f)=>{u(x=>({...x,[r]:{...x[r],[t]:f}})),l(!1)},p=async()=>{i(!0),n(""),l(!1);try{await b.put(`/legal-pages/${r}`,{title:a.title,body_html:a.body_html}),l(!0)}catch(t){n(t.message)}finally{i(!1)}};return e.jsx("div",{className:"max-w-3xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Rechtstexte"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Impressum, Datenschutzerklärung und AGB direkt hier pflegen, statt einen Deploy für jede Textänderung zu brauchen. Bitte bei Rechtstexten im Zweifel rechtlich beraten lassen, bevor du größere Änderungen veröffentlichst."}),e.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:j.map(t=>e.jsx("button",{type:"button",onClick:()=>{h(t.slug),l(!1),n("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${r===t.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:t.label},t.slug))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),e.jsx("input",{value:a.title,onChange:t=>m("title",t.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"})]}),e.jsx(v,{label:"Inhalt",value:a.body_html,onChange:t=>m("body_html",t)})]}),a.updated_at&&e.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(a.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),o&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:o}),g&&e.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Speichere…":"Speichern"})]})})}export{k as default};

View file

@ -0,0 +1 @@
import{r as s,c as b,j as e}from"./index-DPjtOB4k.js";import v from"./RichTextEditor-C9ovXVWM.js";const j=[{slug:"impressum",label:"Impressum"},{slug:"datenschutz",label:"Datenschutzerklärung"},{slug:"agb",label:"AGB"}];function k(){const[d,u]=s.useState(null),[r,h]=s.useState("impressum"),[c,i]=s.useState(!1),[o,n]=s.useState(""),[g,l]=s.useState(!1);if(s.useEffect(()=>{b.get("/legal-pages").then(u)},[]),!d)return e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"});const a=d[r],m=(t,f)=>{u(x=>({...x,[r]:{...x[r],[t]:f}})),l(!1)},p=async()=>{i(!0),n(""),l(!1);try{await b.put(`/legal-pages/${r}`,{title:a.title,body_html:a.body_html}),l(!0)}catch(t){n(t.message)}finally{i(!1)}};return e.jsx("div",{className:"max-w-3xl space-y-6",children:e.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"mb-1 font-semibold text-neutral-900 dark:text-white",children:"Rechtstexte"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Impressum, Datenschutzerklärung und AGB direkt hier pflegen, statt einen Deploy für jede Textänderung zu brauchen. Bitte bei Rechtstexten im Zweifel rechtlich beraten lassen, bevor du größere Änderungen veröffentlichst."}),e.jsx("div",{className:"mb-4 flex flex-wrap gap-2",children:j.map(t=>e.jsx("button",{type:"button",onClick:()=>{h(t.slug),l(!1),n("")},className:`rounded-md px-3 py-1.5 text-sm font-medium transition ${r===t.slug?"bg-brand-500 text-white":"border border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800"}`,children:t.label},t.slug))}),e.jsxs("div",{className:"space-y-3",children:[e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Überschrift"}),e.jsx("input",{value:a.title,onChange:t=>m("title",t.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"})]}),e.jsx(v,{label:"Inhalt",value:a.body_html,onChange:t=>m("body_html",t)})]}),a.updated_at&&e.jsxs("p",{className:"mt-3 text-xs text-neutral-400",children:["Zuletzt geändert: ",new Date(a.updated_at.replace(" ","T")).toLocaleString("de-DE")]}),o&&e.jsx("p",{className:"mt-3 text-sm text-red-600",children:o}),g&&e.jsx("p",{className:"mt-3 text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),e.jsx("button",{type:"button",onClick:p,disabled:c,className:"mt-4 rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:c?"Speichere…":"Speichern"})]})})}export{k as default};

View file

@ -1 +1 @@
import{h as N,i as v,r,j as e,k as y,l as C,m as S}from"./index-Cc1wEeIX.js";function P(){const{user:x,login:h,verifyTwoFactor:g}=N(),o=v(),[f,u]=r.useState("credentials"),[i,p]=r.useState(""),[c,w]=r.useState(""),[m,b]=r.useState(""),[s,a]=r.useState(""),[n,l]=r.useState(!1);if(x)return e.jsx(y,{to:"/admin",replace:!0});const k=async t=>{t.preventDefault(),l(!0),a("");try{(await h(i,c)).requires2fa?u("code"):o("/admin")}catch(d){a(d.message)}finally{l(!1)}},j=async t=>{t.preventDefault(),l(!0),a("");try{await g(m),o("/admin")}catch(d){a(d.message)}finally{l(!1)}};return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[e.jsx("img",{src:C,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),e.jsx("img",{src:S,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),f==="credentials"?e.jsxs("form",{onSubmit:k,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),e.jsx("input",{value:i,onChange:t=>p(t.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),e.jsx("input",{type:"password",value:c,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Anmelden…":"Anmelden"})]}):e.jsxs("form",{onSubmit:j,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),e.jsx("input",{value:m,onChange:t=>b(t.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Prüfe…":"Bestätigen"}),e.jsx("button",{type:"button",onClick:()=>{u("credentials"),b(""),a("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}export{P as default}; import{k as N,m as v,r,j as e,n as y,l as C,o as S}from"./index-DPjtOB4k.js";function P(){const{user:x,login:h,verifyTwoFactor:g}=N(),o=v(),[f,u]=r.useState("credentials"),[i,p]=r.useState(""),[c,w]=r.useState(""),[m,b]=r.useState(""),[s,a]=r.useState(""),[n,l]=r.useState(!1);if(x)return e.jsx(y,{to:"/admin",replace:!0});const k=async t=>{t.preventDefault(),l(!0),a("");try{(await h(i,c)).requires2fa?u("code"):o("/admin")}catch(d){a(d.message)}finally{l(!1)}},j=async t=>{t.preventDefault(),l(!0),a("");try{await g(m),o("/admin")}catch(d){a(d.message)}finally{l(!1)}};return e.jsxs("div",{className:"flex min-h-screen flex-col items-center justify-center gap-6 bg-neutral-50 px-4 dark:bg-neutral-950",children:[e.jsx("img",{src:C,alt:"HifiPlanet",className:"h-16 w-auto dark:hidden sm:h-20"}),e.jsx("img",{src:S,alt:"HifiPlanet",className:"hidden h-16 w-auto dark:block sm:h-20"}),f==="credentials"?e.jsxs("form",{onSubmit:k,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-6 text-xl font-bold text-neutral-900 dark:text-white",children:"Admin-Login"}),e.jsxs("div",{className:"mb-4",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Benutzername"}),e.jsx("input",{value:i,onChange:t=>p(t.target.value),required:!0,autoFocus:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Passwort"}),e.jsx("input",{type:"password",value:c,onChange:t=>w(t.target.value),required:!0,className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Anmelden…":"Anmelden"})]}):e.jsxs("form",{onSubmit:j,className:"w-full max-w-sm rounded-xl border border-neutral-200 bg-white p-8 shadow-sm dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h1",{className:"mb-2 text-xl font-bold text-neutral-900 dark:text-white",children:"Bestätigungscode"}),e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:"Öffne die Google Authenticator App und gib den 6-stelligen Code ein. Alternativ kannst du auch einen deiner Wiederherstellungscodes verwenden."}),e.jsxs("div",{className:"mb-6",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Code"}),e.jsx("input",{value:m,onChange:t=>b(t.target.value),required:!0,autoFocus:!0,inputMode:"numeric",placeholder:"123456",className:"w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-center text-lg tracking-widest focus:border-brand-500 focus:outline-none dark:border-neutral-700 dark:bg-neutral-900"})]}),s&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:s}),e.jsx("button",{type:"submit",disabled:n,className:"w-full rounded-md bg-brand-500 px-4 py-2.5 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:n?"Prüfe…":"Bestätigen"}),e.jsx("button",{type:"button",onClick:()=>{u("credentials"),b(""),a("")},className:"mt-3 w-full text-sm text-neutral-500 hover:underline dark:text-neutral-400",children:"Zurück zum Login"})]})]})}export{P as default};

View file

@ -1 +1 @@
import{r as s,c as o,j as a}from"./index-Cc1wEeIX.js";const v={global:{enabled:!1,message:""},services:{enabled:!1,message:""},vehicles:{enabled:!1,message:""}};function N(){const[l,n]=s.useState(v),[g,h]=s.useState(!0),[i,d]=s.useState(!1),[x,r]=s.useState(!1),[c,u]=s.useState("");s.useEffect(()=>{o.get("/maintenance").then(e=>{n({global:{enabled:e.global.enabled,message:e.global.message||""},services:{enabled:e.services.enabled,message:e.services.message||""},vehicles:{enabled:e.vehicles.enabled,message:e.vehicles.message||""}})}).finally(()=>h(!1))},[]);const m=(e,t,k)=>{n(b=>({...b,[e]:{...b[e],[t]:k}})),r(!1)},p=async e=>{e.preventDefault(),d(!0),u(""),r(!1);try{const t=await o.post("/maintenance",l);n({global:{enabled:t.global.enabled,message:t.global.message||""},services:{enabled:t.services.enabled,message:t.services.message||""},vehicles:{enabled:t.vehicles.enabled,message:t.vehicles.message||""}}),r(!0)}catch(t){u(t.message)}finally{d(!1)}},f=[{key:"global",title:"Gesamte Seite",hint:"Besucher sehen nur noch eine Wartungsmeldung – egal welche Seite sie aufrufen. Das Admin-Panel bleibt für dich erreichbar."},{key:"services",title:"Nur Leistungen",hint:"Nur die Leistungen-Seite zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."},{key:"vehicles",title:"Nur Fahrzeugkatalog",hint:"Nur die Fahrzeugauswahl (Marke → Modell → Pakete) zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."}];return g?a.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):a.jsxs("form",{onSubmit:p,className:"max-w-2xl space-y-6",children:[a.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:'Ist "Gesamte Seite" aktiv, gewinnt das immer – die beiden anderen Schalter spielen dann keine Rolle mehr.'}),f.map(e=>a.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:e.title}),a.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[a.jsx("input",{type:"checkbox",checked:l[e.key].enabled,onChange:t=>m(e.key,"enabled",t.target.checked),className:"peer sr-only"}),a.jsx("div",{className:"h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 dark:bg-neutral-700"}),a.jsx("div",{className:"absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5"})]})]}),a.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:e.hint}),a.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Eigene Nachricht (optional)"}),a.jsx("textarea",{rows:2,value:l[e.key].message,onChange:t=>m(e.key,"message",t.target.value),placeholder:"z. B. Wir aktualisieren gerade unser Angebot. Schau bald wieder vorbei!",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"})]},e.key)),c&&a.jsx("p",{className:"text-sm text-red-600",children:c}),x&&a.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),a.jsx("button",{type:"submit",disabled:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":"Speichern"})]})}export{N as default}; import{r as s,c as o,j as a}from"./index-DPjtOB4k.js";const v={global:{enabled:!1,message:""},services:{enabled:!1,message:""},vehicles:{enabled:!1,message:""}};function N(){const[l,n]=s.useState(v),[g,h]=s.useState(!0),[i,d]=s.useState(!1),[x,r]=s.useState(!1),[c,u]=s.useState("");s.useEffect(()=>{o.get("/maintenance").then(e=>{n({global:{enabled:e.global.enabled,message:e.global.message||""},services:{enabled:e.services.enabled,message:e.services.message||""},vehicles:{enabled:e.vehicles.enabled,message:e.vehicles.message||""}})}).finally(()=>h(!1))},[]);const m=(e,t,k)=>{n(b=>({...b,[e]:{...b[e],[t]:k}})),r(!1)},p=async e=>{e.preventDefault(),d(!0),u(""),r(!1);try{const t=await o.post("/maintenance",l);n({global:{enabled:t.global.enabled,message:t.global.message||""},services:{enabled:t.services.enabled,message:t.services.message||""},vehicles:{enabled:t.vehicles.enabled,message:t.vehicles.message||""}}),r(!0)}catch(t){u(t.message)}finally{d(!1)}},f=[{key:"global",title:"Gesamte Seite",hint:"Besucher sehen nur noch eine Wartungsmeldung – egal welche Seite sie aufrufen. Das Admin-Panel bleibt für dich erreichbar."},{key:"services",title:"Nur Leistungen",hint:"Nur die Leistungen-Seite zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."},{key:"vehicles",title:"Nur Fahrzeugkatalog",hint:"Nur die Fahrzeugauswahl (Marke → Modell → Pakete) zeigt eine Wartungsmeldung, der Rest der Website funktioniert normal."}];return g?a.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}):a.jsxs("form",{onSubmit:p,className:"max-w-2xl space-y-6",children:[a.jsx("p",{className:"text-sm text-neutral-500 dark:text-neutral-400",children:'Ist "Gesamte Seite" aktiv, gewinnt das immer – die beiden anderen Schalter spielen dann keine Rolle mehr.'}),f.map(e=>a.jsxs("section",{className:"rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900",children:[a.jsxs("div",{className:"mb-1 flex items-center justify-between gap-3",children:[a.jsx("h2",{className:"font-semibold text-neutral-900 dark:text-white",children:e.title}),a.jsxs("label",{className:"relative inline-flex cursor-pointer items-center",children:[a.jsx("input",{type:"checkbox",checked:l[e.key].enabled,onChange:t=>m(e.key,"enabled",t.target.checked),className:"peer sr-only"}),a.jsx("div",{className:"h-6 w-11 rounded-full bg-neutral-200 transition peer-checked:bg-brand-500 dark:bg-neutral-700"}),a.jsx("div",{className:"absolute left-1 top-1 h-4 w-4 rounded-full bg-white transition peer-checked:translate-x-5"})]})]}),a.jsx("p",{className:"mb-3 text-sm text-neutral-500 dark:text-neutral-400",children:e.hint}),a.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Eigene Nachricht (optional)"}),a.jsx("textarea",{rows:2,value:l[e.key].message,onChange:t=>m(e.key,"message",t.target.value),placeholder:"z. B. Wir aktualisieren gerade unser Angebot. Schau bald wieder vorbei!",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"})]},e.key)),c&&a.jsx("p",{className:"text-sm text-red-600",children:c}),x&&a.jsx("p",{className:"text-sm text-green-600 dark:text-green-400",children:"Gespeichert."}),a.jsx("button",{type:"submit",disabled:i,className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":"Speichern"})]})}export{N as default};

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

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{r as n,j as e,c as i}from"./index-Cc1wEeIX.js";const h={name:"",description:"",permissions:[]};function w(){const[c,b]=n.useState([]),[o,g]=n.useState([]),[r,a]=n.useState(h),[l,u]=n.useState(null),[m,x]=n.useState(""),d=()=>{i.get("/permission-groups").then(b),i.get("/permissions/catalog").then(g)};n.useEffect(d,[]);const j=t=>{u(t.id),a({name:t.name,description:t.description||"",permissions:t.permissions})},p=()=>{u(null),a(h)},N=t=>{a(s=>({...s,permissions:s.permissions.includes(t)?s.permissions.filter(y=>y!==t):[...s.permissions,t]}))},k=async t=>{t.preventDefault(),x("");try{l?await i.put(`/permission-groups/${l}`,r):await i.post("/permission-groups",r),p(),d()}catch(s){x(s.message)}},f=async t=>{confirm("Diese Berechtigungsgruppe wirklich löschen? Benutzer behalten ihre sonstigen Rechte.")&&(await i.delete(`/permission-groups/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Berechtigungsgruppen"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Fasse mehrere Berechtigungen zu einer Gruppe zusammen (z. B. „Werkstatt"), die du dann bequem einem oder mehreren Benutzern zuweisen kannst.'}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Berechtigungen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[c.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),t.description&&e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:t.description})]}),e.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[t.permissions.length," von ",o.length]}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>j(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>f(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),c.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:k,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:l?"Gruppe bearbeiten":"Neue Gruppe"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),e.jsx("textarea",{rows:2,value:r.description,onChange:t=>a({...r,description:t.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"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungen"}),e.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:o.map(t=>e.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[e.jsx("input",{type:"checkbox",checked:r.permissions.includes(t.key),onChange:()=>N(t.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),t.label]},t.key))})]}),m&&e.jsx("p",{className:"text-sm text-red-600",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:l?"Speichern":"Anlegen"}),l&&e.jsx("button",{type:"button",onClick:p,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{w as default}; import{r as n,j as e,c as i}from"./index-DPjtOB4k.js";const h={name:"",description:"",permissions:[]};function w(){const[c,b]=n.useState([]),[o,g]=n.useState([]),[r,a]=n.useState(h),[l,u]=n.useState(null),[m,x]=n.useState(""),d=()=>{i.get("/permission-groups").then(b),i.get("/permissions/catalog").then(g)};n.useEffect(d,[]);const j=t=>{u(t.id),a({name:t.name,description:t.description||"",permissions:t.permissions})},p=()=>{u(null),a(h)},N=t=>{a(s=>({...s,permissions:s.permissions.includes(t)?s.permissions.filter(y=>y!==t):[...s.permissions,t]}))},k=async t=>{t.preventDefault(),x("");try{l?await i.put(`/permission-groups/${l}`,r):await i.post("/permission-groups",r),p(),d()}catch(s){x(s.message)}},f=async t=>{confirm("Diese Berechtigungsgruppe wirklich löschen? Benutzer behalten ihre sonstigen Rechte.")&&(await i.delete(`/permission-groups/${t}`),d())};return e.jsxs("div",{className:"grid gap-6 lg:grid-cols-3",children:[e.jsxs("div",{className:"lg:col-span-2",children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Berechtigungsgruppen"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:'Fasse mehrere Berechtigungen zu einer Gruppe zusammen (z. B. „Werkstatt"), die du dann bequem einem oder mehreren Benutzern zuweisen kannst.'}),e.jsx("div",{className:"overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800",children:e.jsxs("table",{className:"w-full text-left text-sm",children:[e.jsx("thead",{className:"bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400",children:e.jsxs("tr",{children:[e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Berechtigungen"}),e.jsx("th",{className:"px-4 py-2 text-right",children:"Aktionen"})]})}),e.jsxs("tbody",{className:"divide-y divide-neutral-100 dark:divide-neutral-800",children:[c.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx("p",{className:"font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),t.description&&e.jsx("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:t.description})]}),e.jsxs("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:[t.permissions.length," von ",o.length]}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>j(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>f(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),c.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:3,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Berechtigungsgruppen angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:k,className:"h-fit space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsx("h2",{className:"font-bold text-neutral-900 dark:text-white",children:l?"Gruppe bearbeiten":"Neue Gruppe"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name *"}),e.jsx("input",{required:!0,value:r.name,onChange:t=>a({...r,name:t.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"})]}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Beschreibung"}),e.jsx("textarea",{rows:2,value:r.description,onChange:t=>a({...r,description:t.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"})]}),e.jsxs("div",{children:[e.jsx("p",{className:"mb-1 text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Berechtigungen"}),e.jsx("div",{className:"space-y-1.5 rounded-md border border-neutral-200 p-3 dark:border-neutral-700",children:o.map(t=>e.jsxs("label",{className:"flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300",children:[e.jsx("input",{type:"checkbox",checked:r.permissions.includes(t.key),onChange:()=>N(t.key),className:"h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"}),t.label]},t.key))})]}),m&&e.jsx("p",{className:"text-sm text-red-600",children:m}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx("button",{type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600",children:l?"Speichern":"Anlegen"}),l&&e.jsx("button",{type:"button",onClick:p,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{w as default};

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{j as e}from"./index-Cc1wEeIX.js";function m({dirty:t,busy:i,savedAt:a,onSave:n,label:s="Speichern",form:r}){return e.jsx("div",{className:"sticky bottom-0 z-20 -mx-4 mt-6 border-t border-neutral-200 bg-white/95 px-4 py-3 backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:-mx-6 sm:px-6",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:`text-sm ${t?"font-medium text-amber-600 dark:text-amber-400":"text-neutral-500 dark:text-neutral-400"}`,children:t?"● Ungespeicherte Änderungen":a?`✓ Gespeichert um ${a.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})} Uhr`:"Alles gespeichert"}),e.jsx("button",{type:r?"submit":"button",form:r,onClick:r?void 0:n,disabled:i||!t,className:"rounded-md bg-brand-500 px-5 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":s})]})})}export{m as S}; import{j as e}from"./index-DPjtOB4k.js";function m({dirty:t,busy:i,savedAt:a,onSave:n,label:s="Speichern",form:r}){return e.jsx("div",{className:"sticky bottom-0 z-20 -mx-4 mt-6 border-t border-neutral-200 bg-white/95 px-4 py-3 backdrop-blur dark:border-neutral-800 dark:bg-neutral-950/95 sm:-mx-6 sm:px-6",children:e.jsxs("div",{className:"flex flex-wrap items-center justify-between gap-3",children:[e.jsx("p",{className:`text-sm ${t?"font-medium text-amber-600 dark:text-amber-400":"text-neutral-500 dark:text-neutral-400"}`,children:t?"● Ungespeicherte Änderungen":a?`✓ Gespeichert um ${a.toLocaleTimeString("de-DE",{hour:"2-digit",minute:"2-digit"})} Uhr`:"Alles gespeichert"}),e.jsx("button",{type:r?"submit":"button",form:r,onClick:r?void 0:n,disabled:i||!t,className:"rounded-md bg-brand-500 px-5 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50",children:i?"Speichere…":s})]})})}export{m as S};

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{x as a,j as e,r as i,O as u}from"./index-Cc1wEeIX.js";const d={company:["Firmendaten","Telefon, Adresse, Öffnungszeiten, Logo und der Hinweis unter den Paketpreisen."],design:["Aussehen","Titelbild, Schriften und das Aussehen der Kacheln auf der Website."],legal:["Rechtstexte","Impressum, Datenschutzerklärung und AGB."],maintenance:["Wartungsmodus","Die ganze Website oder einzelne Bereiche vorübergehend für Besucher sperren."],email:["E-Mail-Versand","Zugangsdaten des Mail-Servers und die Texte der automatischen E-Mails."],google:["Google-Dienste","Google Analytics und Google-Bewertungen anbinden. Nur für Techniker."],database:["Datenbank","Verbindung und Struktur der Datenbank. Nur für Techniker."],"export-import":["Export & Import","Sicherung herunterladen oder auf einem anderen Server einspielen."],update:["Updates","Neue Versionen der Website installieren."],reset:["Zurücksetzen","Inhalte auf den Auslieferungszustand zurücksetzen. Vorher unbedingt exportieren."]};function o(){const{pathname:t}=a(),r=t.replace(/\/$/,"").split("/").pop(),[s,n]=d[r]||["Einstellungen",""];return e.jsxs("div",{children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:s}),n&&e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:n}),e.jsx(i.Suspense,{fallback:e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}),children:e.jsx(u,{})})]})}export{o as default}; import{B as a,j as e,r as i,O as u}from"./index-DPjtOB4k.js";const d={company:["Firmendaten","Telefon, Adresse, Öffnungszeiten, Logo und der Hinweis unter den Paketpreisen."],design:["Aussehen","Titelbild, Schriften und das Aussehen der Kacheln auf der Website."],legal:["Rechtstexte","Impressum, Datenschutzerklärung und AGB."],maintenance:["Wartungsmodus","Die ganze Website oder einzelne Bereiche vorübergehend für Besucher sperren."],email:["E-Mail-Versand","Zugangsdaten des Mail-Servers und die Texte der automatischen E-Mails."],google:["Google-Dienste","Google Analytics und Google-Bewertungen anbinden. Nur für Techniker."],database:["Datenbank","Verbindung und Struktur der Datenbank. Nur für Techniker."],"export-import":["Export & Import","Sicherung herunterladen oder auf einem anderen Server einspielen."],update:["Updates","Neue Versionen der Website installieren."],reset:["Zurücksetzen","Inhalte auf den Auslieferungszustand zurücksetzen. Vorher unbedingt exportieren."]};function o(){const{pathname:t}=a(),r=t.replace(/\/$/,"").split("/").pop(),[s,n]=d[r]||["Einstellungen",""];return e.jsxs("div",{children:[e.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:s}),n&&e.jsx("p",{className:"mb-6 text-sm text-neutral-500 dark:text-neutral-400",children:n}),e.jsx(i.Suspense,{fallback:e.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}),children:e.jsx(u,{})})]})}export{o as default};

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{j as o,c as x}from"./index-Cc1wEeIX.js";import{u as p,a as f,D as m,c as v,S as y,r as j,v as C,b as R,s as w,K as D,T as N,P as T,d as E,C as G}from"./sortable.esm-D8IvDAze.js";import{G as I}from"./grip-vertical-0BUKE4NU.js";function P({items:t,onReorder:s,children:n,as:e="ul",className:d="",disabled:i=!1}){const l=p(f(T,{activationConstraint:{distance:4}}),f(N,{activationConstraint:{delay:150,tolerance:6}}),f(D,{coordinateGetter:w})),c=({active:r,over:a})=>{if(!a||r.id===a.id)return;const h=t.findIndex(b=>b.id===r.id),S=t.findIndex(b=>b.id===a.id);s(R(t,h,S))},u=e==="tbody"?"tbody":e==="grid"?"div":"ul",g=e==="tbody"?"tr":e==="grid"?"div":"li";return o.jsx(m,{sensors:l,collisionDetection:v,onDragEnd:c,children:o.jsx(y,{items:t.map(r=>r.id),strategy:e==="grid"?j:C,disabled:i,children:o.jsx(u,{className:d,children:t.map(r=>o.jsx(K,{id:r.id,tag:g,disabled:i,children:a=>n(r,a)},r.id))})})})}function K({id:t,tag:s,disabled:n,children:e}){const{attributes:d,listeners:i,setNodeRef:l,setActivatorNodeRef:c,transform:u,transition:g,isDragging:r}=E({id:t,disabled:n}),a=n?null:o.jsx("button",{type:"button",ref:c,...d,...i,title:"Ziehen, um die Reihenfolge zu ändern","aria-label":"Reihenfolge ändern",className:"cursor-grab touch-none rounded p-1 text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600 active:cursor-grabbing dark:hover:bg-neutral-800",children:o.jsx(I,{className:"h-4 w-4"})});return o.jsx(s,{ref:l,style:{transform:G.Translate.toString(u),transition:g,position:"relative",zIndex:r?10:void 0},className:r?"bg-white shadow-lg ring-1 ring-brand-500 dark:bg-neutral-900":void 0,children:e(a)})}async function A(t,s){return await x.put(`/reorder/${t}`,{ids:s.map(n=>n.id)}),s.map((n,e)=>({...n,sort_order:(e+1)*10}))}export{P as S,A as s}; import{j as o,c as x}from"./index-DPjtOB4k.js";import{u as p,a as f,D as m,c as v,S as y,r as j,v as C,b as R,s as w,K as D,T as N,P as T,d as E,C as G}from"./sortable.esm-DcJMx5eJ.js";import{G as I}from"./grip-vertical-CUuB59gl.js";function P({items:t,onReorder:s,children:n,as:e="ul",className:d="",disabled:i=!1}){const l=p(f(T,{activationConstraint:{distance:4}}),f(N,{activationConstraint:{delay:150,tolerance:6}}),f(D,{coordinateGetter:w})),c=({active:r,over:a})=>{if(!a||r.id===a.id)return;const h=t.findIndex(b=>b.id===r.id),S=t.findIndex(b=>b.id===a.id);s(R(t,h,S))},u=e==="tbody"?"tbody":e==="grid"?"div":"ul",g=e==="tbody"?"tr":e==="grid"?"div":"li";return o.jsx(m,{sensors:l,collisionDetection:v,onDragEnd:c,children:o.jsx(y,{items:t.map(r=>r.id),strategy:e==="grid"?j:C,disabled:i,children:o.jsx(u,{className:d,children:t.map(r=>o.jsx(K,{id:r.id,tag:g,disabled:i,children:a=>n(r,a)},r.id))})})})}function K({id:t,tag:s,disabled:n,children:e}){const{attributes:d,listeners:i,setNodeRef:l,setActivatorNodeRef:c,transform:u,transition:g,isDragging:r}=E({id:t,disabled:n}),a=n?null:o.jsx("button",{type:"button",ref:c,...d,...i,title:"Ziehen, um die Reihenfolge zu ändern","aria-label":"Reihenfolge ändern",className:"cursor-grab touch-none rounded p-1 text-neutral-400 hover:bg-neutral-100 hover:text-neutral-600 active:cursor-grabbing dark:hover:bg-neutral-800",children:o.jsx(I,{className:"h-4 w-4"})});return o.jsx(s,{ref:l,style:{transform:G.Translate.toString(u),transition:g,position:"relative",zIndex:r?10:void 0},className:r?"bg-white shadow-lg ring-1 ring-brand-500 dark:bg-neutral-900":void 0,children:e(a)})}async function A(t,s){return await x.put(`/reorder/${t}`,{ids:s.map(n=>n.id)}),s.map((n,e)=>({...n,sort_order:(e+1)*10}))}export{P as S,A as s};

View file

@ -1 +1 @@
import{w as g,r as l,c as x,j as t}from"./index-Cc1wEeIX.js";const y=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],s={font_family:"",font_size:"",color:""};function k({fieldKey:o,previewText:p="Beispieltext",label:c="Stil"}){const b=g(),[a,n]=l.useState(s),[m,u]=l.useState(!0),[d,i]=l.useState("");l.useEffect(()=>{u(!0),x.get(`/text-styles/one?key=${encodeURIComponent(o)}`).then(e=>n({font_family:e.font_family||"",font_size:e.font_size||"",color:e.color||""})).catch(()=>n(s)).finally(()=>u(!1))},[o]);const r=async e=>{n(e),i("");try{await x.put("/text-styles",{field_key:o,...e})}catch(v){i(v.message)}};if(m)return null;const f={fontFamily:a.font_family||void 0,fontSize:a.font_size||void 0,color:a.color||void 0};return t.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:c}),t.jsx("select",{value:a.font_family,onChange:e=>r({...a,font_family:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:b.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("select",{value:a.font_size,onChange:e=>r({...a,font_size:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:y.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("input",{type:"color",value:a.color||"#000000",onChange:e=>r({...a,color:e.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),t.jsx("button",{type:"button",onClick:()=>r(s),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),t.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:f,children:p}),d&&t.jsx("span",{className:"text-xs text-red-600",children:d})]})}export{k as T}; import{z as g,r as l,c as x,j as t}from"./index-DPjtOB4k.js";const y=[{label:"Standard",value:""},{label:"S (14px)",value:"14px"},{label:"M (16px)",value:"16px"},{label:"L (18px)",value:"18px"},{label:"XL (20px)",value:"20px"},{label:"XXL (24px)",value:"24px"},{label:"XXXL (28px)",value:"28px"},{label:"Groß (36px)",value:"36px"},{label:"Riesig (48px)",value:"48px"}],s={font_family:"",font_size:"",color:""};function k({fieldKey:o,previewText:p="Beispieltext",label:c="Stil"}){const b=g(),[a,n]=l.useState(s),[m,u]=l.useState(!0),[d,i]=l.useState("");l.useEffect(()=>{u(!0),x.get(`/text-styles/one?key=${encodeURIComponent(o)}`).then(e=>n({font_family:e.font_family||"",font_size:e.font_size||"",color:e.color||""})).catch(()=>n(s)).finally(()=>u(!1))},[o]);const r=async e=>{n(e),i("");try{await x.put("/text-styles",{field_key:o,...e})}catch(v){i(v.message)}};if(m)return null;const f={fontFamily:a.font_family||void 0,fontSize:a.font_size||void 0,color:a.color||void 0};return t.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-2 rounded-md border border-neutral-200 bg-neutral-50 p-2 dark:border-neutral-700 dark:bg-neutral-800/50",children:[t.jsx("span",{className:"text-xs font-medium uppercase tracking-wide text-neutral-400",children:c}),t.jsx("select",{value:a.font_family,onChange:e=>r({...a,font_family:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:b.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("select",{value:a.font_size,onChange:e=>r({...a,font_size:e.target.value}),className:"rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900",children:y.map(e=>t.jsx("option",{value:e.value,children:e.label},e.label))}),t.jsx("input",{type:"color",value:a.color||"#000000",onChange:e=>r({...a,color:e.target.value}),className:"h-7 w-9 cursor-pointer rounded border border-neutral-300 bg-white p-0.5 dark:border-neutral-700 dark:bg-neutral-900",title:"Textfarbe"}),t.jsx("button",{type:"button",onClick:()=>r(s),className:"rounded-md border border-neutral-300 px-2 py-1 text-xs text-neutral-500 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-400 dark:hover:bg-neutral-700",children:"Zurücksetzen"}),t.jsx("span",{className:"ml-1 rounded px-2 py-1 text-sm",style:f,children:p}),d&&t.jsx("span",{className:"text-xs text-red-600",children:d})]})}export{k as T};

File diff suppressed because one or more lines are too long

View file

@ -1 +1 @@
import{j as n,E as a}from"./index-Cc1wEeIX.js";function i({to:e,label:r="Ansehen",className:t=""}){return e?n.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Auf der Website ansehen (neuer Tab)",className:`inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-brand-600 dark:text-neutral-400 ${t}`,children:[n.jsx(a,{className:"h-3.5 w-3.5"}),r]}):null}export{i as V}; import{j as n,x as a}from"./index-DPjtOB4k.js";function i({to:e,label:r="Ansehen",className:t=""}){return e?n.jsxs("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:"Auf der Website ansehen (neuer Tab)",className:`inline-flex items-center gap-1 text-xs font-medium text-neutral-500 hover:text-brand-600 dark:text-neutral-400 ${t}`,children:[n.jsx(a,{className:"h-3.5 w-3.5"}),r]}):null}export{i as V};

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{G as e}from"./index-Cc1wEeIX.js";/** import{I as e}from"./index-DPjtOB4k.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View file

@ -1,4 +1,4 @@
import{G as c}from"./index-Cc1wEeIX.js";/** import{I as c}from"./index-DPjtOB4k.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

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

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View file

@ -1,4 +1,4 @@
import{G as a}from"./index-Cc1wEeIX.js";/** import{I as a}from"./index-DPjtOB4k.js";/**
* @license lucide-react v1.23.0 - ISC * @license lucide-react v1.23.0 - ISC
* *
* This source code is licensed under the ISC license. * This source code is licensed under the ISC license.

View file

@ -1,4 +1,4 @@
import{r as c,v as P,g as Oe}from"./index-Cc1wEeIX.js";function Rn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:pt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Ut(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:pt(e)?bt(e)?e:Be(e)||Ut(e)?e.ownerDocument:document:document:document}const Q=et?c.useLayoutEffect:c.useEffect;function wt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Sn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function dt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let at={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=at[e]==null?0:at[e]+1;return at[e]=n,e+"-"+n},[e,t])}function Wt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Wt(1),ze=Wt(-1);function En(e){return"clientX"in e&&"clientY"in e}function mt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ft(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ot="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function In(e){return e.matches(Ot)?e:e.querySelector(Ot)}const An={display:"none"};function On(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:An},n)}function Tn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=c.createContext(null);function Ln(e){const t=c.useContext(Ht);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function kn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const zn={draggable:` import{r as c,y as P,h as Oe}from"./index-DPjtOB4k.js";function Rn(){for(var e=arguments.length,t=new Array(e),n=0;n<e;n++)t[n]=arguments[n];return c.useMemo(()=>r=>{t.forEach(o=>o(r))},t)}const et=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";function me(e){const t=Object.prototype.toString.call(e);return t==="[object Window]"||t==="[object global]"}function pt(e){return"nodeType"in e}function B(e){var t,n;return e?me(e)?e:pt(e)&&(t=(n=e.ownerDocument)==null?void 0:n.defaultView)!=null?t:window:window}function bt(e){const{Document:t}=B(e);return e instanceof t}function Be(e){return me(e)?!1:e instanceof B(e).HTMLElement}function Ut(e){return e instanceof B(e).SVGElement}function ye(e){return e?me(e)?e.document:pt(e)?bt(e)?e:Be(e)||Ut(e)?e.ownerDocument:document:document:document}const Q=et?c.useLayoutEffect:c.useEffect;function wt(e){const t=c.useRef(e);return Q(()=>{t.current=e}),c.useCallback(function(){for(var n=arguments.length,r=new Array(n),o=0;o<n;o++)r[o]=arguments[o];return t.current==null?void 0:t.current(...r)},[])}function Sn(){const e=c.useRef(null),t=c.useCallback((r,o)=>{e.current=setInterval(r,o)},[]),n=c.useCallback(()=>{e.current!==null&&(clearInterval(e.current),e.current=null)},[]);return[t,n]}function ke(e,t){t===void 0&&(t=[e]);const n=c.useRef(e);return Q(()=>{n.current!==e&&(n.current=e)},t),n}function Fe(e,t){const n=c.useRef();return c.useMemo(()=>{const r=e(n.current);return n.current=r,r},[...t])}function Ge(e){const t=wt(e),n=c.useRef(null),r=c.useCallback(o=>{o!==n.current&&(t==null||t(o,n.current)),n.current=o},[]);return[n,r]}function dt(e){const t=c.useRef();return c.useEffect(()=>{t.current=e},[e]),t.current}let at={};function $e(e,t){return c.useMemo(()=>{if(t)return t;const n=at[e]==null?0:at[e]+1;return at[e]=n,e+"-"+n},[e,t])}function Wt(e){return function(t){for(var n=arguments.length,r=new Array(n>1?n-1:0),o=1;o<n;o++)r[o-1]=arguments[o];return r.reduce((i,s)=>{const a=Object.entries(s);for(const[l,u]of a){const f=i[l];f!=null&&(i[l]=f+e*u)}return i},{...t})}}const we=Wt(1),ze=Wt(-1);function En(e){return"clientX"in e&&"clientY"in e}function mt(e){if(!e)return!1;const{KeyboardEvent:t}=B(e.target);return t&&e instanceof t}function Mn(e){if(!e)return!1;const{TouchEvent:t}=B(e.target);return t&&e instanceof t}function ft(e){if(Mn(e)){if(e.touches&&e.touches.length){const{clientX:t,clientY:n}=e.touches[0];return{x:t,y:n}}else if(e.changedTouches&&e.changedTouches.length){const{clientX:t,clientY:n}=e.changedTouches[0];return{x:t,y:n}}}return En(e)?{x:e.clientX,y:e.clientY}:null}const Je=Object.freeze({Translate:{toString(e){if(!e)return;const{x:t,y:n}=e;return"translate3d("+(t?Math.round(t):0)+"px, "+(n?Math.round(n):0)+"px, 0)"}},Scale:{toString(e){if(!e)return;const{scaleX:t,scaleY:n}=e;return"scaleX("+t+") scaleY("+n+")"}},Transform:{toString(e){if(e)return[Je.Translate.toString(e),Je.Scale.toString(e)].join(" ")}},Transition:{toString(e){let{property:t,duration:n,easing:r}=e;return t+" "+n+"ms "+r}}}),Ot="a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not(:disabled),*[tabindex]";function In(e){return e.matches(Ot)?e:e.querySelector(Ot)}const An={display:"none"};function On(e){let{id:t,value:n}=e;return P.createElement("div",{id:t,style:An},n)}function Tn(e){let{id:t,announcement:n,ariaLiveType:r="assertive"}=e;const o={position:"fixed",top:0,left:0,width:1,height:1,margin:-1,border:0,padding:0,overflow:"hidden",clip:"rect(0 0 0 0)",clipPath:"inset(100%)",whiteSpace:"nowrap"};return P.createElement("div",{id:t,style:o,role:"status","aria-live":r,"aria-atomic":!0},n)}function Nn(){const[e,t]=c.useState("");return{announce:c.useCallback(r=>{r!=null&&t(r)},[]),announcement:e}}const Ht=c.createContext(null);function Ln(e){const t=c.useContext(Ht);c.useEffect(()=>{if(!t)throw new Error("useDndMonitor must be used within a children of <DndContext>");return t(e)},[e,t])}function kn(){const[e]=c.useState(()=>new Set),t=c.useCallback(r=>(e.add(r),()=>e.delete(r)),[e]);return[c.useCallback(r=>{let{type:o,event:i}=r;e.forEach(s=>{var a;return(a=s[o])==null?void 0:a.call(s,i)})},[e]),t]}const zn={draggable:`
To pick up a draggable item, press the space bar. To pick up a draggable item, press the space bar.
While dragging, use the arrow keys to move the item. While dragging, use the arrow keys to move the item.
Press space again to drop the item in its new position, or press escape to cancel. Press space again to drop the item in its new position, or press escape to cancel.

View file

@ -0,0 +1,11 @@
import{I as a}from"./index-DPjtOB4k.js";/**
* @license lucide-react v1.23.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const e=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],o=a("refresh-cw",e);/**
* @license lucide-react v1.23.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],c=a("trash-2",t);export{o as R,c as T};

View file

@ -1,16 +0,0 @@
import{G as a}from"./index-Cc1wEeIX.js";/**
* @license lucide-react v1.23.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const e=[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]],h=a("pencil",e);/**
* @license lucide-react v1.23.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const t=[["path",{d:"M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8",key:"v9h5vc"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}],["path",{d:"M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16",key:"3uifl3"}],["path",{d:"M8 16H3v5",key:"1cv678"}]],d=a("refresh-cw",t);/**
* @license lucide-react v1.23.0 - ISC
*
* This source code is licensed under the ISC license.
* See the LICENSE file in the root directory of this source tree.
*/const o=[["path",{d:"M10 11v6",key:"nco0om"}],["path",{d:"M14 11v6",key:"outv1u"}],["path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6",key:"miytrc"}],["path",{d:"M3 6h18",key:"d0wm0j"}],["path",{d:"M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2",key:"e791ji"}]],s=a("trash-2",o);export{h as P,d as R,s as T};

View file

@ -49,8 +49,8 @@
"sameAs": ["https://www.youtube.com/@hifiplanet2812"] "sameAs": ["https://www.youtube.com/@hifiplanet2812"]
} }
</script> </script>
<script type="module" crossorigin src="/assets/index-Cc1wEeIX.js"></script> <script type="module" crossorigin src="/assets/index-DPjtOB4k.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-DJmr5-XD.css"> <link rel="stylesheet" crossorigin href="/assets/index-CvX9Fs7t.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>