Add package badges/visibility and a download area, speed up the site
Customer feedback round (4 items):
- Packages: one-click "Sichtbar/Ausgeblendet" toggle per package (saved
immediately). Hidden packages disappear from the model page; the tier
look of the remaining cards is ranked across all packages so it stays
stable.
- Packages: badge per card (Empfohlen, Am beliebtesten, Tipp, Coming soon
or custom text) plus an optional video link shown as "Zum Video". Legacy
is_featured maps to "Empfohlen".
- New download area (/downloads + Admin -> Downloads): upload with
progress, inline audio player, allow-listed file types, optional access
password, new permission downloads.manage. Files live in
api/uploads/downloads/ (gitignored, created at runtime).
- Performance:
- SetupGate no longer refetches and remounts the whole app on every
navigation.
- Page loader waits only for pending API calls and above-the-fold images
(fixes an 8 s hang on /leistungen caused by lazy images inside the
hidden container).
- Admin pages lazy-loaded; icon library moved out of the main bundle
(initial JS 2.2 MB -> 0.48 MB).
- Background video loads only near the viewport and was re-encoded to
720p (32 MB -> 8.5 MB).
- Visitors without a session cookie get no PHP session, so their parallel
API requests no longer queue on the session lock.
- index.html is served with Cache-Control: no-cache so browsers don't
keep a stale build after deploys.
- Fonts (Barlow, Barlow Condensed, Michroma) are self-hosted instead of
loaded from Google Fonts; the default privacy policy mentions this, lists
all local storage uses and uses the new TDDDG name.
- A code update that adds a table no longer sends the site into the setup
wizard while an admin exists.
Run "Datenbankstruktur aktualisieren" after deploying (new package
columns, downloads table, app_settings.downloads_password).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
2a8de48568
commit
54928d1411
126 changed files with 4201 additions and 2540 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
|
@ -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
|
||||||
|
|
||||||
|
# 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
|
||||||
|
# wird vom DownloadController beim ersten Upload selbst angelegt.
|
||||||
|
/hifi/api/uploads/downloads/
|
||||||
|
|
||||||
# Arbeits-/Backup-Verzeichnis des Auto-Update-Features. Die Backup-ZIPs darin enthalten
|
# Arbeits-/Backup-Verzeichnis des Auto-Update-Features. Die Backup-ZIPs darin enthalten
|
||||||
# zwangsläufig db.php (siehe oben) - darf NIE ins Repo gelangen, sonst landen
|
# zwangsläufig db.php (siehe oben) - darf NIE ins Repo gelangen, sonst landen
|
||||||
# Datenbank-Zugangsdaten im (öffentlichen!) Git-Repo.
|
# Datenbank-Zugangsdaten im (öffentlichen!) Git-Repo.
|
||||||
|
|
|
||||||
|
|
@ -4,11 +4,8 @@
|
||||||
<meta charset="UTF-8" />
|
<meta charset="UTF-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||||
<link rel="icon" type="image/png" href="/favicon.png" />
|
<link rel="icon" type="image/png" href="/favicon.png" />
|
||||||
<!-- Nur fuer die Paket-Kacheln auf der Modell-Seite (Name/Preis-Typografie im
|
<!-- Keine Google Fonts mehr: Barlow/Barlow Condensed/Michroma werden lokal ausgeliefert
|
||||||
Kunden-Referenzdesign) - der Rest der Seite bleibt beim Standard-Font. -->
|
(siehe src/main.jsx) - kein Datentransfer zu Google, keine Extra-Verbindung. -->
|
||||||
<link rel="preconnect" href="https://fonts.googleapis.com" />
|
|
||||||
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin />
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Barlow:wght@400;500;600;700&family=Barlow+Condensed:wght@500;600&family=Michroma&display=swap" rel="stylesheet" />
|
|
||||||
<title>HifiPlanet | Car-Hifi Umbauten nach Maß</title>
|
<title>HifiPlanet | Car-Hifi Umbauten nach Maß</title>
|
||||||
<meta name="description" content="HifiPlanet – dein Car-Hifi Spezialist. Marke und Modell wählen, passende Sound-Pakete entdecken und unverbindlich anfragen." />
|
<meta name="description" content="HifiPlanet – dein Car-Hifi Spezialist. Marke und Modell wählen, passende Sound-Pakete entdecken und unverbindlich anfragen." />
|
||||||
<link rel="canonical" href="https://hifi-planet.de/" />
|
<link rel="canonical" href="https://hifi-planet.de/" />
|
||||||
|
|
|
||||||
30
hifi-src/package-lock.json
generated
30
hifi-src/package-lock.json
generated
|
|
@ -8,6 +8,9 @@
|
||||||
"name": "hifi-frontend",
|
"name": "hifi-frontend",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fontsource/barlow": "^5.3.0",
|
||||||
|
"@fontsource/barlow-condensed": "^5.3.0",
|
||||||
|
"@fontsource/michroma": "^5.3.0",
|
||||||
"@tiptap/extension-font-family": "^3.31.3",
|
"@tiptap/extension-font-family": "^3.31.3",
|
||||||
"@tiptap/extension-link": "^3.31.3",
|
"@tiptap/extension-link": "^3.31.3",
|
||||||
"@tiptap/extension-text-style": "^3.31.3",
|
"@tiptap/extension-text-style": "^3.31.3",
|
||||||
|
|
@ -744,6 +747,33 @@
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"optional": true
|
"optional": true
|
||||||
},
|
},
|
||||||
|
"node_modules/@fontsource/barlow": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fontsource/barlow/-/barlow-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-tGR0y6QObRtKv71MOth44222+mdNFM/ZWFWDV1VLzNbG4oK9PNRlyJzmkck4vHAi9ibHBXgt4SlY51amFP55CA==",
|
||||||
|
"license": "OFL-1.1",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ayuhito"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@fontsource/barlow-condensed": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fontsource/barlow-condensed/-/barlow-condensed-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-RA7MmIx0v3eQ6Gcf74qLVLOwLB0GpPOzx+eU9iG/AmCnSJGcIWYeU8y6CEMGZ210MGwGg5CZhzLkkvyZdTTk1g==",
|
||||||
|
"license": "OFL-1.1",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ayuhito"
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"node_modules/@fontsource/michroma": {
|
||||||
|
"version": "5.3.0",
|
||||||
|
"resolved": "https://registry.npmjs.org/@fontsource/michroma/-/michroma-5.3.0.tgz",
|
||||||
|
"integrity": "sha512-9sbGD7ek1hGvq0TmgNPFbuI3k7qwXVdZ+zCDsTHDGRIQqfYrpYWwEYcwH2fzOtvn8uiGqzAoJ72vuFE3v/hDdg==",
|
||||||
|
"license": "OFL-1.1",
|
||||||
|
"funding": {
|
||||||
|
"url": "https://github.com/sponsors/ayuhito"
|
||||||
|
}
|
||||||
|
},
|
||||||
"node_modules/@jridgewell/gen-mapping": {
|
"node_modules/@jridgewell/gen-mapping": {
|
||||||
"version": "0.3.13",
|
"version": "0.3.13",
|
||||||
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
"resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.13.tgz",
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,9 @@
|
||||||
"preview": "vite preview"
|
"preview": "vite preview"
|
||||||
},
|
},
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
|
"@fontsource/barlow": "^5.3.0",
|
||||||
|
"@fontsource/barlow-condensed": "^5.3.0",
|
||||||
|
"@fontsource/michroma": "^5.3.0",
|
||||||
"@tiptap/extension-font-family": "^3.31.3",
|
"@tiptap/extension-font-family": "^3.31.3",
|
||||||
"@tiptap/extension-link": "^3.31.3",
|
"@tiptap/extension-link": "^3.31.3",
|
||||||
"@tiptap/extension-text-style": "^3.31.3",
|
"@tiptap/extension-text-style": "^3.31.3",
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { lazy, Suspense } from 'react';
|
||||||
import { Routes, Route, Navigate } from 'react-router-dom';
|
import { Routes, Route, Navigate } from 'react-router-dom';
|
||||||
import ScrollToTop from './components/ScrollToTop.jsx';
|
import ScrollToTop from './components/ScrollToTop.jsx';
|
||||||
import CustomCursor from './components/CustomCursor.jsx';
|
import CustomCursor from './components/CustomCursor.jsx';
|
||||||
|
|
@ -16,38 +17,76 @@ import GalleryBrandPage from './pages/public/GalleryBrandPage.jsx';
|
||||||
import GalleryProjectPage from './pages/public/GalleryProjectPage.jsx';
|
import GalleryProjectPage from './pages/public/GalleryProjectPage.jsx';
|
||||||
import Leistungen from './pages/public/Leistungen.jsx';
|
import Leistungen from './pages/public/Leistungen.jsx';
|
||||||
import ContactPage from './pages/public/ContactPage.jsx';
|
import ContactPage from './pages/public/ContactPage.jsx';
|
||||||
|
import DownloadsPage from './pages/public/DownloadsPage.jsx';
|
||||||
import Impressum from './pages/public/Impressum.jsx';
|
import Impressum from './pages/public/Impressum.jsx';
|
||||||
import Datenschutz from './pages/public/Datenschutz.jsx';
|
import Datenschutz from './pages/public/Datenschutz.jsx';
|
||||||
import AGB from './pages/public/AGB.jsx';
|
import AGB from './pages/public/AGB.jsx';
|
||||||
import SetupWizard from './pages/public/SetupWizard.jsx';
|
|
||||||
|
|
||||||
import Login from './pages/admin/Login.jsx';
|
// Oeffentliche Seiten bleiben im Haupt-Bundle (sofort da beim Navigieren). Admin-Bereich,
|
||||||
import Dashboard from './pages/admin/Dashboard.jsx';
|
// Login und Einrichtungs-Assistent werden erst geladen, wenn man sie aufruft - vorher lud
|
||||||
import Brands from './pages/admin/Brands.jsx';
|
// jeder Besucher den kompletten Admin-Code (Editor, Bildzuschnitt, QR-Codes, ...) mit.
|
||||||
import Models from './pages/admin/Models.jsx';
|
//
|
||||||
import GalleryBrands from './pages/admin/GalleryBrands.jsx';
|
// Nach einem Deploy existieren die alten Chunk-Dateien nicht mehr (prebuild leert
|
||||||
import GalleryProjects from './pages/admin/GalleryProjects.jsx';
|
// hifi/assets) - wer noch einen alten Stand offen hat, bekaeme beim ersten Aufruf eines
|
||||||
import GalleryPhotos from './pages/admin/GalleryPhotos.jsx';
|
// Admin-Bereichs einen Ladefehler. Dann einmal neu laden, das holt die aktuelle index.html.
|
||||||
import Packages from './pages/admin/Packages.jsx';
|
const RELOAD_FLAG = 'hifi-chunk-reload';
|
||||||
import Services from './pages/admin/Services.jsx';
|
const lazyPage = (load) =>
|
||||||
import Faqs from './pages/admin/Faqs.jsx';
|
lazy(() =>
|
||||||
import Partners from './pages/admin/Partners.jsx';
|
load().then(
|
||||||
import HomeSections from './pages/admin/HomeSections.jsx';
|
(module) => {
|
||||||
import PackageProducts from './pages/admin/PackageProducts.jsx';
|
try {
|
||||||
import PackageUpgrades from './pages/admin/PackageUpgrades.jsx';
|
sessionStorage.removeItem(RELOAD_FLAG);
|
||||||
import ContactRequests from './pages/admin/ContactRequests.jsx';
|
} catch {
|
||||||
import AccountSettings from './pages/admin/AccountSettings.jsx';
|
// sessionStorage nicht verfuegbar (z. B. gesperrte Website-Daten) - egal
|
||||||
import AdminUsers from './pages/admin/AdminUsers.jsx';
|
}
|
||||||
import PermissionGroups from './pages/admin/PermissionGroups.jsx';
|
return module;
|
||||||
import SettingsLayout from './pages/admin/settings/SettingsLayout.jsx';
|
},
|
||||||
import WebsiteSettings from './pages/admin/settings/WebsiteSettings.jsx';
|
(err) => {
|
||||||
import LegalSettings from './pages/admin/settings/LegalSettings.jsx';
|
let alreadyReloaded = true;
|
||||||
import UpdateSettings from './pages/admin/settings/UpdateSettings.jsx';
|
try {
|
||||||
import EmailSettings from './pages/admin/settings/EmailSettings.jsx';
|
alreadyReloaded = !!sessionStorage.getItem(RELOAD_FLAG);
|
||||||
import DatabaseSettings from './pages/admin/settings/DatabaseSettings.jsx';
|
sessionStorage.setItem(RELOAD_FLAG, '1');
|
||||||
import ExportImportSettings from './pages/admin/settings/ExportImportSettings.jsx';
|
} catch {
|
||||||
import MaintenanceSettings from './pages/admin/settings/MaintenanceSettings.jsx';
|
// ohne sessionStorage kein Reload-Versuch, sonst droht eine Endlosschleife
|
||||||
import ResetSettings from './pages/admin/settings/ResetSettings.jsx';
|
}
|
||||||
|
if (alreadyReloaded) throw err;
|
||||||
|
window.location.reload();
|
||||||
|
return new Promise(() => {});
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
const SetupWizard = lazyPage(() => import('./pages/public/SetupWizard.jsx'));
|
||||||
|
const Login = lazyPage(() => import('./pages/admin/Login.jsx'));
|
||||||
|
const Dashboard = lazyPage(() => import('./pages/admin/Dashboard.jsx'));
|
||||||
|
const Brands = lazyPage(() => import('./pages/admin/Brands.jsx'));
|
||||||
|
const Models = lazyPage(() => import('./pages/admin/Models.jsx'));
|
||||||
|
const GalleryBrands = lazyPage(() => import('./pages/admin/GalleryBrands.jsx'));
|
||||||
|
const GalleryProjects = lazyPage(() => import('./pages/admin/GalleryProjects.jsx'));
|
||||||
|
const GalleryPhotos = lazyPage(() => import('./pages/admin/GalleryPhotos.jsx'));
|
||||||
|
const Packages = lazyPage(() => import('./pages/admin/Packages.jsx'));
|
||||||
|
const Services = lazyPage(() => import('./pages/admin/Services.jsx'));
|
||||||
|
const Faqs = lazyPage(() => import('./pages/admin/Faqs.jsx'));
|
||||||
|
const Partners = lazyPage(() => import('./pages/admin/Partners.jsx'));
|
||||||
|
const Downloads = lazyPage(() => import('./pages/admin/Downloads.jsx'));
|
||||||
|
const HomeSections = lazyPage(() => import('./pages/admin/HomeSections.jsx'));
|
||||||
|
const PackageProducts = lazyPage(() => import('./pages/admin/PackageProducts.jsx'));
|
||||||
|
const PackageUpgrades = lazyPage(() => import('./pages/admin/PackageUpgrades.jsx'));
|
||||||
|
const ContactRequests = lazyPage(() => import('./pages/admin/ContactRequests.jsx'));
|
||||||
|
const AccountSettings = lazyPage(() => import('./pages/admin/AccountSettings.jsx'));
|
||||||
|
const AdminUsers = lazyPage(() => import('./pages/admin/AdminUsers.jsx'));
|
||||||
|
const PermissionGroups = lazyPage(() => import('./pages/admin/PermissionGroups.jsx'));
|
||||||
|
const SettingsLayout = lazyPage(() => import('./pages/admin/settings/SettingsLayout.jsx'));
|
||||||
|
const WebsiteSettings = lazyPage(() => import('./pages/admin/settings/WebsiteSettings.jsx'));
|
||||||
|
const LegalSettings = lazyPage(() => import('./pages/admin/settings/LegalSettings.jsx'));
|
||||||
|
const UpdateSettings = lazyPage(() => import('./pages/admin/settings/UpdateSettings.jsx'));
|
||||||
|
const EmailSettings = lazyPage(() => import('./pages/admin/settings/EmailSettings.jsx'));
|
||||||
|
const DatabaseSettings = lazyPage(() => import('./pages/admin/settings/DatabaseSettings.jsx'));
|
||||||
|
const ExportImportSettings = lazyPage(() => import('./pages/admin/settings/ExportImportSettings.jsx'));
|
||||||
|
const MaintenanceSettings = lazyPage(() => import('./pages/admin/settings/MaintenanceSettings.jsx'));
|
||||||
|
const ResetSettings = lazyPage(() => import('./pages/admin/settings/ResetSettings.jsx'));
|
||||||
|
|
||||||
|
const blankScreen = <div className="min-h-screen bg-white dark:bg-neutral-950" />;
|
||||||
|
|
||||||
export default function App() {
|
export default function App() {
|
||||||
return (
|
return (
|
||||||
|
|
@ -55,6 +94,9 @@ export default function App() {
|
||||||
<ScrollToTop />
|
<ScrollToTop />
|
||||||
<CustomCursor />
|
<CustomCursor />
|
||||||
<SetupGate>
|
<SetupGate>
|
||||||
|
{/* Faengt nur Login/Einrichtung ab - Admin-Seiten haben eine eigene Suspense-Grenze in
|
||||||
|
AdminLayout, damit Seitenleiste und Kopf beim Nachladen stehen bleiben. */}
|
||||||
|
<Suspense fallback={blankScreen}>
|
||||||
<Routes>
|
<Routes>
|
||||||
<Route path="/setup" element={<SetupWizard />} />
|
<Route path="/setup" element={<SetupWizard />} />
|
||||||
|
|
||||||
|
|
@ -68,6 +110,7 @@ export default function App() {
|
||||||
<Route path="/galerie/:brandSlug/:projectSlug" element={<GalleryProjectPage />} />
|
<Route path="/galerie/:brandSlug/:projectSlug" element={<GalleryProjectPage />} />
|
||||||
<Route path="/leistungen" element={<Leistungen />} />
|
<Route path="/leistungen" element={<Leistungen />} />
|
||||||
<Route path="/kontakt" element={<ContactPage />} />
|
<Route path="/kontakt" element={<ContactPage />} />
|
||||||
|
<Route path="/downloads" element={<DownloadsPage />} />
|
||||||
<Route path="/impressum" element={<Impressum />} />
|
<Route path="/impressum" element={<Impressum />} />
|
||||||
<Route path="/datenschutz" element={<Datenschutz />} />
|
<Route path="/datenschutz" element={<Datenschutz />} />
|
||||||
<Route path="/agb" element={<AGB />} />
|
<Route path="/agb" element={<AGB />} />
|
||||||
|
|
@ -90,6 +133,7 @@ export default function App() {
|
||||||
<Route path="services" element={<RequirePermission permission="services.manage"><Services /></RequirePermission>} />
|
<Route path="services" element={<RequirePermission permission="services.manage"><Services /></RequirePermission>} />
|
||||||
<Route path="faqs" element={<RequirePermission permission="content.manage"><Faqs /></RequirePermission>} />
|
<Route path="faqs" element={<RequirePermission permission="content.manage"><Faqs /></RequirePermission>} />
|
||||||
<Route path="partners" element={<RequirePermission permission="content.manage"><Partners /></RequirePermission>} />
|
<Route path="partners" element={<RequirePermission permission="content.manage"><Partners /></RequirePermission>} />
|
||||||
|
<Route path="downloads" element={<RequirePermission permission="downloads.manage"><Downloads /></RequirePermission>} />
|
||||||
<Route path="home-sections" element={<RequirePermission permission="content.manage"><HomeSections /></RequirePermission>} />
|
<Route path="home-sections" element={<RequirePermission permission="content.manage"><HomeSections /></RequirePermission>} />
|
||||||
<Route path="contact-requests" element={<RequirePermission permission="contact.manage"><ContactRequests /></RequirePermission>} />
|
<Route path="contact-requests" element={<RequirePermission permission="contact.manage"><ContactRequests /></RequirePermission>} />
|
||||||
<Route path="users" element={<RequirePermission permission="users.manage"><AdminUsers /></RequirePermission>} />
|
<Route path="users" element={<RequirePermission permission="users.manage"><AdminUsers /></RequirePermission>} />
|
||||||
|
|
@ -114,6 +158,7 @@ export default function App() {
|
||||||
</Route>
|
</Route>
|
||||||
</Route>
|
</Route>
|
||||||
</Routes>
|
</Routes>
|
||||||
|
</Suspense>
|
||||||
</SetupGate>
|
</SetupGate>
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
|
|
||||||
|
|
@ -2,7 +2,30 @@
|
||||||
// abschließendem Slash, z.B. "/hifi/" lokal oder "/" auf IONOS).
|
// abschließendem Slash, z.B. "/hifi/" lokal oder "/" auf IONOS).
|
||||||
export const API_BASE = `${import.meta.env.BASE_URL.replace(/\/$/, '')}/api`;
|
export const API_BASE = `${import.meta.env.BASE_URL.replace(/\/$/, '')}/api`;
|
||||||
|
|
||||||
|
// Zaehlt laufende API-Anfragen - PageImageLoader wartet damit genau so lange, bis die Daten
|
||||||
|
// einer Seite da sind, statt pauschal eine feste Zeit.
|
||||||
|
let pendingRequests = 0;
|
||||||
|
const pendingListeners = new Set();
|
||||||
|
const setPending = (delta) => {
|
||||||
|
pendingRequests += delta;
|
||||||
|
pendingListeners.forEach((listener) => listener(pendingRequests));
|
||||||
|
};
|
||||||
|
export const getPendingRequests = () => pendingRequests;
|
||||||
|
export const subscribePendingRequests = (listener) => {
|
||||||
|
pendingListeners.add(listener);
|
||||||
|
return () => pendingListeners.delete(listener);
|
||||||
|
};
|
||||||
|
|
||||||
async function request(path, options = {}) {
|
async function request(path, options = {}) {
|
||||||
|
setPending(1);
|
||||||
|
try {
|
||||||
|
return await send(path, options);
|
||||||
|
} finally {
|
||||||
|
setPending(-1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
async function send(path, options) {
|
||||||
const res = await fetch(`${API_BASE}${path}`, {
|
const res = await fetch(`${API_BASE}${path}`, {
|
||||||
credentials: 'include',
|
credentials: 'include',
|
||||||
headers: options.body instanceof FormData ? {} : { 'Content-Type': 'application/json' },
|
headers: options.body instanceof FormData ? {} : { 'Content-Type': 'application/json' },
|
||||||
|
|
@ -34,7 +57,7 @@ async function request(path, options = {}) {
|
||||||
}
|
}
|
||||||
|
|
||||||
export const api = {
|
export const api = {
|
||||||
get: (path) => request(path),
|
get: (path, options) => request(path, options),
|
||||||
post: (path, body) => request(path, { method: 'POST', body: body instanceof FormData ? body : JSON.stringify(body) }),
|
post: (path, body) => request(path, { method: 'POST', body: body instanceof FormData ? body : JSON.stringify(body) }),
|
||||||
put: (path, body) => request(path, { method: 'PUT', body: JSON.stringify(body) }),
|
put: (path, body) => request(path, { method: 'PUT', body: JSON.stringify(body) }),
|
||||||
patch: (path, body) => request(path, { method: 'PATCH', body: JSON.stringify(body) }),
|
patch: (path, body) => request(path, { method: 'PATCH', body: JSON.stringify(body) }),
|
||||||
|
|
|
||||||
Binary file not shown.
|
|
@ -1,4 +1,4 @@
|
||||||
import { useEffect, useState } from 'react';
|
import { Suspense, useEffect, useState } from 'react';
|
||||||
import { Link, NavLink, Outlet, useNavigate } from 'react-router-dom';
|
import { Link, NavLink, Outlet, useNavigate } from 'react-router-dom';
|
||||||
import { useAuth } from '../context/AuthContext.jsx';
|
import { useAuth } from '../context/AuthContext.jsx';
|
||||||
import { api } from '../api/client.js';
|
import { api } from '../api/client.js';
|
||||||
|
|
@ -21,6 +21,7 @@ const ICONS = {
|
||||||
sliders: 'M4 6h16M4 6a2 2 0 1 0 4 0 2 2 0 0 0-4 0Zm16 6H4m10 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM4 18h16m-12 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z',
|
sliders: 'M4 6h16M4 6a2 2 0 1 0 4 0 2 2 0 0 0-4 0Zm16 6H4m10 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0ZM4 18h16m-12 0a2 2 0 1 0 4 0 2 2 0 0 0-4 0Z',
|
||||||
image: 'M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Zm2 12 4.5-5.5L14 16l2.5-3L20 17H6ZM8 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z',
|
image: 'M4 5h16a1 1 0 0 1 1 1v12a1 1 0 0 1-1 1H4a1 1 0 0 1-1-1V6a1 1 0 0 1 1-1Zm2 12 4.5-5.5L14 16l2.5-3L20 17H6ZM8 9.5a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0Z',
|
||||||
help: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-5.5v.01M9.5 9.25a2.5 2.5 0 1 1 3.5 2.29c-.7.32-1 .77-1 1.46v.3',
|
help: 'M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18Zm0-5.5v.01M9.5 9.25a2.5 2.5 0 1 1 3.5 2.29c-.7.32-1 .77-1 1.46v.3',
|
||||||
|
download: 'M12 4v11m0 0-4-4m4 4 4-4M5 19h14',
|
||||||
};
|
};
|
||||||
|
|
||||||
const Icon = ({ path }) => (
|
const Icon = ({ path }) => (
|
||||||
|
|
@ -69,6 +70,7 @@ export default function AdminLayout() {
|
||||||
{ to: '/admin/services', label: 'Leistungen', icon: 'briefcase', permission: 'services.manage' },
|
{ to: '/admin/services', label: 'Leistungen', icon: 'briefcase', permission: 'services.manage' },
|
||||||
{ to: '/admin/faqs', label: 'FAQ', icon: 'help', permission: 'content.manage' },
|
{ to: '/admin/faqs', label: 'FAQ', icon: 'help', permission: 'content.manage' },
|
||||||
{ to: '/admin/partners', label: 'Partner', icon: 'tag', permission: 'content.manage' },
|
{ to: '/admin/partners', label: 'Partner', icon: 'tag', permission: 'content.manage' },
|
||||||
|
{ to: '/admin/downloads', label: 'Downloads', icon: 'download', permission: 'downloads.manage' },
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
@ -188,7 +190,11 @@ export default function AdminLayout() {
|
||||||
)}
|
)}
|
||||||
</header>
|
</header>
|
||||||
<main className="p-4 sm:p-6">
|
<main className="p-4 sm:p-6">
|
||||||
<Outlet />
|
{/* Admin-Seiten werden einzeln nachgeladen (App.jsx) - Seitenleiste und Kopf
|
||||||
|
bleiben dabei stehen, nur der Inhaltsbereich zeigt kurz "Lädt…". */}
|
||||||
|
<Suspense fallback={<p className="text-sm text-neutral-400">Lädt…</p>}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
</main>
|
</main>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,31 @@
|
||||||
import { DynamicIcon as LucideDynamicIcon } from 'lucide-react/dynamic';
|
import { lazy, Suspense } from 'react';
|
||||||
|
import { Boxes, Car, CarFront, Caravan, Cog, ShieldAlert, Video, Zap } from 'lucide-react';
|
||||||
|
|
||||||
|
// Die Icons der Standard-Leistungen (SettingsController::defaultServices) direkt im Bundle -
|
||||||
|
// damit kommt die oeffentliche Leistungen-Seite im Normalfall ganz ohne Nachladen aus.
|
||||||
|
const COMMON_ICONS = {
|
||||||
|
car: Car,
|
||||||
|
caravan: Caravan,
|
||||||
|
'car-front': CarFront,
|
||||||
|
cog: Cog,
|
||||||
|
zap: Zap,
|
||||||
|
boxes: Boxes,
|
||||||
|
'shield-alert': ShieldAlert,
|
||||||
|
video: Video,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Alle anderen (im Admin per IconPicker frei waehlbaren) Icons stecken in einem eigenen
|
||||||
|
// Chunk, der erst geladen wird, wenn wirklich eines davon gebraucht wird. Vorher hing die
|
||||||
|
// komplette Bibliothek (~1,1 MB JavaScript) an jedem einzelnen Seitenaufruf.
|
||||||
|
const RegistryIcon = lazy(() => import('./iconRegistry.jsx'));
|
||||||
|
|
||||||
// Lädt pro Icon-Name nur den einzelnen benötigten Icon-Chunk nach, statt die
|
|
||||||
// komplette ~2000-Icon-Bibliothek ins Bundle zu ziehen (siehe lucide-react/dynamic).
|
|
||||||
export default function DynamicIcon({ name, className = 'h-6 w-6', ...props }) {
|
export default function DynamicIcon({ name, className = 'h-6 w-6', ...props }) {
|
||||||
if (!name) return null;
|
if (!name) return null;
|
||||||
return <LucideDynamicIcon name={name} className={className} {...props} />;
|
const Common = COMMON_ICONS[name];
|
||||||
|
if (Common) return <Common className={className} {...props} />;
|
||||||
|
return (
|
||||||
|
<Suspense fallback={<span className={`inline-block ${className}`} aria-hidden="true" />}>
|
||||||
|
<RegistryIcon name={name} className={className} {...props} />
|
||||||
|
</Suspense>
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,5 @@
|
||||||
import { Link, useLocation } from 'react-router-dom';
|
import { Link, useLocation } from 'react-router-dom';
|
||||||
import DynamicIcon from './DynamicIcon.jsx';
|
import { Clock, MapPin, Navigation, Phone } from 'lucide-react';
|
||||||
import { useCookieConsent } from '../context/CookieConsentContext.jsx';
|
import { useCookieConsent } from '../context/CookieConsentContext.jsx';
|
||||||
import { useSiteSettings } from '../context/SiteSettingsContext.jsx';
|
import { useSiteSettings } from '../context/SiteSettingsContext.jsx';
|
||||||
import { useLanguage } from '../context/LanguageContext.jsx';
|
import { useLanguage } from '../context/LanguageContext.jsx';
|
||||||
|
|
@ -15,6 +15,7 @@ export default function Footer() {
|
||||||
address_zip: addressZip,
|
address_zip: addressZip,
|
||||||
address_city: addressCity,
|
address_city: addressCity,
|
||||||
business_hours: businessHours,
|
business_hours: businessHours,
|
||||||
|
has_downloads: hasDownloads,
|
||||||
} = useSiteSettings();
|
} = useSiteSettings();
|
||||||
const open = isOpenNow(businessHours);
|
const open = isOpenNow(businessHours);
|
||||||
const { openSettings } = useCookieConsent();
|
const { openSettings } = useCookieConsent();
|
||||||
|
|
@ -40,7 +41,7 @@ export default function Footer() {
|
||||||
<div className="mx-auto grid max-w-6xl gap-4 px-4 sm:grid-cols-3 sm:px-6">
|
<div className="mx-auto grid max-w-6xl gap-4 px-4 sm:grid-cols-3 sm:px-6">
|
||||||
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
<div className="mb-3 flex items-center gap-2">
|
<div className="mb-3 flex items-center gap-2">
|
||||||
<DynamicIcon name="map-pin" className="h-4 w-4 text-brand-500" />
|
<MapPin className="h-4 w-4 text-brand-500" />
|
||||||
<p className="font-semibold text-neutral-900 dark:text-white">HifiPlanet</p>
|
<p className="font-semibold text-neutral-900 dark:text-white">HifiPlanet</p>
|
||||||
</div>
|
</div>
|
||||||
{addressStreet && <p>{addressStreet}</p>}
|
{addressStreet && <p>{addressStreet}</p>}
|
||||||
|
|
@ -51,14 +52,14 @@ export default function Footer() {
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className="mt-4 flex items-center justify-center gap-1.5 rounded-md bg-brand-500 px-3 py-2 text-xs font-semibold text-white hover:bg-brand-600"
|
className="mt-4 flex items-center justify-center gap-1.5 rounded-md bg-brand-500 px-3 py-2 text-xs font-semibold text-white hover:bg-brand-600"
|
||||||
>
|
>
|
||||||
<DynamicIcon name="navigation" className="h-3.5 w-3.5" />
|
<Navigation className="h-3.5 w-3.5" />
|
||||||
{t('footer.routePlan')}
|
{t('footer.routePlan')}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
<div className="mb-3 flex items-center gap-2">
|
<div className="mb-3 flex items-center gap-2">
|
||||||
<DynamicIcon name="phone" className="h-4 w-4 text-brand-500" />
|
<Phone className="h-4 w-4 text-brand-500" />
|
||||||
<p className="font-semibold text-neutral-900 dark:text-white">{t('footer.contactHeading')}</p>
|
<p className="font-semibold text-neutral-900 dark:text-white">{t('footer.contactHeading')}</p>
|
||||||
</div>
|
</div>
|
||||||
<p>
|
<p>
|
||||||
|
|
@ -78,7 +79,7 @@ export default function Footer() {
|
||||||
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
<div className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
<div className="mb-3 flex items-center justify-between gap-2">
|
<div className="mb-3 flex items-center justify-between gap-2">
|
||||||
<div className="flex items-center gap-2">
|
<div className="flex items-center gap-2">
|
||||||
<DynamicIcon name="clock" className="h-4 w-4 text-brand-500" />
|
<Clock className="h-4 w-4 text-brand-500" />
|
||||||
<p className="font-semibold text-neutral-900 dark:text-white">{t('footer.hoursHeading')}</p>
|
<p className="font-semibold text-neutral-900 dark:text-white">{t('footer.hoursHeading')}</p>
|
||||||
</div>
|
</div>
|
||||||
<span
|
<span
|
||||||
|
|
@ -112,6 +113,12 @@ export default function Footer() {
|
||||||
<span>·</span>
|
<span>·</span>
|
||||||
<Link to="/agb" className="hover:text-brand-500">{t('footer.terms')}</Link>
|
<Link to="/agb" className="hover:text-brand-500">{t('footer.terms')}</Link>
|
||||||
<span>·</span>
|
<span>·</span>
|
||||||
|
{hasDownloads && (
|
||||||
|
<>
|
||||||
|
<Link to="/downloads" className="hover:text-brand-500">{t('footer.downloads')}</Link>
|
||||||
|
<span>·</span>
|
||||||
|
</>
|
||||||
|
)}
|
||||||
<button type="button" onClick={openSettings} className="hover:text-brand-500">
|
<button type="button" onClick={openSettings} className="hover:text-brand-500">
|
||||||
{t('footer.cookieSettings')}
|
{t('footer.cookieSettings')}
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -1,14 +1,21 @@
|
||||||
import { useMemo, useState } from 'react';
|
import { useMemo, useState } from 'react';
|
||||||
import { iconNames } from 'lucide-react/dynamic';
|
import { ICON_NAMES as ALL_ICON_NAMES, findIcon, toComponentName } from './iconRegistry.jsx';
|
||||||
import DynamicIcon from './DynamicIcon.jsx';
|
|
||||||
|
|
||||||
const ALL_ICON_NAMES = [...iconNames].sort();
|
// Die Registry ist hier ohnehin schon geladen - direkt rendern statt ueber DynamicIcon
|
||||||
|
// (dessen lazy()-Umweg wuerde beim ersten Anzeigen kurz leere Platzhalter zeigen).
|
||||||
|
function PickerIcon({ name, className }) {
|
||||||
|
const Icon = findIcon(name);
|
||||||
|
return Icon ? <Icon className={className} /> : null;
|
||||||
|
}
|
||||||
|
|
||||||
const DEFAULT_LIMIT = 120;
|
const DEFAULT_LIMIT = 120;
|
||||||
const SEARCH_LIMIT = 200;
|
const SEARCH_LIMIT = 200;
|
||||||
|
|
||||||
export default function IconPicker({ value, onChange }) {
|
export default function IconPicker({ value, onChange }) {
|
||||||
const [search, setSearch] = useState('');
|
const [search, setSearch] = useState('');
|
||||||
|
// Aeltere Eintraege koennen z. B. "arrow-up-0-1" statt "arrow-up01" heissen - beides ist
|
||||||
|
// dasselbe Icon, verglichen wird deshalb ueber den Komponentennamen.
|
||||||
|
const selectedComponent = value ? toComponentName(value) : null;
|
||||||
|
|
||||||
const results = useMemo(() => {
|
const results = useMemo(() => {
|
||||||
const q = search.trim().toLowerCase();
|
const q = search.trim().toLowerCase();
|
||||||
|
|
@ -20,7 +27,7 @@ export default function IconPicker({ value, onChange }) {
|
||||||
<div>
|
<div>
|
||||||
<div className="mb-2 flex items-center gap-3 rounded-md border border-neutral-300 p-2 dark:border-neutral-700">
|
<div className="mb-2 flex items-center gap-3 rounded-md border border-neutral-300 p-2 dark:border-neutral-700">
|
||||||
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400">
|
<div className="flex h-10 w-10 shrink-0 items-center justify-center rounded-md bg-brand-100 text-brand-600 dark:bg-brand-900/40 dark:text-brand-400">
|
||||||
{value ? <DynamicIcon name={value} className="h-6 w-6" /> : <span className="text-xs text-neutral-400">?</span>}
|
{value ? <PickerIcon name={value} className="h-6 w-6" /> : <span className="text-xs text-neutral-400">?</span>}
|
||||||
</div>
|
</div>
|
||||||
<div className="text-sm">
|
<div className="text-sm">
|
||||||
<p className="font-medium text-neutral-800 dark:text-neutral-100">{value || 'Kein Icon gewählt'}</p>
|
<p className="font-medium text-neutral-800 dark:text-neutral-100">{value || 'Kein Icon gewählt'}</p>
|
||||||
|
|
@ -43,12 +50,12 @@ export default function IconPicker({ value, onChange }) {
|
||||||
title={name}
|
title={name}
|
||||||
onClick={() => onChange(name)}
|
onClick={() => onChange(name)}
|
||||||
className={`flex h-10 w-10 items-center justify-center rounded-md transition ${
|
className={`flex h-10 w-10 items-center justify-center rounded-md transition ${
|
||||||
value === name
|
selectedComponent === toComponentName(name)
|
||||||
? 'bg-brand-500 text-white'
|
? 'bg-brand-500 text-white'
|
||||||
: 'text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800'
|
: 'text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<DynamicIcon name={name} className="h-5 w-5" />
|
<PickerIcon name={name} className="h-5 w-5" />
|
||||||
</button>
|
</button>
|
||||||
))}
|
))}
|
||||||
{results.length === 0 && (
|
{results.length === 0 && (
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
import { useLanguage } from '../context/LanguageContext.jsx';
|
import { useLanguage } from '../context/LanguageContext.jsx';
|
||||||
import DynamicIcon from './DynamicIcon.jsx';
|
import { LogIn } from 'lucide-react';
|
||||||
|
|
||||||
const WrenchIcon = () => (
|
const WrenchIcon = () => (
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="h-10 w-10">
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" strokeWidth="1.5" className="h-10 w-10">
|
||||||
|
|
@ -32,7 +32,7 @@ export default function MaintenanceNotice({ message, fullScreen = false }) {
|
||||||
title={t('maintenance.login')}
|
title={t('maintenance.login')}
|
||||||
className="fixed bottom-4 right-4 flex items-center gap-2 rounded-full border border-neutral-200 bg-white px-3 py-2 text-sm font-medium text-neutral-600 shadow-sm transition hover:border-brand-500 hover:text-brand-600 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:text-brand-400"
|
className="fixed bottom-4 right-4 flex items-center gap-2 rounded-full border border-neutral-200 bg-white px-3 py-2 text-sm font-medium text-neutral-600 shadow-sm transition hover:border-brand-500 hover:text-brand-600 dark:border-neutral-800 dark:bg-neutral-900 dark:text-neutral-300 dark:hover:text-brand-400"
|
||||||
>
|
>
|
||||||
<DynamicIcon name="log-in" className="h-4 w-4" />
|
<LogIn className="h-4 w-4" />
|
||||||
{t('maintenance.login')}
|
{t('maintenance.login')}
|
||||||
</Link>
|
</Link>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
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 ThemeToggle from './ThemeToggle.jsx';
|
import ThemeToggle from './ThemeToggle.jsx';
|
||||||
import DynamicIcon from './DynamicIcon.jsx';
|
|
||||||
import { useAuth } from '../context/AuthContext.jsx';
|
import { useAuth } from '../context/AuthContext.jsx';
|
||||||
import { useSiteSettings } from '../context/SiteSettingsContext.jsx';
|
import { useSiteSettings } from '../context/SiteSettingsContext.jsx';
|
||||||
import { useLanguage } from '../context/LanguageContext.jsx';
|
import { useLanguage } from '../context/LanguageContext.jsx';
|
||||||
|
|
@ -123,9 +123,10 @@ export default function Navbar() {
|
||||||
const [mounted, setMounted] = useState(false);
|
const [mounted, setMounted] = useState(false);
|
||||||
const [menuVisible, setMenuVisible] = useState(false);
|
const [menuVisible, setMenuVisible] = useState(false);
|
||||||
const { user } = useAuth();
|
const { user } = useAuth();
|
||||||
const { phone, whatsapp, logo_dark_path: logoDarkPath } = useSiteSettings();
|
const { phone, whatsapp, logo_dark_path: logoDarkPath, has_downloads: hasDownloads } = useSiteSettings();
|
||||||
const { t } = useLanguage();
|
const { t } = useLanguage();
|
||||||
const totalItems = whatsapp ? 8 : 7;
|
// 4 Hauptlinks + Trennlinie + Shop, dazu die optionalen Eintraege.
|
||||||
|
const totalItems = 6 + (hasDownloads ? 1 : 0) + (phone ? 1 : 0) + (whatsapp ? 1 : 0);
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const isHome = location.pathname === '/';
|
const isHome = location.pathname === '/';
|
||||||
const [scrolled, setScrolled] = useState(!isHome);
|
const [scrolled, setScrolled] = useState(!isHome);
|
||||||
|
|
@ -185,10 +186,15 @@ export default function Navbar() {
|
||||||
transparent ? 'text-white hover:bg-white/10' : 'text-neutral-300 hover:bg-neutral-800'
|
transparent ? 'text-white hover:bg-white/10' : 'text-neutral-300 hover:bg-neutral-800'
|
||||||
}`}
|
}`}
|
||||||
>
|
>
|
||||||
<DynamicIcon name="layout-dashboard" className="h-5 w-5" />
|
<LayoutDashboard className="h-5 w-5" />
|
||||||
</Link>
|
</Link>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// Fortlaufender Index fuer die gestaffelte Einflug-Animation - optionale Eintraege
|
||||||
|
// (Downloads, Telefon, WhatsApp) verschieben so die nachfolgenden automatisch.
|
||||||
|
let flyIndex = 0;
|
||||||
|
const nextFly = () => flyInStyle(flyIndex++);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
// Die Hintergrund-/Text-/Rahmenfarben hier sind bewusst die "dunklen" Werte fest verdrahtet
|
// Die Hintergrund-/Text-/Rahmenfarben hier sind bewusst die "dunklen" Werte fest verdrahtet
|
||||||
// statt per dark:-Utility bedingt (Kundenwunsch: die Navbar soll immer im Dark-Theme
|
// statt per dark:-Utility bedingt (Kundenwunsch: die Navbar soll immer im Dark-Theme
|
||||||
|
|
@ -246,24 +252,29 @@ export default function Navbar() {
|
||||||
<span className="text-xs font-semibold uppercase tracking-wide">{t('nav.close')}</span>
|
<span className="text-xs font-semibold uppercase tracking-wide">{t('nav.close')}</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<Link to="/fahrzeuge" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={flyInStyle(0)}>
|
<Link to="/fahrzeuge" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
{t('nav.vehicles')}
|
{t('nav.vehicles')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link to="/leistungen" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={flyInStyle(1)}>
|
<Link to="/leistungen" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
{t('nav.services')}
|
{t('nav.services')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link to="/galerie" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={flyInStyle(2)}>
|
<Link to="/galerie" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
{t('nav.gallery')}
|
{t('nav.gallery')}
|
||||||
</Link>
|
</Link>
|
||||||
<Link to="/kontakt" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={flyInStyle(3)}>
|
<Link to="/kontakt" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
{t('nav.contact')}
|
{t('nav.contact')}
|
||||||
</Link>
|
</Link>
|
||||||
|
{hasDownloads && (
|
||||||
|
<Link to="/downloads" onClick={() => setOpen(false)} className={`text-3xl font-extrabold tracking-tight text-neutral-900 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
|
{t('nav.downloads')}
|
||||||
|
</Link>
|
||||||
|
)}
|
||||||
|
|
||||||
<div className={`h-px w-16 bg-brand-500/60 ${flyIn()}`} style={flyInStyle(4)} />
|
<div className={`h-px w-16 bg-brand-500/60 ${flyIn()}`} style={nextFly()} />
|
||||||
|
|
||||||
{phone && (
|
{phone && (
|
||||||
<a href={`tel:${digitsOnly(phone)}`} className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`} style={flyInStyle(5)}>
|
<a href={`tel:${digitsOnly(phone)}`} className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`} style={nextFly()}>
|
||||||
<DynamicIcon name="phone" className="h-4 w-4" />
|
<Phone className="h-4 w-4" />
|
||||||
{phone}
|
{phone}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
|
@ -273,9 +284,9 @@ export default function Navbar() {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`}
|
className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`}
|
||||||
style={flyInStyle(6)}
|
style={nextFly()}
|
||||||
>
|
>
|
||||||
<DynamicIcon name="message-circle" className="h-4 w-4" />
|
<MessageCircle className="h-4 w-4" />
|
||||||
{t('nav.whatsapp')}
|
{t('nav.whatsapp')}
|
||||||
</a>
|
</a>
|
||||||
)}
|
)}
|
||||||
|
|
@ -284,9 +295,9 @@ export default function Navbar() {
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noopener noreferrer"
|
rel="noopener noreferrer"
|
||||||
className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`}
|
className={`flex items-center gap-2 text-sm font-semibold uppercase tracking-wide text-neutral-600 hover:text-brand-600 ${flyIn()}`}
|
||||||
style={flyInStyle(whatsapp ? 7 : 6)}
|
style={nextFly()}
|
||||||
>
|
>
|
||||||
<DynamicIcon name="shopping-bag" className="h-4 w-4" />
|
<ShoppingBag className="h-4 w-4" />
|
||||||
{t('nav.shop')}
|
{t('nav.shop')}
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,28 @@
|
||||||
import { useEffect, useRef, useState } from 'react';
|
import { useLayoutEffect, useRef, useState } from 'react';
|
||||||
import { useLocation } from 'react-router-dom';
|
import { useLocation } from 'react-router-dom';
|
||||||
|
import { getPendingRequests, subscribePendingRequests } from '../api/client.js';
|
||||||
|
|
||||||
// Solange der aktuellen Seite noch nicht alle Bilder fertig geladen (oder fehlgeschlagen) sind,
|
// Solange einer Seite noch Daten oder Bilder im sichtbaren Bereich fehlen, bleibt der Inhalt
|
||||||
// bleibt der Inhalt unsichtbar (aber trotzdem gemountet - Bilder laden im Hintergrund weiter)
|
// unsichtbar (aber gemountet - alles laedt im Hintergrund weiter), damit nichts nachtraeglich
|
||||||
// und stattdessen ein Lade-Symbol angezeigt, damit nichts nachtraeglich "einpoppt". Per
|
// "einpoppt". Per Admin-Einstellung an-/abschaltbar (app_settings.page_loader_enabled).
|
||||||
// Admin-Einstellung an-/abschaltbar (siehe app_settings.page_loader_enabled).
|
|
||||||
//
|
//
|
||||||
// Funktioniert seitenunabhaengig per MutationObserver statt pro Seite einzeln verdrahtet zu
|
// Seitenunabhaengig per MutationObserver: viele Seiten fuegen ihre Bilder erst nach einem
|
||||||
// werden: viele Seiten laden ihre Bilder (Galerie-/Marken-/Modellfotos) erst nach einem
|
// API-Request ein. Fertig ist eine Seite, sobald kein API-Request mehr laeuft (siehe
|
||||||
// asynchronen API-Request, das <img> existiert also beim ersten Render noch gar nicht. Der
|
// api/client.js) und alle Bilder im ersten Bildschirm geladen sind - Bilder weiter unten
|
||||||
// Observer merkt sich jedes neu eingefuegte <img>, wartet auf dessen load/error-Event und
|
// laden nach, waehrend man schon liest (loading="lazy" dort wuerde sonst nie fertig).
|
||||||
// betrachtet die Seite erst als fertig, wenn eine kurze Weile lang weder ein Bild offen noch
|
//
|
||||||
// eine neue DOM-Aenderung passiert ist ("settled"). MAX_WAIT_MS ist ein Sicherheitsnetz, falls
|
// Frueher galt pauschal: Lade-Symbol mindestens 400 ms, danach noch 400 ms "Ruhe" abwarten,
|
||||||
// ein Bild haengen bleibt oder eine Seite ungewoehnlich lange braucht.
|
// und auf ALLE Bilder der Seite warten - jeder Seitenwechsel dauerte so mindestens ~0,8 s,
|
||||||
const MIN_DISPLAY_MS = 400;
|
// Galerie-Seiten deutlich laenger. Jetzt erscheint das Symbol erst, wenn es wirklich dauert.
|
||||||
const SETTLE_MS = 400;
|
const SHOW_DELAY_MS = 150; // schneller fertig -> Lade-Symbol erscheint gar nicht erst
|
||||||
const MAX_WAIT_MS = 8000;
|
const MIN_VISIBLE_MS = 300; // einmal erschienen, nicht nur kurz aufblitzen lassen
|
||||||
|
const SETTLE_MS = 80; // nach der letzten Aenderung kurz warten, ob noch etwas nachkommt
|
||||||
|
const MAX_WAIT_MS = 5000; // Sicherheitsnetz, falls ein Bild oder Request haengt
|
||||||
|
|
||||||
function Spinner() {
|
function Spinner() {
|
||||||
// Fest zum Sichtfenster positioniert (nicht zum - bei einer langen Seite wie der Startseite
|
// Fest zum Sichtfenster positioniert (nicht zum - bei einer langen Seite sehr hohen, weil
|
||||||
// sehr hohen, weil weiterhin per visibility:hidden im Layout mitgezaehlten - Inhalt), damit
|
// weiterhin per visibility:hidden im Layout mitgezaehlten - Inhalt), damit das Symbol
|
||||||
// das Symbol immer mittig im sichtbaren Bereich erscheint statt weit unten, wo man erst
|
// immer mittig im sichtbaren Bereich erscheint.
|
||||||
// hinscrollen muesste.
|
|
||||||
return (
|
return (
|
||||||
<div className="fixed inset-0 z-[200] flex items-center justify-center bg-white dark:bg-neutral-950">
|
<div className="fixed inset-0 z-[200] flex items-center justify-center bg-white dark:bg-neutral-950">
|
||||||
<div className="h-10 w-10 animate-spin rounded-full border-4 border-neutral-200 border-t-brand-500 dark:border-neutral-800 dark:border-t-brand-500" />
|
<div className="h-10 w-10 animate-spin rounded-full border-4 border-neutral-200 border-t-brand-500 dark:border-neutral-800 dark:border-t-brand-500" />
|
||||||
|
|
@ -31,56 +32,80 @@ function Spinner() {
|
||||||
|
|
||||||
export default function PageImageLoader({ enabled, children }) {
|
export default function PageImageLoader({ enabled, children }) {
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
const [loading, setLoading] = useState(enabled);
|
const [ready, setReady] = useState(!enabled);
|
||||||
|
const [spinnerVisible, setSpinnerVisible] = useState(false);
|
||||||
const containerRef = useRef(null);
|
const containerRef = useRef(null);
|
||||||
|
|
||||||
useEffect(() => {
|
// Layout-Effekt statt useEffect: versteckt die neue Seite noch VOR dem ersten Zeichnen,
|
||||||
if (!enabled) {
|
// sonst blitzt sie beim Seitenwechsel fuer einen Frame halbfertig auf.
|
||||||
setLoading(false);
|
useLayoutEffect(() => {
|
||||||
|
const container = containerRef.current;
|
||||||
|
if (!enabled || !container) {
|
||||||
|
setReady(true);
|
||||||
|
setSpinnerVisible(false);
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
setLoading(true);
|
setReady(false);
|
||||||
const container = containerRef.current;
|
setSpinnerVisible(false);
|
||||||
if (!container) {
|
|
||||||
setLoading(false);
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
let finished = false;
|
let finished = false;
|
||||||
|
let spinnerShownAt = 0;
|
||||||
let settleTimer = null;
|
let settleTimer = null;
|
||||||
const pending = new Set();
|
const pendingImages = new Set();
|
||||||
const startedAt = Date.now();
|
|
||||||
|
const showTimer = setTimeout(() => {
|
||||||
|
spinnerShownAt = Date.now();
|
||||||
|
setSpinnerVisible(true);
|
||||||
|
}, SHOW_DELAY_MS);
|
||||||
|
|
||||||
|
const reveal = () => {
|
||||||
|
setReady(true);
|
||||||
|
setSpinnerVisible(false);
|
||||||
|
};
|
||||||
|
|
||||||
|
const stop = () => {
|
||||||
|
finished = true;
|
||||||
|
clearTimeout(showTimer);
|
||||||
|
clearTimeout(settleTimer);
|
||||||
|
clearTimeout(maxTimer);
|
||||||
|
observer.disconnect();
|
||||||
|
unsubscribe();
|
||||||
|
};
|
||||||
|
|
||||||
const finish = () => {
|
const finish = () => {
|
||||||
if (finished) return;
|
if (finished) return;
|
||||||
finished = true;
|
stop();
|
||||||
if (settleTimer) clearTimeout(settleTimer);
|
const remaining = spinnerShownAt ? MIN_VISIBLE_MS - (Date.now() - spinnerShownAt) : 0;
|
||||||
clearTimeout(maxTimer);
|
if (remaining > 0) setTimeout(reveal, remaining);
|
||||||
observer.disconnect();
|
else reveal();
|
||||||
const elapsed = Date.now() - startedAt;
|
|
||||||
const remaining = Math.max(0, MIN_DISPLAY_MS - elapsed);
|
|
||||||
setTimeout(() => setLoading(false), remaining);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const scheduleSettleCheck = () => {
|
const check = () => {
|
||||||
if (settleTimer) clearTimeout(settleTimer);
|
clearTimeout(settleTimer);
|
||||||
settleTimer = setTimeout(() => {
|
settleTimer = setTimeout(() => {
|
||||||
if (pending.size === 0) finish();
|
if (pendingImages.size === 0 && getPendingRequests() === 0) finish();
|
||||||
}, SETTLE_MS);
|
}, SETTLE_MS);
|
||||||
};
|
};
|
||||||
|
|
||||||
const trackImage = (img) => {
|
const trackImage = (img) => {
|
||||||
if (pending.has(img) || img.complete) return;
|
if (pendingImages.has(img) || img.complete) return;
|
||||||
pending.add(img);
|
// Nur der erste Bildschirm zaehlt (visibility:hidden behaelt das Layout bei, die
|
||||||
const onSettled = () => {
|
// Position stimmt also schon, obwohl noch nichts zu sehen ist).
|
||||||
pending.delete(img);
|
if (img.getBoundingClientRect().top >= window.innerHeight) return;
|
||||||
img.removeEventListener('load', onSettled);
|
// loading="lazy" laedt der Browser in einem unsichtbaren Container nie - darauf zu
|
||||||
img.removeEventListener('error', onSettled);
|
// warten hiess bisher, bis zum Timeout festzuhaengen (z. B. /leistungen: 8 s). Im ersten
|
||||||
scheduleSettleCheck();
|
// Bildschirm soll es ohnehin sofort da sein, weiter unten bleibt es lazy.
|
||||||
|
if (img.loading === 'lazy') img.loading = 'eager';
|
||||||
|
pendingImages.add(img);
|
||||||
|
const settled = () => {
|
||||||
|
pendingImages.delete(img);
|
||||||
|
img.removeEventListener('load', settled);
|
||||||
|
img.removeEventListener('error', settled);
|
||||||
|
check();
|
||||||
};
|
};
|
||||||
img.addEventListener('load', onSettled);
|
img.addEventListener('load', settled);
|
||||||
img.addEventListener('error', onSettled);
|
img.addEventListener('error', settled);
|
||||||
};
|
};
|
||||||
|
|
||||||
const scanNode = (node) => {
|
const scanNode = (node) => {
|
||||||
|
|
@ -89,31 +114,28 @@ export default function PageImageLoader({ enabled, children }) {
|
||||||
node.querySelectorAll?.('img').forEach(trackImage);
|
node.querySelectorAll?.('img').forEach(trackImage);
|
||||||
};
|
};
|
||||||
|
|
||||||
container.querySelectorAll('img').forEach(trackImage);
|
|
||||||
|
|
||||||
const observer = new MutationObserver((mutations) => {
|
const observer = new MutationObserver((mutations) => {
|
||||||
mutations.forEach((m) => m.addedNodes.forEach(scanNode));
|
mutations.forEach((m) => m.addedNodes.forEach(scanNode));
|
||||||
scheduleSettleCheck();
|
check();
|
||||||
});
|
});
|
||||||
observer.observe(container, { childList: true, subtree: true });
|
observer.observe(container, { childList: true, subtree: true });
|
||||||
|
const unsubscribe = subscribePendingRequests(check);
|
||||||
scheduleSettleCheck();
|
|
||||||
const maxTimer = setTimeout(finish, MAX_WAIT_MS);
|
const maxTimer = setTimeout(finish, MAX_WAIT_MS);
|
||||||
|
|
||||||
|
container.querySelectorAll('img').forEach(trackImage);
|
||||||
|
check();
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
finished = true;
|
if (!finished) stop();
|
||||||
observer.disconnect();
|
|
||||||
if (settleTimer) clearTimeout(settleTimer);
|
|
||||||
clearTimeout(maxTimer);
|
|
||||||
};
|
};
|
||||||
}, [location.pathname, enabled]);
|
}, [location.pathname, enabled]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<div ref={containerRef} style={enabled ? { visibility: loading ? 'hidden' : 'visible' } : undefined}>
|
<div ref={containerRef} style={enabled ? { visibility: ready ? 'visible' : 'hidden' } : undefined}>
|
||||||
{children}
|
{children}
|
||||||
</div>
|
</div>
|
||||||
{enabled && loading && <Spinner />}
|
{enabled && spinnerVisible && <Spinner />}
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -56,6 +56,7 @@ const DEFAULT_SITE_SETTINGS = {
|
||||||
gallery_card_text_y: 100,
|
gallery_card_text_y: 100,
|
||||||
site_font: null,
|
site_font: null,
|
||||||
page_loader_enabled: 1,
|
page_loader_enabled: 1,
|
||||||
|
has_downloads: false,
|
||||||
};
|
};
|
||||||
|
|
||||||
// Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG
|
// Das Impressum (und die anderen rechtlichen Pflichtseiten) müssen laut § 5 DDG
|
||||||
|
|
|
||||||
|
|
@ -2,22 +2,28 @@ import { useEffect, useState } from 'react';
|
||||||
import { Navigate, useLocation } from 'react-router-dom';
|
import { Navigate, useLocation } from 'react-router-dom';
|
||||||
import { api } from '../api/client.js';
|
import { api } from '../api/client.js';
|
||||||
|
|
||||||
// Prüft bei jedem Seitenaufruf, ob die Ersteinrichtung (Datenbank, Struktur, erster
|
// Leitet auf /setup um, solange die Ersteinrichtung (Datenbank, Struktur, erster
|
||||||
// Admin-Account) schon abgeschlossen ist. Falls nicht, wird - egal welche URL
|
// Admin-Account) noch nicht abgeschlossen ist - und umgekehrt von /setup weg, sobald sie
|
||||||
// aufgerufen wurde - auf /setup umgeleitet. Ist die Einrichtung bereits
|
// es ist.
|
||||||
// abgeschlossen, kommt man umgekehrt nicht mehr auf /setup rein.
|
|
||||||
//
|
//
|
||||||
// Der Status wird zusammen mit dem Pfad gespeichert, für den er ermittelt wurde:
|
// Performance: Frueher wurde der Status bei JEDEM Seitenwechsel neu abgefragt und bis zur
|
||||||
// direkt nach einem Pfadwechsel ist der zuletzt bekannte Stand noch der des ALTEN
|
// Antwort eine leere Seite gezeigt - dabei wurde der komplette Seitenbaum (inkl.
|
||||||
// Pfads. Würde man den sofort auswerten, könnte das kurzzeitig zu einer falschen
|
// PublicLayout mit seinen eigenen API-Abfragen) bei jedem Klick verworfen und neu
|
||||||
// Umleitung führen (z.B. zurück auf /setup, obwohl man gerade fertig eingerichtet
|
// aufgebaut. Jetzt: der Inhalt wird sofort gezeigt, und ist die Einrichtung einmal als
|
||||||
// hat und eigentlich zu /admin/login navigiert). Deshalb wird erst wieder
|
// abgeschlossen bekannt, wird nie wieder gefragt (sie kann nicht rueckgaengig werden).
|
||||||
// entschieden, wenn der Stand nachweislich für den aktuellen Pfad frisch ist.
|
//
|
||||||
|
// Nur solange die Einrichtung noch laeuft, wird pro Pfad neu gefragt. Der Status wird dabei
|
||||||
|
// zusammen mit dem Pfad gespeichert, fuer den er ermittelt wurde: direkt nach einem
|
||||||
|
// Pfadwechsel ist der zuletzt bekannte Stand noch der des ALTEN Pfads - wuerde man den
|
||||||
|
// sofort auswerten, koennte das zu einer falschen Umleitung fuehren (z.B. zurueck auf
|
||||||
|
// /setup, obwohl man gerade fertig eingerichtet hat und zu /admin/login navigiert).
|
||||||
export default function SetupGate({ children }) {
|
export default function SetupGate({ children }) {
|
||||||
const [state, setState] = useState({ pathname: null, needsSetup: null });
|
const [state, setState] = useState({ pathname: null, needsSetup: null });
|
||||||
const location = useLocation();
|
const location = useLocation();
|
||||||
|
const setupDone = state.needsSetup === false;
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
|
if (setupDone) return undefined;
|
||||||
let cancelled = false;
|
let cancelled = false;
|
||||||
api
|
api
|
||||||
.get('/setup/status')
|
.get('/setup/status')
|
||||||
|
|
@ -30,18 +36,20 @@ export default function SetupGate({ children }) {
|
||||||
return () => {
|
return () => {
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
};
|
};
|
||||||
}, [location.pathname]);
|
}, [location.pathname, setupDone]);
|
||||||
|
|
||||||
if (state.pathname !== location.pathname || state.needsSetup === null) {
|
const fresh = state.pathname === location.pathname;
|
||||||
return <div className="min-h-screen bg-white dark:bg-neutral-950" />;
|
|
||||||
|
if (location.pathname === '/setup') {
|
||||||
|
// Den Assistenten erst zeigen, wenn klar ist, dass er noch gebraucht wird.
|
||||||
|
if (setupDone) return <Navigate to="/" replace />;
|
||||||
|
if (!fresh || state.needsSetup === null) return <div className="min-h-screen bg-white dark:bg-neutral-950" />;
|
||||||
|
return children;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (state.needsSetup && location.pathname !== '/setup') {
|
if (fresh && state.needsSetup) {
|
||||||
return <Navigate to="/setup" replace />;
|
return <Navigate to="/setup" replace />;
|
||||||
}
|
}
|
||||||
if (!state.needsSetup && location.pathname === '/setup') {
|
|
||||||
return <Navigate to="/" replace />;
|
|
||||||
}
|
|
||||||
|
|
||||||
return children;
|
return children;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
34
hifi-src/src/components/iconRegistry.jsx
Normal file
34
hifi-src/src/components/iconRegistry.jsx
Normal file
|
|
@ -0,0 +1,34 @@
|
||||||
|
import * as Lucide from 'lucide-react';
|
||||||
|
|
||||||
|
// Die komplette Icon-Bibliothek (~1.700 Icons, ~1 MB) - wird nur ueber einen dynamischen
|
||||||
|
// import() geladen (DynamicIcon, IconPicker im Admin), landet dadurch in einem eigenen Chunk
|
||||||
|
// und nicht mehr im Bundle, das jeder Besucher beim ersten Seitenaufruf laedt.
|
||||||
|
|
||||||
|
// Die DB speichert kebab-case-Namen ("shield-alert"), lucide exportiert PascalCase
|
||||||
|
// ("ShieldAlert"). Ueber den gesamten Modul-Namespace statt nur `icons`, damit auch aeltere
|
||||||
|
// Alias-Namen (z. B. "sort-desc") aufgeloest werden, die fruehere Versionen des IconPickers
|
||||||
|
// angeboten haben.
|
||||||
|
export const toComponentName = (name) =>
|
||||||
|
name
|
||||||
|
.split('-')
|
||||||
|
.map((part) => part.charAt(0).toUpperCase() + part.slice(1))
|
||||||
|
.join('');
|
||||||
|
|
||||||
|
const toKebab = (componentName) =>
|
||||||
|
componentName
|
||||||
|
.replace(/([a-z0-9])([A-Z])/g, '$1-$2')
|
||||||
|
.replace(/([A-Z])([A-Z][a-z])/g, '$1-$2')
|
||||||
|
.replace(/([a-z]{2,})([0-9])/g, '$1-$2')
|
||||||
|
.toLowerCase();
|
||||||
|
|
||||||
|
export const ICON_NAMES = Object.keys(Lucide.icons).map(toKebab).sort();
|
||||||
|
|
||||||
|
export const findIcon = (name) => {
|
||||||
|
const Icon = Lucide[toComponentName(name || '')];
|
||||||
|
return Icon && Icon.$$typeof ? Icon : null;
|
||||||
|
};
|
||||||
|
|
||||||
|
export default function RegistryIcon({ name, ...props }) {
|
||||||
|
const Icon = findIcon(name);
|
||||||
|
return Icon ? <Icon {...props} /> : null;
|
||||||
|
}
|
||||||
|
|
@ -10,6 +10,7 @@ export default {
|
||||||
contact: 'Kontakt',
|
contact: 'Kontakt',
|
||||||
whatsapp: 'WhatsApp',
|
whatsapp: 'WhatsApp',
|
||||||
shop: 'Zum Shop',
|
shop: 'Zum Shop',
|
||||||
|
downloads: 'Downloads',
|
||||||
},
|
},
|
||||||
themeToggle: {
|
themeToggle: {
|
||||||
label: 'Theme umschalten',
|
label: 'Theme umschalten',
|
||||||
|
|
@ -33,6 +34,7 @@ export default {
|
||||||
imprint: 'Impressum',
|
imprint: 'Impressum',
|
||||||
privacy: 'Datenschutz',
|
privacy: 'Datenschutz',
|
||||||
terms: 'AGB',
|
terms: 'AGB',
|
||||||
|
downloads: 'Downloads',
|
||||||
cookieSettings: 'Cookie-Einstellungen',
|
cookieSettings: 'Cookie-Einstellungen',
|
||||||
},
|
},
|
||||||
cookieConsent: {
|
cookieConsent: {
|
||||||
|
|
@ -150,7 +152,13 @@ export default {
|
||||||
totalPrice: 'ab ca.',
|
totalPrice: 'ab ca.',
|
||||||
productLoading: 'Produkt wird geladen…',
|
productLoading: 'Produkt wird geladen…',
|
||||||
requestContact: 'Kontakt anfragen',
|
requestContact: 'Kontakt anfragen',
|
||||||
featuredBadge: 'Empfohlen',
|
badges: {
|
||||||
|
recommended: 'Empfohlen',
|
||||||
|
popular: 'Am beliebtesten',
|
||||||
|
tip: 'Tipp',
|
||||||
|
coming_soon: 'Coming soon',
|
||||||
|
},
|
||||||
|
videoLink: 'Zum Video',
|
||||||
moreBullets: (n) => (n === 1 ? '+ 1 weitere Leistung' : `+ ${n} weitere Leistungen`),
|
moreBullets: (n) => (n === 1 ? '+ 1 weitere Leistung' : `+ ${n} weitere Leistungen`),
|
||||||
lessBullets: 'Weniger anzeigen',
|
lessBullets: 'Weniger anzeigen',
|
||||||
wheelHint: 'Mit dem Mausrad blättern',
|
wheelHint: 'Mit dem Mausrad blättern',
|
||||||
|
|
@ -248,4 +256,19 @@ export default {
|
||||||
empty: 'Für dieses Projekt sind noch keine Fotos hinterlegt.',
|
empty: 'Für dieses Projekt sind noch keine Fotos hinterlegt.',
|
||||||
enlargeImage: 'Bild vergrößern',
|
enlargeImage: 'Bild vergrößern',
|
||||||
},
|
},
|
||||||
|
downloadsPage: {
|
||||||
|
metaTitle: 'Downloads',
|
||||||
|
metaDescription: 'Dateien und Songs von HifiPlanet zum Anhören und Herunterladen.',
|
||||||
|
title: 'Downloads',
|
||||||
|
intro: 'Hier stellen wir dir Dateien und Songs bereit – direkt anhören oder herunterladen.',
|
||||||
|
loading: 'Lädt…',
|
||||||
|
empty: 'Aktuell stehen keine Downloads bereit.',
|
||||||
|
download: 'Herunterladen',
|
||||||
|
lockedTitle: 'Geschützter Bereich',
|
||||||
|
lockedText: 'Bitte gib das Passwort ein, das du von uns bekommen hast.',
|
||||||
|
passwordLabel: 'Passwort',
|
||||||
|
unlock: 'Freischalten',
|
||||||
|
unlocking: 'Wird geprüft…',
|
||||||
|
wrongPassword: 'Das Passwort stimmt leider nicht.',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -10,6 +10,7 @@ export default {
|
||||||
contact: 'Contact',
|
contact: 'Contact',
|
||||||
whatsapp: 'WhatsApp',
|
whatsapp: 'WhatsApp',
|
||||||
shop: 'Visit shop',
|
shop: 'Visit shop',
|
||||||
|
downloads: 'Downloads',
|
||||||
},
|
},
|
||||||
themeToggle: {
|
themeToggle: {
|
||||||
label: 'Toggle theme',
|
label: 'Toggle theme',
|
||||||
|
|
@ -33,6 +34,7 @@ export default {
|
||||||
imprint: 'Legal notice',
|
imprint: 'Legal notice',
|
||||||
privacy: 'Privacy',
|
privacy: 'Privacy',
|
||||||
terms: 'Terms',
|
terms: 'Terms',
|
||||||
|
downloads: 'Downloads',
|
||||||
cookieSettings: 'Cookie settings',
|
cookieSettings: 'Cookie settings',
|
||||||
},
|
},
|
||||||
cookieConsent: {
|
cookieConsent: {
|
||||||
|
|
@ -150,7 +152,13 @@ export default {
|
||||||
totalPrice: 'from approx.',
|
totalPrice: 'from approx.',
|
||||||
productLoading: 'Loading product…',
|
productLoading: 'Loading product…',
|
||||||
requestContact: 'Request contact',
|
requestContact: 'Request contact',
|
||||||
featuredBadge: 'Recommended',
|
badges: {
|
||||||
|
recommended: 'Recommended',
|
||||||
|
popular: 'Most popular',
|
||||||
|
tip: 'Tip',
|
||||||
|
coming_soon: 'Coming soon',
|
||||||
|
},
|
||||||
|
videoLink: 'Watch video',
|
||||||
moreBullets: (n) => (n === 1 ? '+ 1 more feature' : `+ ${n} more features`),
|
moreBullets: (n) => (n === 1 ? '+ 1 more feature' : `+ ${n} more features`),
|
||||||
lessBullets: 'Show less',
|
lessBullets: 'Show less',
|
||||||
wheelHint: 'Scroll to browse',
|
wheelHint: 'Scroll to browse',
|
||||||
|
|
@ -248,4 +256,19 @@ export default {
|
||||||
empty: 'No photos have been added for this project yet.',
|
empty: 'No photos have been added for this project yet.',
|
||||||
enlargeImage: 'Enlarge image',
|
enlargeImage: 'Enlarge image',
|
||||||
},
|
},
|
||||||
|
downloadsPage: {
|
||||||
|
metaTitle: 'Downloads',
|
||||||
|
metaDescription: 'Files and songs from HifiPlanet to listen to and download.',
|
||||||
|
title: 'Downloads',
|
||||||
|
intro: 'Here you will find files and songs we provide for you – listen right here or download them.',
|
||||||
|
loading: 'Loading…',
|
||||||
|
empty: 'There are no downloads available right now.',
|
||||||
|
download: 'Download',
|
||||||
|
lockedTitle: 'Protected area',
|
||||||
|
lockedText: 'Please enter the password you received from us.',
|
||||||
|
passwordLabel: 'Password',
|
||||||
|
unlock: 'Unlock',
|
||||||
|
unlocking: 'Checking…',
|
||||||
|
wrongPassword: 'Sorry, that password is not correct.',
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,18 @@ import App from './App.jsx';
|
||||||
import { ThemeProvider } from './context/ThemeContext.jsx';
|
import { ThemeProvider } from './context/ThemeContext.jsx';
|
||||||
import { AuthProvider } from './context/AuthContext.jsx';
|
import { AuthProvider } from './context/AuthContext.jsx';
|
||||||
import { CookieConsentProvider } from './context/CookieConsentContext.jsx';
|
import { CookieConsentProvider } from './context/CookieConsentContext.jsx';
|
||||||
|
// Schriften der Paket-Kacheln (Barlow/Barlow Condensed) und des Kontaktformulars (Michroma) -
|
||||||
|
// lokal mit ausgeliefert statt von Google Fonts geladen: dort ging bei jedem Aufruf ohne
|
||||||
|
// Einwilligung die IP-Adresse an Google (abmahnfaehig, LG Muenchen I, 20.01.2022). Die CSS-
|
||||||
|
// Dateien enthalten nur @font-face-Regeln - die Schriftdateien selbst laedt der Browser erst,
|
||||||
|
// wenn eine Seite die Schrift tatsaechlich verwendet, und nur im benoetigten Zeichensatz.
|
||||||
|
import '@fontsource/barlow/400.css';
|
||||||
|
import '@fontsource/barlow/500.css';
|
||||||
|
import '@fontsource/barlow/600.css';
|
||||||
|
import '@fontsource/barlow/700.css';
|
||||||
|
import '@fontsource/barlow-condensed/500.css';
|
||||||
|
import '@fontsource/barlow-condensed/600.css';
|
||||||
|
import '@fontsource/michroma/400.css';
|
||||||
import './index.css';
|
import './index.css';
|
||||||
|
|
||||||
ReactDOM.createRoot(document.getElementById('root')).render(
|
ReactDOM.createRoot(document.getElementById('root')).render(
|
||||||
|
|
|
||||||
344
hifi-src/src/pages/admin/Downloads.jsx
Normal file
344
hifi-src/src/pages/admin/Downloads.jsx
Normal file
|
|
@ -0,0 +1,344 @@
|
||||||
|
import { useEffect, useRef, useState } from 'react';
|
||||||
|
import { Eye, EyeOff } from 'lucide-react';
|
||||||
|
import { api, API_BASE } from '../../api/client.js';
|
||||||
|
import { ALLOWED_DOWNLOAD_EXTENSIONS, formatFileSize } from '../../utils/downloads.js';
|
||||||
|
|
||||||
|
const inputCls =
|
||||||
|
'w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900';
|
||||||
|
|
||||||
|
const emptyForm = { title: '', description: '', sort_order: 0 };
|
||||||
|
|
||||||
|
// fetch() meldet keinen Upload-Fortschritt - bei Songs mit 50+ MB soll man aber sehen, dass
|
||||||
|
// etwas passiert. Daher hier XMLHttpRequest statt api.post.
|
||||||
|
function uploadWithProgress(path, formData, onProgress) {
|
||||||
|
return new Promise((resolve, reject) => {
|
||||||
|
const xhr = new XMLHttpRequest();
|
||||||
|
xhr.open('POST', `${API_BASE}${path}`);
|
||||||
|
xhr.withCredentials = true;
|
||||||
|
xhr.upload.onprogress = (e) => {
|
||||||
|
if (e.lengthComputable) onProgress(e.loaded / e.total);
|
||||||
|
};
|
||||||
|
xhr.onload = () => {
|
||||||
|
let data = null;
|
||||||
|
try {
|
||||||
|
data = JSON.parse(xhr.responseText);
|
||||||
|
} catch {
|
||||||
|
// kein JSON - z. B. eine HTML-Fehlerseite des Webservers bei zu grossen Dateien
|
||||||
|
}
|
||||||
|
if (xhr.status >= 200 && xhr.status < 300) {
|
||||||
|
resolve(data);
|
||||||
|
} else {
|
||||||
|
reject(new Error(data?.error || (xhr.status === 413 ? 'Die Datei ist zu groß für diesen Server.' : `Fehler ${xhr.status}`)));
|
||||||
|
}
|
||||||
|
};
|
||||||
|
xhr.onerror = () => reject(new Error('Netzwerkfehler beim Hochladen'));
|
||||||
|
xhr.send(formData);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
// Optionales Zugangspasswort fuer /downloads (app_settings.downloads_password, leer =
|
||||||
|
// oeffentlich) - bewusst im Klartext einsehbar, es ist ein Code zum Weitergeben an Kunden.
|
||||||
|
function AccessSettings() {
|
||||||
|
const [saved, setSaved] = useState(undefined); // undefined = laedt, null = oeffentlich
|
||||||
|
const [value, setValue] = useState('');
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [message, setMessage] = useState(null); // { kind: 'ok' | 'error', text }
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
api
|
||||||
|
.get('/settings/downloads')
|
||||||
|
.then((res) => {
|
||||||
|
setSaved(res.password);
|
||||||
|
setValue(res.password || '');
|
||||||
|
})
|
||||||
|
.catch((err) => setMessage({ kind: 'error', text: err.message }));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleSave = async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setBusy(true);
|
||||||
|
setMessage(null);
|
||||||
|
try {
|
||||||
|
const res = await api.put('/settings/downloads', { password: value });
|
||||||
|
setSaved(res.password);
|
||||||
|
setValue(res.password || '');
|
||||||
|
setMessage({
|
||||||
|
kind: 'ok',
|
||||||
|
text: res.password ? 'Gespeichert – der Bereich ist jetzt geschützt.' : 'Gespeichert – der Bereich ist jetzt öffentlich.',
|
||||||
|
});
|
||||||
|
} catch (err) {
|
||||||
|
setMessage({ kind: 'error', text: err.message });
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<form onSubmit={handleSave} className="space-y-3 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
|
<h2 className="font-bold text-neutral-900 dark:text-white">Zugriffsschutz</h2>
|
||||||
|
<p className="text-sm text-neutral-600 dark:text-neutral-300">
|
||||||
|
{saved === undefined && 'Lädt…'}
|
||||||
|
{saved === null && 'Öffentlich – jeder, der die Seite aufruft, sieht die Dateien.'}
|
||||||
|
{typeof saved === 'string' && 'Geschützt – Besucher müssen zuerst das Passwort eingeben.'}
|
||||||
|
</p>
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">
|
||||||
|
Zugangspasswort (leer = öffentlich)
|
||||||
|
</label>
|
||||||
|
<input value={value} maxLength={100} autoComplete="off" onChange={(e) => setValue(e.target.value)} className={inputCls} />
|
||||||
|
<p className="mt-1 text-xs text-neutral-400">
|
||||||
|
Das Passwort an die Kunden weitergeben – es bleibt hier jederzeit einsehbar. Direkte Links zu einzelnen
|
||||||
|
Dateien funktionieren auch ohne Passwort; wer freigeschaltet hat, könnte sie also weitergeben.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
{message && (
|
||||||
|
<p className={`text-sm ${message.kind === 'error' ? 'text-red-600' : 'text-brand-600 dark:text-brand-400'}`}>{message.text}</p>
|
||||||
|
)}
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={busy || saved === undefined}
|
||||||
|
className="rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50"
|
||||||
|
>
|
||||||
|
Speichern
|
||||||
|
</button>
|
||||||
|
</form>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
export default function Downloads() {
|
||||||
|
const [downloads, setDownloads] = useState([]);
|
||||||
|
const [form, setForm] = useState(emptyForm);
|
||||||
|
const [file, setFile] = useState(null);
|
||||||
|
const [editingId, setEditingId] = useState(null);
|
||||||
|
const [progress, setProgress] = useState(null); // 0..1 waehrend eines Uploads
|
||||||
|
const [busy, setBusy] = useState(false);
|
||||||
|
const [error, setError] = useState('');
|
||||||
|
const [visibilityBusyId, setVisibilityBusyId] = useState(null);
|
||||||
|
const fileInputRef = useRef(null);
|
||||||
|
|
||||||
|
const load = () => api.get('/downloads/manage').then(setDownloads);
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
load();
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const resetForm = () => {
|
||||||
|
setEditingId(null);
|
||||||
|
setForm(emptyForm);
|
||||||
|
setFile(null);
|
||||||
|
setError('');
|
||||||
|
if (fileInputRef.current) fileInputRef.current.value = '';
|
||||||
|
};
|
||||||
|
|
||||||
|
const startEdit = (item) => {
|
||||||
|
resetForm();
|
||||||
|
setEditingId(item.id);
|
||||||
|
setForm({ title: item.title, description: item.description || '', sort_order: item.sort_order });
|
||||||
|
window.scrollTo({ top: 0, behavior: 'smooth' });
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleSubmit = async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
if (!editingId && !file) {
|
||||||
|
setError('Bitte eine Datei auswählen.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
setBusy(true);
|
||||||
|
setError('');
|
||||||
|
try {
|
||||||
|
if (editingId) {
|
||||||
|
await api.put(`/downloads/${editingId}`, form);
|
||||||
|
if (file) {
|
||||||
|
const data = new FormData();
|
||||||
|
data.append('file', file);
|
||||||
|
setProgress(0);
|
||||||
|
await uploadWithProgress(`/downloads/${editingId}/file`, data, setProgress);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
const data = new FormData();
|
||||||
|
data.append('file', file);
|
||||||
|
data.append('title', form.title);
|
||||||
|
data.append('description', form.description);
|
||||||
|
setProgress(0);
|
||||||
|
await uploadWithProgress('/downloads', data, setProgress);
|
||||||
|
}
|
||||||
|
resetForm();
|
||||||
|
load();
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message);
|
||||||
|
} finally {
|
||||||
|
setBusy(false);
|
||||||
|
setProgress(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const toggleVisibility = async (item) => {
|
||||||
|
setVisibilityBusyId(item.id);
|
||||||
|
try {
|
||||||
|
const res = await api.patch(`/downloads/${item.id}/visibility`, { is_hidden: !item.is_hidden });
|
||||||
|
setDownloads((ds) => ds.map((d) => (d.id === item.id ? { ...d, is_hidden: res.is_hidden } : d)));
|
||||||
|
} catch (err) {
|
||||||
|
alert(`Sichtbarkeit konnte nicht geändert werden: ${err.message}`);
|
||||||
|
} finally {
|
||||||
|
setVisibilityBusyId(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
const handleDelete = async (item) => {
|
||||||
|
if (!confirm(`"${item.title}" inkl. Datei wirklich löschen?`)) return;
|
||||||
|
await api.delete(`/downloads/${item.id}`);
|
||||||
|
if (editingId === item.id) resetForm();
|
||||||
|
load();
|
||||||
|
};
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="grid gap-6 lg:grid-cols-3">
|
||||||
|
<div className="lg:col-span-2">
|
||||||
|
<h1 className="mb-4 text-xl font-bold text-neutral-900 dark:text-white">Downloads</h1>
|
||||||
|
<p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400">
|
||||||
|
Dateien, die Kunden auf der Seite{' '}
|
||||||
|
<a href="/downloads" target="_blank" rel="noopener noreferrer" className="text-brand-600 hover:underline">/downloads</a>{' '}
|
||||||
|
anhören bzw. herunterladen können, z. B. Songs oder Anleitungen. Der Menüpunkt „Downloads“ erscheint auf
|
||||||
|
der Website automatisch, sobald mindestens eine Datei sichtbar ist. Ohne Zugangspasswort (siehe
|
||||||
|
„Zugriffsschutz“) ist die Seite öffentlich.
|
||||||
|
</p>
|
||||||
|
<div className="overflow-hidden rounded-xl border border-neutral-200 dark:border-neutral-800">
|
||||||
|
<table className="w-full text-left text-sm">
|
||||||
|
<thead className="bg-neutral-50 text-neutral-500 dark:bg-neutral-900 dark:text-neutral-400">
|
||||||
|
<tr>
|
||||||
|
<th className="px-4 py-2">Titel / Datei</th>
|
||||||
|
<th className="px-4 py-2">Größe</th>
|
||||||
|
<th className="px-4 py-2">Website</th>
|
||||||
|
<th className="px-4 py-2 text-right">Aktionen</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody className="divide-y divide-neutral-100 dark:divide-neutral-800">
|
||||||
|
{downloads.map((item) => (
|
||||||
|
<tr key={item.id} className="bg-white dark:bg-neutral-950">
|
||||||
|
<td className={`px-4 py-2 ${item.is_hidden ? 'opacity-60' : ''}`}>
|
||||||
|
<p className="font-medium text-neutral-800 dark:text-neutral-100">{item.title}</p>
|
||||||
|
<a
|
||||||
|
href={item.file_path}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="break-all text-xs text-neutral-500 hover:text-brand-600 dark:text-neutral-400"
|
||||||
|
>
|
||||||
|
{item.file_name}
|
||||||
|
</a>
|
||||||
|
</td>
|
||||||
|
<td className="whitespace-nowrap px-4 py-2 text-neutral-500 dark:text-neutral-400">{formatFileSize(item.file_size)}</td>
|
||||||
|
<td className="px-4 py-2">
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => toggleVisibility(item)}
|
||||||
|
disabled={visibilityBusyId === item.id}
|
||||||
|
title={item.is_hidden ? 'Wieder auf der Website anzeigen' : 'Auf der Website ausblenden'}
|
||||||
|
className={`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold transition disabled:opacity-50 ${
|
||||||
|
item.is_hidden
|
||||||
|
? 'border-amber-300 bg-amber-50 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-300'
|
||||||
|
: 'border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{item.is_hidden ? <EyeOff className="h-3.5 w-3.5" /> : <Eye className="h-3.5 w-3.5" />}
|
||||||
|
{item.is_hidden ? 'Ausgeblendet' : 'Sichtbar'}
|
||||||
|
</button>
|
||||||
|
</td>
|
||||||
|
<td className="whitespace-nowrap px-4 py-2 text-right">
|
||||||
|
<button onClick={() => startEdit(item)} className="mr-3 text-brand-600 hover:underline">Bearbeiten</button>
|
||||||
|
<button onClick={() => handleDelete(item)} className="text-red-600 hover:underline">Löschen</button>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
))}
|
||||||
|
{downloads.length === 0 && (
|
||||||
|
<tr><td colSpan={4} className="px-4 py-6 text-center text-neutral-400">Noch keine Dateien hochgeladen.</td></tr>
|
||||||
|
)}
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div className="h-fit space-y-6">
|
||||||
|
<form onSubmit={handleSubmit} className="space-y-4 rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
|
<h2 className="font-bold text-neutral-900 dark:text-white">{editingId ? 'Download bearbeiten' : 'Neue Datei hochladen'}</h2>
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">
|
||||||
|
{editingId ? 'Datei ersetzen (optional)' : 'Datei *'}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
ref={fileInputRef}
|
||||||
|
type="file"
|
||||||
|
accept={ALLOWED_DOWNLOAD_EXTENSIONS.map((ext) => `.${ext}`).join(',')}
|
||||||
|
onChange={(e) => setFile(e.target.files?.[0] || null)}
|
||||||
|
className="block w-full text-sm text-neutral-600 file:mr-3 file:rounded-md file:border-0 file:bg-brand-500 file:px-3 file:py-2 file:text-sm file:font-semibold file:text-white hover:file:bg-brand-600 dark:text-neutral-300"
|
||||||
|
/>
|
||||||
|
<p className="mt-1 text-xs text-neutral-400">
|
||||||
|
Musik (MP3, WAV, FLAC, …), Videos, PDFs, Bilder, Office-Dokumente oder ZIP-Archive. Andere Dateitypen bitte als ZIP hochladen.
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">
|
||||||
|
Titel {editingId ? '*' : '(optional)'}
|
||||||
|
</label>
|
||||||
|
<input
|
||||||
|
required={!!editingId}
|
||||||
|
value={form.title}
|
||||||
|
maxLength={150}
|
||||||
|
onChange={(e) => setForm({ ...form, title: e.target.value })}
|
||||||
|
placeholder={editingId ? '' : 'Leer lassen = Dateiname'}
|
||||||
|
className={inputCls}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Beschreibung (optional)</label>
|
||||||
|
<textarea
|
||||||
|
rows={3}
|
||||||
|
value={form.description}
|
||||||
|
onChange={(e) => setForm({ ...form, description: e.target.value })}
|
||||||
|
className={inputCls}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{editingId && (
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Sortierung</label>
|
||||||
|
<input
|
||||||
|
type="number"
|
||||||
|
value={form.sort_order}
|
||||||
|
onChange={(e) => setForm({ ...form, sort_order: Number(e.target.value) })}
|
||||||
|
className={inputCls}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
|
||||||
|
{progress !== null && (
|
||||||
|
<div>
|
||||||
|
<div className="h-2 overflow-hidden rounded-full bg-neutral-200 dark:bg-neutral-800">
|
||||||
|
<div className="h-full rounded-full bg-brand-500 transition-[width]" style={{ width: `${Math.round(progress * 100)}%` }} />
|
||||||
|
</div>
|
||||||
|
<p className="mt-1 text-xs text-neutral-500 dark:text-neutral-400">
|
||||||
|
{progress < 1 ? `Wird hochgeladen … ${Math.round(progress * 100)} %` : 'Wird gespeichert …'}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
|
{error && <p className="text-sm text-red-600">{error}</p>}
|
||||||
|
|
||||||
|
<div className="flex gap-2">
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={busy}
|
||||||
|
className="rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-50"
|
||||||
|
>
|
||||||
|
{editingId ? 'Speichern' : 'Hochladen'}
|
||||||
|
</button>
|
||||||
|
{editingId && (
|
||||||
|
<button type="button" onClick={resetForm} disabled={busy} className="rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700">
|
||||||
|
Abbrechen
|
||||||
|
</button>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<AccessSettings />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { useEffect, useMemo, useRef, useState } from 'react';
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
||||||
import { Link } from 'react-router-dom';
|
import { Link } from 'react-router-dom';
|
||||||
|
import { CirclePlay, Eye, EyeOff } from 'lucide-react';
|
||||||
import { api } from '../../api/client.js';
|
import { api } from '../../api/client.js';
|
||||||
import { PACKAGE_TIERS, tierSortOrder } from '../../constants/packageTiers.js';
|
import { PACKAGE_TIERS, tierSortOrder } from '../../constants/packageTiers.js';
|
||||||
import TextStyleWidget from '../../components/TextStyleWidget.jsx';
|
import TextStyleWidget from '../../components/TextStyleWidget.jsx';
|
||||||
|
|
@ -7,6 +8,20 @@ import TextStyleWidget from '../../components/TextStyleWidget.jsx';
|
||||||
const inputCls =
|
const inputCls =
|
||||||
'w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900';
|
'w-full rounded-md border border-neutral-300 bg-white px-3 py-2 text-sm dark:border-neutral-700 dark:bg-neutral-900';
|
||||||
|
|
||||||
|
// Muss zu PackageController::BADGES passen. Die oeffentlichen Texte kommen aus i18n
|
||||||
|
// (modelPage.badges), hier nur die deutsche Beschriftung fuer die Auswahl.
|
||||||
|
const BADGE_OPTIONS = [
|
||||||
|
{ value: '', label: 'Keine' },
|
||||||
|
{ value: 'recommended', label: 'Empfohlen' },
|
||||||
|
{ value: 'popular', label: 'Am beliebtesten' },
|
||||||
|
{ value: 'tip', label: 'Tipp' },
|
||||||
|
{ value: 'coming_soon', label: 'Coming soon' },
|
||||||
|
{ value: 'custom', label: 'Eigener Text …' },
|
||||||
|
];
|
||||||
|
|
||||||
|
const badgeLabel = (badge, text) =>
|
||||||
|
badge === 'custom' ? text : BADGE_OPTIONS.find((o) => o.value === badge && o.value)?.label;
|
||||||
|
|
||||||
const formFromPkg = (pkg) => ({
|
const formFromPkg = (pkg) => ({
|
||||||
description: pkg.description || '',
|
description: pkg.description || '',
|
||||||
markup_type: pkg.markup_type || 'none',
|
markup_type: pkg.markup_type || 'none',
|
||||||
|
|
@ -14,7 +29,9 @@ const formFromPkg = (pkg) => ({
|
||||||
icon_name: pkg.icon_name || '',
|
icon_name: pkg.icon_name || '',
|
||||||
tagline: pkg.tagline || '',
|
tagline: pkg.tagline || '',
|
||||||
price_text: pkg.price_text || '',
|
price_text: pkg.price_text || '',
|
||||||
is_featured: !!pkg.is_featured,
|
badge: pkg.badge || '',
|
||||||
|
badge_text: pkg.badge_text || '',
|
||||||
|
video_url: pkg.video_url || '',
|
||||||
sort_order: pkg.sort_order ?? 0,
|
sort_order: pkg.sort_order ?? 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -25,22 +42,56 @@ const emptyRowForm = (tierIndex) => ({
|
||||||
icon_name: '',
|
icon_name: '',
|
||||||
tagline: '',
|
tagline: '',
|
||||||
price_text: '',
|
price_text: '',
|
||||||
is_featured: false,
|
badge: '',
|
||||||
|
badge_text: '',
|
||||||
|
video_url: '',
|
||||||
sort_order: tierSortOrder(tierIndex),
|
sort_order: tierSortOrder(tierIndex),
|
||||||
});
|
});
|
||||||
|
|
||||||
const FORM_FIELDS = ['description', 'markup_type', 'markup_value', 'icon_name', 'tagline', 'price_text', 'is_featured', 'sort_order'];
|
const FORM_FIELDS = [
|
||||||
|
'description', 'markup_type', 'markup_value', 'icon_name', 'tagline', 'price_text',
|
||||||
|
'badge', 'badge_text', 'video_url', 'sort_order',
|
||||||
|
];
|
||||||
|
|
||||||
// Eine Zeile gilt als "zu speichern", wenn sie neu angehakt ist oder sich
|
// Eine Zeile gilt als "zu speichern", wenn sie neu angehakt ist oder sich
|
||||||
// gegenueber dem geladenen Stand (existing) etwas geaendert hat.
|
// gegenueber dem geladenen Stand (existing) etwas geaendert hat.
|
||||||
const isRowDirty = (row) => {
|
const isRowDirty = (row) => {
|
||||||
if (!row.existing) return row.checked;
|
if (!row.existing) return row.checked;
|
||||||
const base = formFromPkg(row.existing);
|
const base = formFromPkg(row.existing);
|
||||||
return FORM_FIELDS.some((f) =>
|
return FORM_FIELDS.some((f) => String(base[f]) !== String(row.form[f]));
|
||||||
f === 'is_featured' ? !!base[f] !== !!row.form[f] : String(base[f]) !== String(row.form[f])
|
|
||||||
);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
function BadgeChip({ badge, text }) {
|
||||||
|
const label = badgeLabel(badge, text);
|
||||||
|
if (!label) return null;
|
||||||
|
return (
|
||||||
|
<span className="rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400">
|
||||||
|
{label}
|
||||||
|
</span>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ein Klick blendet das Paket auf der Website aus/ein - wird sofort gespeichert, unabhaengig
|
||||||
|
// von "Alle speichern" (siehe PackageController::setVisibility).
|
||||||
|
function VisibilityToggle({ pkg, busy, onToggle }) {
|
||||||
|
return (
|
||||||
|
<button
|
||||||
|
type="button"
|
||||||
|
onClick={() => onToggle(pkg)}
|
||||||
|
disabled={busy}
|
||||||
|
title={pkg.is_hidden ? 'Wieder auf der Website anzeigen' : 'Auf der Website ausblenden'}
|
||||||
|
className={`inline-flex items-center gap-1.5 rounded-full border px-2.5 py-1 text-xs font-semibold transition disabled:opacity-50 ${
|
||||||
|
pkg.is_hidden
|
||||||
|
? 'border-amber-300 bg-amber-50 text-amber-800 hover:bg-amber-100 dark:border-amber-700 dark:bg-amber-900/30 dark:text-amber-300'
|
||||||
|
: 'border-neutral-300 text-neutral-600 hover:bg-neutral-100 dark:border-neutral-700 dark:text-neutral-300 dark:hover:bg-neutral-800'
|
||||||
|
}`}
|
||||||
|
>
|
||||||
|
{pkg.is_hidden ? <EyeOff className="h-3.5 w-3.5" /> : <Eye className="h-3.5 w-3.5" />}
|
||||||
|
{pkg.is_hidden ? 'Ausgeblendet' : 'Sichtbar'}
|
||||||
|
</button>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Baut die Editor-Zeilen fuer ein Modell: die 8 Standard-Stufen in
|
// Baut die Editor-Zeilen fuer ein Modell: die 8 Standard-Stufen in
|
||||||
// Leiter-Reihenfolge (bestehende Pakete case-insensitiv per Name zugeordnet,
|
// Leiter-Reihenfolge (bestehende Pakete case-insensitiv per Name zugeordnet,
|
||||||
// jedes hoechstens einmal), dahinter alle uebrigen Pakete mit Alt-Namen.
|
// jedes hoechstens einmal), dahinter alle uebrigen Pakete mit Alt-Namen.
|
||||||
|
|
@ -87,6 +138,7 @@ export default function Packages() {
|
||||||
const [copyResult, setCopyResult] = useState(null); // { text } | { error }
|
const [copyResult, setCopyResult] = useState(null); // { text } | { error }
|
||||||
const [brandFilter, setBrandFilter] = useState('all');
|
const [brandFilter, setBrandFilter] = useState('all');
|
||||||
const [modelFilter, setModelFilter] = useState('all');
|
const [modelFilter, setModelFilter] = useState('all');
|
||||||
|
const [visibilityBusyId, setVisibilityBusyId] = useState(null);
|
||||||
const descriptionRefs = useRef(new Map());
|
const descriptionRefs = useRef(new Map());
|
||||||
|
|
||||||
// Umschliesst (oder entfernt, falls schon umschlossen) die aktuelle Textauswahl im
|
// Umschliesst (oder entfernt, falls schon umschlossen) die aktuelle Textauswahl im
|
||||||
|
|
@ -247,6 +299,22 @@ export default function Packages() {
|
||||||
setGlobalMsg(null);
|
setGlobalMsg(null);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Aktualisiert nur is_hidden in Liste und Editor-Zeilen - ungespeicherte Eingaben im
|
||||||
|
// Batch-Editor bleiben dabei unangetastet (is_hidden ist nicht Teil des Formulars).
|
||||||
|
const toggleVisibility = async (pkg) => {
|
||||||
|
setVisibilityBusyId(pkg.id);
|
||||||
|
try {
|
||||||
|
const res = await api.patch(`/packages/${pkg.id}/visibility`, { is_hidden: !pkg.is_hidden });
|
||||||
|
const apply = (p) => (p.id === pkg.id ? { ...p, is_hidden: res.is_hidden } : p);
|
||||||
|
setPackages((ps) => ps.map(apply));
|
||||||
|
setRows((rs) => rs.map((r) => (r.existing?.id === pkg.id ? { ...r, existing: apply(r.existing) } : r)));
|
||||||
|
} catch (err) {
|
||||||
|
alert(`Sichtbarkeit konnte nicht geändert werden: ${err.message}`);
|
||||||
|
} finally {
|
||||||
|
setVisibilityBusyId(null);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const handleDeleteFromTable = async (pkg) => {
|
const handleDeleteFromTable = async (pkg) => {
|
||||||
if (!confirm('Paket inkl. aller Produkte wirklich löschen?')) return;
|
if (!confirm('Paket inkl. aller Produkte wirklich löschen?')) return;
|
||||||
await api.delete(`/packages/${pkg.id}`);
|
await api.delete(`/packages/${pkg.id}`);
|
||||||
|
|
@ -350,6 +418,7 @@ export default function Packages() {
|
||||||
<th className="px-4 py-2">Marke / Modell</th>
|
<th className="px-4 py-2">Marke / Modell</th>
|
||||||
<th className="px-4 py-2">Paket</th>
|
<th className="px-4 py-2">Paket</th>
|
||||||
<th className="px-4 py-2">Aufschlag</th>
|
<th className="px-4 py-2">Aufschlag</th>
|
||||||
|
<th className="px-4 py-2">Website</th>
|
||||||
<th className="px-4 py-2 text-right">Aktionen</th>
|
<th className="px-4 py-2 text-right">Aktionen</th>
|
||||||
</tr>
|
</tr>
|
||||||
</thead>
|
</thead>
|
||||||
|
|
@ -358,13 +427,10 @@ export default function Packages() {
|
||||||
<tr key={pkg.id} className="bg-white dark:bg-neutral-950">
|
<tr key={pkg.id} className="bg-white dark:bg-neutral-950">
|
||||||
<td className="px-4 py-2">{pkg.brand_name} {pkg.model_name}</td>
|
<td className="px-4 py-2">{pkg.brand_name} {pkg.model_name}</td>
|
||||||
<td className="px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100">
|
<td className="px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100">
|
||||||
<span className="inline-flex items-center gap-1.5">
|
<span className={`inline-flex flex-wrap items-center gap-1.5 ${pkg.is_hidden ? 'opacity-60' : ''}`}>
|
||||||
{pkg.name}
|
{pkg.name}
|
||||||
{pkg.is_featured && (
|
<BadgeChip badge={pkg.badge} text={pkg.badge_text} />
|
||||||
<span className="rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400">
|
{pkg.video_url && <CirclePlay className="h-4 w-4 text-red-500" aria-label="Mit Video-Link" />}
|
||||||
Empfohlen
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
</span>
|
</span>
|
||||||
</td>
|
</td>
|
||||||
<td className="px-4 py-2 text-neutral-500 dark:text-neutral-400">
|
<td className="px-4 py-2 text-neutral-500 dark:text-neutral-400">
|
||||||
|
|
@ -372,6 +438,9 @@ export default function Packages() {
|
||||||
{pkg.markup_type === 'percent' && `+${pkg.markup_value} %`}
|
{pkg.markup_type === 'percent' && `+${pkg.markup_value} %`}
|
||||||
{(!pkg.markup_type || pkg.markup_type === 'none') && '–'}
|
{(!pkg.markup_type || pkg.markup_type === 'none') && '–'}
|
||||||
</td>
|
</td>
|
||||||
|
<td className="px-4 py-2">
|
||||||
|
<VisibilityToggle pkg={pkg} busy={visibilityBusyId === pkg.id} onToggle={toggleVisibility} />
|
||||||
|
</td>
|
||||||
<td className="px-4 py-2 text-right">
|
<td className="px-4 py-2 text-right">
|
||||||
<Link to={`/admin/packages/${pkg.id}/products`} className="mr-3 text-brand-600 hover:underline">Produkte</Link>
|
<Link to={`/admin/packages/${pkg.id}/products`} className="mr-3 text-brand-600 hover:underline">Produkte</Link>
|
||||||
<Link to={`/admin/packages/${pkg.id}/upgrades`} className="mr-3 text-brand-600 hover:underline">Upgrades</Link>
|
<Link to={`/admin/packages/${pkg.id}/upgrades`} className="mr-3 text-brand-600 hover:underline">Upgrades</Link>
|
||||||
|
|
@ -391,7 +460,7 @@ export default function Packages() {
|
||||||
</tr>
|
</tr>
|
||||||
))}
|
))}
|
||||||
{filteredPackages.length === 0 && (
|
{filteredPackages.length === 0 && (
|
||||||
<tr><td colSpan={4} className="px-4 py-6 text-center text-neutral-400">
|
<tr><td colSpan={5} className="px-4 py-6 text-center text-neutral-400">
|
||||||
{packages.length === 0 ? 'Noch keine Pakete angelegt.' : 'Keine Pakete für diesen Filter.'}
|
{packages.length === 0 ? 'Noch keine Pakete angelegt.' : 'Keine Pakete für diesen Filter.'}
|
||||||
</td></tr>
|
</td></tr>
|
||||||
)}
|
)}
|
||||||
|
|
@ -510,13 +579,15 @@ export default function Packages() {
|
||||||
</span>
|
</span>
|
||||||
)
|
)
|
||||||
)}
|
)}
|
||||||
{row.form.is_featured && (
|
<BadgeChip badge={row.form.badge} text={row.form.badge_text} />
|
||||||
<span className="rounded-full bg-brand-100 px-2 py-0.5 text-xs font-semibold text-brand-700 dark:bg-brand-900/40 dark:text-brand-400">
|
{row.form.video_url && <CirclePlay className="h-4 w-4 text-red-500" aria-label="Mit Video-Link" />}
|
||||||
Empfohlen
|
|
||||||
</span>
|
|
||||||
)}
|
|
||||||
{row.existing && (
|
{row.existing && (
|
||||||
<span className="ml-auto flex items-center gap-3 text-sm">
|
<span className="ml-auto flex flex-wrap items-center gap-3 text-sm">
|
||||||
|
<VisibilityToggle
|
||||||
|
pkg={row.existing}
|
||||||
|
busy={visibilityBusyId === row.existing.id}
|
||||||
|
onToggle={toggleVisibility}
|
||||||
|
/>
|
||||||
<Link to={`/admin/packages/${row.existing.id}/products`} className="text-brand-600 hover:underline">Produkte</Link>
|
<Link to={`/admin/packages/${row.existing.id}/products`} className="text-brand-600 hover:underline">Produkte</Link>
|
||||||
<Link to={`/admin/packages/${row.existing.id}/upgrades`} className="text-brand-600 hover:underline">Upgrades</Link>
|
<Link to={`/admin/packages/${row.existing.id}/upgrades`} className="text-brand-600 hover:underline">Upgrades</Link>
|
||||||
<button type="button" onClick={() => handleDeleteRow(row)} className="text-red-600 hover:underline">Löschen</button>
|
<button type="button" onClick={() => handleDeleteRow(row)} className="text-red-600 hover:underline">Löschen</button>
|
||||||
|
|
@ -584,12 +655,48 @@ export default function Packages() {
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div className="grid max-w-2xl gap-4 sm:grid-cols-2">
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Markierung</label>
|
||||||
|
<select
|
||||||
|
value={row.form.badge}
|
||||||
|
onChange={(e) => updateRowForm(row.key, { badge: e.target.value })}
|
||||||
|
className={inputCls}
|
||||||
|
>
|
||||||
|
{BADGE_OPTIONS.map((o) => <option key={o.value} value={o.value}>{o.label}</option>)}
|
||||||
|
</select>
|
||||||
|
{row.form.badge === 'custom' && (
|
||||||
|
<input
|
||||||
|
value={row.form.badge_text}
|
||||||
|
onChange={(e) => updateRowForm(row.key, { badge_text: e.target.value })}
|
||||||
|
maxLength={40}
|
||||||
|
placeholder='z. B. "Neu" oder "Angebot"'
|
||||||
|
className={`${inputCls} mt-2`}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
<p className="mt-1 text-xs text-neutral-400">Erscheint als Hinweis oben auf der Kachel.</p>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Video-Link (optional)</label>
|
||||||
|
<input
|
||||||
|
type="url"
|
||||||
|
value={row.form.video_url}
|
||||||
|
onChange={(e) => updateRowForm(row.key, { video_url: e.target.value })}
|
||||||
|
placeholder="https://youtu.be/…"
|
||||||
|
className={inputCls}
|
||||||
|
/>
|
||||||
|
<p className="mt-1 text-xs text-neutral-400">
|
||||||
|
Zeigt auf der Kachel einen „Zum Video“-Button (öffnet in neuem Tab).
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
{/* icon_name/tagline bleiben im Form-State und Payload erhalten (Bestandsdaten
|
{/* icon_name/tagline bleiben im Form-State und Payload erhalten (Bestandsdaten
|
||||||
nicht wegwischen), sind aber nicht mehr konfigurierbar - das Frontend
|
nicht wegwischen), sind aber nicht mehr konfigurierbar - das Frontend
|
||||||
zeigt beides auf den Kacheln nicht mehr an. */}
|
zeigt beides auf den Kacheln nicht mehr an. */}
|
||||||
<details className="rounded-lg border border-neutral-200 dark:border-neutral-800">
|
<details className="rounded-lg border border-neutral-200 dark:border-neutral-800">
|
||||||
<summary className="cursor-pointer select-none px-3 py-2 text-sm font-medium text-neutral-600 dark:text-neutral-300">
|
<summary className="cursor-pointer select-none px-3 py-2 text-sm font-medium text-neutral-600 dark:text-neutral-300">
|
||||||
Weitere Optionen (Preis-Text, Empfohlen, Sortierung)
|
Weitere Optionen (Preis-Text, Sortierung)
|
||||||
</summary>
|
</summary>
|
||||||
<div className="space-y-4 border-t border-neutral-200 p-3 dark:border-neutral-800">
|
<div className="space-y-4 border-t border-neutral-200 p-3 dark:border-neutral-800">
|
||||||
<div>
|
<div>
|
||||||
|
|
@ -608,15 +715,6 @@ export default function Packages() {
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
<label className="flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300">
|
|
||||||
<input
|
|
||||||
type="checkbox"
|
|
||||||
checked={row.form.is_featured}
|
|
||||||
onChange={(e) => updateRowForm(row.key, { is_featured: e.target.checked })}
|
|
||||||
className="h-4 w-4 rounded border-neutral-300 text-brand-600 focus:ring-brand-500"
|
|
||||||
/>
|
|
||||||
Als empfohlen hervorheben
|
|
||||||
</label>
|
|
||||||
<div>
|
<div>
|
||||||
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Sortierung</label>
|
<label className="mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300">Sortierung</label>
|
||||||
<input
|
<input
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,4 @@
|
||||||
|
import { Suspense } from 'react';
|
||||||
import { NavLink, Outlet } from 'react-router-dom';
|
import { NavLink, Outlet } from 'react-router-dom';
|
||||||
import { useAuth } from '../../../context/AuthContext.jsx';
|
import { useAuth } from '../../../context/AuthContext.jsx';
|
||||||
|
|
||||||
|
|
@ -39,7 +40,10 @@ export default function SettingsLayout() {
|
||||||
</NavLink>
|
</NavLink>
|
||||||
))}
|
))}
|
||||||
</nav>
|
</nav>
|
||||||
<Outlet />
|
{/* Die Unterseiten werden einzeln nachgeladen (App.jsx) - Tabs bleiben dabei stehen. */}
|
||||||
|
<Suspense fallback={<p className="text-sm text-neutral-400">Lädt…</p>}>
|
||||||
|
<Outlet />
|
||||||
|
</Suspense>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -392,9 +392,10 @@ export default function WebsiteSettings() {
|
||||||
<section className="rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900">
|
<section className="rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900">
|
||||||
<h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Seiten-Ladeanzeige</h2>
|
<h2 className="mb-1 font-semibold text-neutral-900 dark:text-white">Seiten-Ladeanzeige</h2>
|
||||||
<p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400">
|
<p className="mb-4 text-sm text-neutral-500 dark:text-neutral-400">
|
||||||
Solange die Bilder einer Seite noch nicht fertig geladen sind, wird statt des Inhalts
|
Solange Daten und Bilder im sichtbaren Bereich einer Seite noch laden, bleibt der Inhalt
|
||||||
ein Lade-Symbol angezeigt – verhindert, dass Bilder nachträglich "einpoppen". Wirkt
|
ausgeblendet – verhindert, dass Bilder nachträglich "einpoppen". Das Lade-Symbol erscheint
|
||||||
sich nicht auf das Dashboard aus, nur auf die öffentliche Website.
|
nur, wenn das länger als einen Augenblick dauert. Wirkt sich nicht auf das Dashboard und
|
||||||
|
die Startseite aus, nur auf die übrigen Seiten der öffentlichen Website.
|
||||||
</p>
|
</p>
|
||||||
<label className="flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300">
|
<label className="flex items-center gap-2 text-sm text-neutral-700 dark:text-neutral-300">
|
||||||
<input
|
<input
|
||||||
|
|
|
||||||
177
hifi-src/src/pages/public/DownloadsPage.jsx
Normal file
177
hifi-src/src/pages/public/DownloadsPage.jsx
Normal file
|
|
@ -0,0 +1,177 @@
|
||||||
|
import { useEffect, useState } from 'react';
|
||||||
|
import { Download, FileArchive, FileImage, FileText, FileVideo, Lock, Music } from 'lucide-react';
|
||||||
|
import { api } from '../../api/client.js';
|
||||||
|
import usePageMeta from '../../hooks/usePageMeta.js';
|
||||||
|
import Reveal from '../../components/Reveal.jsx';
|
||||||
|
import { useLanguage } from '../../context/LanguageContext.jsx';
|
||||||
|
import { fileExtension, fileKind, formatFileSize, isPlayableAudio } from '../../utils/downloads.js';
|
||||||
|
|
||||||
|
const KIND_ICONS = {
|
||||||
|
audio: Music,
|
||||||
|
video: FileVideo,
|
||||||
|
pdf: FileText,
|
||||||
|
image: FileImage,
|
||||||
|
archive: FileArchive,
|
||||||
|
document: FileText,
|
||||||
|
};
|
||||||
|
|
||||||
|
// Das Zugangspasswort (falls der Bereich geschuetzt ist) merkt sich der Browser, damit
|
||||||
|
// wiederkehrende Kunden es nicht jedes Mal neu eingeben muessen - steht so auch in der
|
||||||
|
// Datenschutzerklaerung (Abschnitt "Cookies und lokale Speicherung").
|
||||||
|
const STORAGE_KEY = 'hifi-downloads-password';
|
||||||
|
const readStoredPassword = () => {
|
||||||
|
try {
|
||||||
|
return localStorage.getItem(STORAGE_KEY) || '';
|
||||||
|
} catch {
|
||||||
|
return '';
|
||||||
|
}
|
||||||
|
};
|
||||||
|
const storePassword = (value) => {
|
||||||
|
try {
|
||||||
|
if (value) localStorage.setItem(STORAGE_KEY, value);
|
||||||
|
else localStorage.removeItem(STORAGE_KEY);
|
||||||
|
} catch {
|
||||||
|
// Speichern nicht moeglich (z. B. gesperrte Website-Daten) - dann eben jedes Mal eingeben.
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
// URL-kodiert, weil HTTP-Header nur ISO-8859-1 transportieren (Umlaute/Emoji im Passwort).
|
||||||
|
const fetchDownloads = (password) =>
|
||||||
|
api.get('/downloads', password ? { headers: { 'X-Download-Password': encodeURIComponent(password) } } : undefined);
|
||||||
|
|
||||||
|
export default function DownloadsPage() {
|
||||||
|
const [items, setItems] = useState(null);
|
||||||
|
const [locked, setLocked] = useState(false);
|
||||||
|
const [password, setPassword] = useState('');
|
||||||
|
const [wrongPassword, setWrongPassword] = useState(false);
|
||||||
|
const [unlocking, setUnlocking] = useState(false);
|
||||||
|
const [error, setError] = useState('');
|
||||||
|
const { t, language } = useLanguage();
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
const stored = readStoredPassword();
|
||||||
|
fetchDownloads(stored)
|
||||||
|
.then((res) => {
|
||||||
|
if (res.locked) {
|
||||||
|
// Gespeichertes Passwort passt nicht mehr (vom Betrieb geaendert) - neu abfragen.
|
||||||
|
if (stored) storePassword('');
|
||||||
|
setLocked(true);
|
||||||
|
} else {
|
||||||
|
setItems(res.items);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((e) => setError(e.message));
|
||||||
|
}, []);
|
||||||
|
|
||||||
|
const handleUnlock = async (e) => {
|
||||||
|
e.preventDefault();
|
||||||
|
setUnlocking(true);
|
||||||
|
setWrongPassword(false);
|
||||||
|
try {
|
||||||
|
const res = await fetchDownloads(password);
|
||||||
|
if (res.locked) {
|
||||||
|
setWrongPassword(true);
|
||||||
|
} else {
|
||||||
|
storePassword(password);
|
||||||
|
setLocked(false);
|
||||||
|
setItems(res.items);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
setError(err.message);
|
||||||
|
} finally {
|
||||||
|
setUnlocking(false);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
usePageMeta({
|
||||||
|
title: t('downloadsPage.metaTitle'),
|
||||||
|
description: t('downloadsPage.metaDescription'),
|
||||||
|
path: '/downloads',
|
||||||
|
});
|
||||||
|
|
||||||
|
return (
|
||||||
|
<div className="mx-auto max-w-4xl 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('downloadsPage.title')}</h1>
|
||||||
|
<p className="mb-10 max-w-2xl text-neutral-600 dark:text-neutral-300">{t('downloadsPage.intro')}</p>
|
||||||
|
|
||||||
|
{error && <p className="text-red-600">{error}</p>}
|
||||||
|
{!error && !locked && items === null && <p className="text-neutral-500 dark:text-neutral-400">{t('downloadsPage.loading')}</p>}
|
||||||
|
{items?.length === 0 && <p className="text-neutral-500 dark:text-neutral-400">{t('downloadsPage.empty')}</p>}
|
||||||
|
|
||||||
|
{locked && (
|
||||||
|
<form
|
||||||
|
onSubmit={handleUnlock}
|
||||||
|
className="max-w-md rounded-xl border border-neutral-200 bg-white p-6 dark:border-neutral-800 dark:bg-neutral-900"
|
||||||
|
>
|
||||||
|
<div className="mb-2 flex items-center gap-2">
|
||||||
|
<Lock className="h-5 w-5 text-brand-500" aria-hidden="true" />
|
||||||
|
<h2 className="font-semibold text-neutral-900 dark:text-white">{t('downloadsPage.lockedTitle')}</h2>
|
||||||
|
</div>
|
||||||
|
<p className="mb-4 text-sm text-neutral-600 dark:text-neutral-300">{t('downloadsPage.lockedText')}</p>
|
||||||
|
<label htmlFor="downloads-password" className="sr-only">{t('downloadsPage.passwordLabel')}</label>
|
||||||
|
<div className="flex flex-col gap-2 sm:flex-row">
|
||||||
|
<input
|
||||||
|
id="downloads-password"
|
||||||
|
type="password"
|
||||||
|
required
|
||||||
|
autoComplete="off"
|
||||||
|
value={password}
|
||||||
|
onChange={(e) => setPassword(e.target.value)}
|
||||||
|
placeholder={t('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"
|
||||||
|
/>
|
||||||
|
<button
|
||||||
|
type="submit"
|
||||||
|
disabled={unlocking}
|
||||||
|
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"
|
||||||
|
>
|
||||||
|
{unlocking ? t('downloadsPage.unlocking') : t('downloadsPage.unlock')}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{wrongPassword && <p className="mt-2 text-sm text-red-600" role="alert">{t('downloadsPage.wrongPassword')}</p>}
|
||||||
|
</form>
|
||||||
|
)}
|
||||||
|
|
||||||
|
<div className="space-y-4">
|
||||||
|
{items?.map((item, i) => {
|
||||||
|
const Icon = KIND_ICONS[fileKind(item.file_name)];
|
||||||
|
return (
|
||||||
|
<Reveal
|
||||||
|
key={item.id}
|
||||||
|
index={i % 4}
|
||||||
|
className="rounded-xl border border-neutral-200 bg-white p-5 dark:border-neutral-800 dark:bg-neutral-900"
|
||||||
|
>
|
||||||
|
<div className="flex flex-col gap-4 sm:flex-row sm:items-start">
|
||||||
|
<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">
|
||||||
|
<Icon className="h-6 w-6" aria-hidden="true" />
|
||||||
|
</div>
|
||||||
|
<div className="min-w-0 flex-1">
|
||||||
|
<h2 className="font-semibold text-neutral-900 dark:text-white">{item.title}</h2>
|
||||||
|
{item.description && (
|
||||||
|
<p className="mt-1 whitespace-pre-line text-sm text-neutral-600 dark:text-neutral-300">{item.description}</p>
|
||||||
|
)}
|
||||||
|
<p className="mt-1 text-xs text-neutral-400">
|
||||||
|
{fileExtension(item.file_name).toUpperCase()} · {formatFileSize(item.file_size, language === 'de' ? 'de-DE' : 'en-US')}
|
||||||
|
</p>
|
||||||
|
{/* preload="none": die Songs werden erst beim Abspielen geladen, nicht alle
|
||||||
|
gleichzeitig beim Seitenaufruf. */}
|
||||||
|
{isPlayableAudio(item.file_name) && (
|
||||||
|
<audio controls preload="none" src={item.file_path} className="mt-3 w-full" />
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
<a
|
||||||
|
href={item.file_path}
|
||||||
|
download={item.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"
|
||||||
|
>
|
||||||
|
<Download className="h-4 w-4" aria-hidden="true" />
|
||||||
|
{t('downloadsPage.download')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</Reveal>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
@ -64,6 +64,8 @@ export default function GalleryProjectPage() {
|
||||||
<img
|
<img
|
||||||
src={photo.image_path}
|
src={photo.image_path}
|
||||||
alt={photo.caption || ''}
|
alt={photo.caption || ''}
|
||||||
|
loading="lazy"
|
||||||
|
decoding="async"
|
||||||
className="h-full w-full object-cover transition duration-300 hover:scale-105"
|
className="h-full w-full object-cover transition duration-300 hover:scale-105"
|
||||||
/>
|
/>
|
||||||
</button>
|
</button>
|
||||||
|
|
|
||||||
|
|
@ -179,6 +179,29 @@ export default function Home() {
|
||||||
return () => document.head.removeChild(script);
|
return () => document.head.removeChild(script);
|
||||||
}, [faqs]);
|
}, [faqs]);
|
||||||
|
|
||||||
|
// Das Hintergrundvideo (~30 MB) erst laden, wenn sein Abschnitt in die Naehe des Bildschirms
|
||||||
|
// kommt, und ausserhalb pausieren - vorher startete der Download (autoPlay) sofort beim
|
||||||
|
// Seitenaufruf und konkurrierte mit Hero-Bild, Schriften und Skripten um die Bandbreite.
|
||||||
|
const videoRef = useRef(null);
|
||||||
|
useEffect(() => {
|
||||||
|
const video = videoRef.current;
|
||||||
|
if (!video) return undefined;
|
||||||
|
const observer = new IntersectionObserver(
|
||||||
|
([entry]) => {
|
||||||
|
if (entry.isIntersecting) {
|
||||||
|
if (!video.getAttribute('src')) video.src = youtubeVideo;
|
||||||
|
// Kann an Energiespar-/Autoplay-Regeln scheitern - dann bleibt das Poster stehen.
|
||||||
|
video.play().catch(() => {});
|
||||||
|
} else if (!video.paused) {
|
||||||
|
video.pause();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{ rootMargin: '300px 0px' }
|
||||||
|
);
|
||||||
|
observer.observe(video);
|
||||||
|
return () => observer.disconnect();
|
||||||
|
}, []);
|
||||||
|
|
||||||
const heroRef = useRef(null);
|
const heroRef = useRef(null);
|
||||||
const { scrollYProgress: heroProgress } = useScroll({ target: heroRef, offset: ['start start', 'end start'] });
|
const { scrollYProgress: heroProgress } = useScroll({ target: heroRef, offset: ['start start', 'end start'] });
|
||||||
const heroImageY = useTransform(heroProgress, [0, 1], ['-6%', '6%']);
|
const heroImageY = useTransform(heroProgress, [0, 1], ['-6%', '6%']);
|
||||||
|
|
@ -303,15 +326,14 @@ export default function Home() {
|
||||||
|
|
||||||
<section className="relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]">
|
<section className="relative min-h-[70vh] overflow-hidden sm:min-h-[85vh]">
|
||||||
<video
|
<video
|
||||||
autoPlay
|
ref={videoRef}
|
||||||
loop
|
loop
|
||||||
muted
|
muted
|
||||||
playsInline
|
playsInline
|
||||||
|
preload="none"
|
||||||
poster={galleryDash}
|
poster={galleryDash}
|
||||||
className="absolute inset-0 h-full w-full object-cover"
|
className="absolute inset-0 h-full w-full object-cover"
|
||||||
>
|
/>
|
||||||
<source src={youtubeVideo} type="video/mp4" />
|
|
||||||
</video>
|
|
||||||
<div className="absolute inset-0 bg-black/55" />
|
<div className="absolute inset-0 bg-black/55" />
|
||||||
|
|
||||||
<div
|
<div
|
||||||
|
|
|
||||||
|
|
@ -4,8 +4,19 @@ import { api } from '../../api/client.js';
|
||||||
import usePageMeta from '../../hooks/usePageMeta.js';
|
import usePageMeta from '../../hooks/usePageMeta.js';
|
||||||
import MaintenanceNotice from '../../components/MaintenanceNotice.jsx';
|
import MaintenanceNotice from '../../components/MaintenanceNotice.jsx';
|
||||||
import MaintenanceBypassBanner from '../../components/MaintenanceBypassBanner.jsx';
|
import MaintenanceBypassBanner from '../../components/MaintenanceBypassBanner.jsx';
|
||||||
import DynamicIcon from '../../components/DynamicIcon.jsx';
|
import {
|
||||||
import { ChevronLeft, ChevronRight, Mouse } from 'lucide-react';
|
Check,
|
||||||
|
ChevronDown,
|
||||||
|
ChevronLeft,
|
||||||
|
ChevronRight,
|
||||||
|
ChevronUp,
|
||||||
|
CirclePlay,
|
||||||
|
Clock,
|
||||||
|
Flame,
|
||||||
|
Lightbulb,
|
||||||
|
Mouse,
|
||||||
|
ThumbsUp,
|
||||||
|
} from 'lucide-react';
|
||||||
import { useMaintenance } from '../../context/MaintenanceContext.jsx';
|
import { useMaintenance } from '../../context/MaintenanceContext.jsx';
|
||||||
import { useLanguage } from '../../context/LanguageContext.jsx';
|
import { useLanguage } from '../../context/LanguageContext.jsx';
|
||||||
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
|
import { useSiteSettings } from '../../context/SiteSettingsContext.jsx';
|
||||||
|
|
@ -94,6 +105,16 @@ const BULLET_COLOR = '#c4c4c4';
|
||||||
// Wertigkeitssignal wirkt.
|
// Wertigkeitssignal wirkt.
|
||||||
const VISIBLE_BULLETS = 5;
|
const VISIBLE_BULLETS = 5;
|
||||||
|
|
||||||
|
// Markierung oben auf der Kachel (Admin: Pakete -> Markierung). Farben bewusst unabhaengig
|
||||||
|
// von der Preisstufe, damit z. B. "Am beliebtesten" auf jeder Kachel gleich aussieht.
|
||||||
|
const BADGE_STYLES = {
|
||||||
|
recommended: { Icon: ThumbsUp, className: 'bg-brand-500 text-white' },
|
||||||
|
popular: { Icon: Flame, className: 'bg-amber-400 text-neutral-950' },
|
||||||
|
tip: { Icon: Lightbulb, className: 'bg-sky-500 text-white' },
|
||||||
|
coming_soon: { Icon: Clock, className: 'bg-white text-neutral-900' },
|
||||||
|
custom: { Icon: null, className: 'bg-brand-500 text-white' },
|
||||||
|
};
|
||||||
|
|
||||||
function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUrl, t }) {
|
function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUrl, t }) {
|
||||||
const [expanded, setExpanded] = useState(false);
|
const [expanded, setExpanded] = useState(false);
|
||||||
const hiddenCount = bullets.length - VISIBLE_BULLETS;
|
const hiddenCount = bullets.length - VISIBLE_BULLETS;
|
||||||
|
|
@ -102,6 +123,8 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
|
||||||
const descriptionStyle = fieldStyle(textStyles, `packages.${pkg.id}.description`);
|
const descriptionStyle = fieldStyle(textStyles, `packages.${pkg.id}.description`);
|
||||||
const priceTextStyle = fieldStyle(textStyles, `packages.${pkg.id}.price_text`);
|
const priceTextStyle = fieldStyle(textStyles, `packages.${pkg.id}.price_text`);
|
||||||
const { package_card_width: cardWidth, package_card_height: cardHeight } = useSiteSettings();
|
const { package_card_width: cardWidth, package_card_height: cardHeight } = useSiteSettings();
|
||||||
|
const badgeStyle = BADGE_STYLES[pkg.badge];
|
||||||
|
const badgeLabel = pkg.badge === 'custom' ? pkg.badge_text : pkg.badge && t(`modelPage.badges.${pkg.badge}`);
|
||||||
|
|
||||||
// Fuer die Themes ohne eigenes Straßenbild: neutrales Glow-Motiv, per Maske
|
// Fuer die Themes ohne eigenes Straßenbild: neutrales Glow-Motiv, per Maske
|
||||||
// in die Akzentfarbe eingefaerbt (zwei Ebenen: weicher Halo + scharfe Kontur).
|
// in die Akzentfarbe eingefaerbt (zwei Ebenen: weicher Halo + scharfe Kontur).
|
||||||
|
|
@ -163,9 +186,12 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
|
||||||
|
|
||||||
{/* top-2 statt -top-3: die Karte hat overflow-hidden (runde Ecken + Straßenbild),
|
{/* top-2 statt -top-3: die Karte hat overflow-hidden (runde Ecken + Straßenbild),
|
||||||
ein halb herausragender Badge wuerde oben abgeschnitten. */}
|
ein halb herausragender Badge wuerde oben abgeschnitten. */}
|
||||||
{pkg.is_featured && (
|
{badgeStyle && badgeLabel && (
|
||||||
<span className="absolute top-2 left-1/2 z-10 -translate-x-1/2 rounded-full bg-brand-500 px-3 py-1 text-xs font-bold text-white shadow">
|
<span
|
||||||
{t('modelPage.featuredBadge')}
|
className={`absolute top-2 left-1/2 z-10 flex max-w-[calc(100%-16px)] -translate-x-1/2 items-center gap-1 whitespace-nowrap rounded-full px-3 py-1 text-xs font-bold shadow ${badgeStyle.className}`}
|
||||||
|
>
|
||||||
|
{badgeStyle.Icon && <badgeStyle.Icon className="h-3.5 w-3.5 shrink-0" aria-hidden="true" />}
|
||||||
|
<span className="truncate">{badgeLabel}</span>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
|
|
@ -214,7 +240,7 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
|
||||||
className="flex items-start gap-2"
|
className="flex items-start gap-2"
|
||||||
style={{ fontSize: '13px', color: BULLET_COLOR, ...(line.fromDescription ? descriptionStyle : null) }}
|
style={{ fontSize: '13px', color: BULLET_COLOR, ...(line.fromDescription ? descriptionStyle : null) }}
|
||||||
>
|
>
|
||||||
<DynamicIcon name="check" className="mt-0.5 h-3.5 w-3.5 shrink-0" style={{ color: tier.accent }} />
|
<Check className="mt-0.5 h-3.5 w-3.5 shrink-0" style={{ color: tier.accent }} />
|
||||||
<span className="leading-snug">
|
<span className="leading-snug">
|
||||||
{line.fromDescription ? <BoldText text={line.text} /> : line.text}
|
{line.fromDescription ? <BoldText text={line.text} /> : line.text}
|
||||||
</span>
|
</span>
|
||||||
|
|
@ -229,7 +255,7 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
|
||||||
style={{ fontSize: '13px', color: tier.accent }}
|
style={{ fontSize: '13px', color: tier.accent }}
|
||||||
>
|
>
|
||||||
{expanded ? t('modelPage.lessBullets') : t('modelPage.moreBullets')(hiddenCount)}
|
{expanded ? t('modelPage.lessBullets') : t('modelPage.moreBullets')(hiddenCount)}
|
||||||
<DynamicIcon name={expanded ? 'chevron-up' : 'chevron-down'} className="h-3.5 w-3.5" />
|
{expanded ? <ChevronUp className="h-3.5 w-3.5" /> : <ChevronDown className="h-3.5 w-3.5" />}
|
||||||
</button>
|
</button>
|
||||||
)}
|
)}
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -268,6 +294,21 @@ function PackageCard({ pkg, tier, tierT, layout, bullets, formatPrice, contactUr
|
||||||
>
|
>
|
||||||
{t('modelPage.requestContact')}
|
{t('modelPage.requestContact')}
|
||||||
</Link>
|
</Link>
|
||||||
|
{/* Video-Markierung (Admin: Pakete -> Video-Link) - oeffnet extern in einem neuen
|
||||||
|
Tab statt eingebettet, so braucht es keine YouTube-Cookie-Zustimmung. */}
|
||||||
|
{pkg.video_url && (
|
||||||
|
<div className="mt-3">
|
||||||
|
<a
|
||||||
|
href={pkg.video_url}
|
||||||
|
target="_blank"
|
||||||
|
rel="noopener noreferrer"
|
||||||
|
className="inline-flex items-center gap-1.5 rounded-full border border-white/15 bg-white/5 px-3 py-1 text-xs font-semibold text-white transition hover:bg-white/15"
|
||||||
|
>
|
||||||
|
<CirclePlay className="h-4 w-4 text-red-500" aria-hidden="true" />
|
||||||
|
{t('modelPage.videoLink')}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
)}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
@ -592,9 +633,11 @@ export default function ModelPage() {
|
||||||
const rankById = new Map(
|
const rankById = new Map(
|
||||||
[...packages].sort((a, b) => a.total_price - b.total_price).map((p, i) => [p.id, i])
|
[...packages].sort((a, b) => a.total_price - b.total_price).map((p, i) => [p.id, i])
|
||||||
);
|
);
|
||||||
|
// tier_rank/tier_count liefert der Server ueber ALLE Pakete des Modells, auch ausgeblendete -
|
||||||
|
// so behalten die sichtbaren Kacheln ihr Aussehen, wenn eines dazwischen ausgeblendet wird.
|
||||||
const tierOf = (pkg) => {
|
const tierOf = (pkg) => {
|
||||||
const n = packages.length;
|
const n = pkg.tier_count ?? packages.length;
|
||||||
const rank = rankById.get(pkg.id) ?? 0;
|
const rank = pkg.tier_rank ?? rankById.get(pkg.id) ?? 0;
|
||||||
const tierT = n <= 1 ? 0 : rank / (n - 1);
|
const tierT = n <= 1 ? 0 : rank / (n - 1);
|
||||||
const idx = Math.round(tierT * (TIERS.length - 1));
|
const idx = Math.round(tierT * (TIERS.length - 1));
|
||||||
return { tier: TIERS[idx], tierT };
|
return { tier: TIERS[idx], tierT };
|
||||||
|
|
|
||||||
38
hifi-src/src/utils/downloads.js
Normal file
38
hifi-src/src/utils/downloads.js
Normal file
|
|
@ -0,0 +1,38 @@
|
||||||
|
// Muss zu DownloadController::ALLOWED_EXTENSIONS passen (Server prueft ohnehin selbst -
|
||||||
|
// hier nur, damit der Datei-Dialog im Admin gleich passend filtert).
|
||||||
|
const KINDS = {
|
||||||
|
audio: ['mp3', 'wav', 'flac', 'm4a', 'aac', 'ogg', 'opus', 'aif', 'aiff', 'wma'],
|
||||||
|
video: ['mp4', 'mov', 'webm'],
|
||||||
|
pdf: ['pdf'],
|
||||||
|
image: ['jpg', 'jpeg', 'png', 'webp', 'gif'],
|
||||||
|
archive: ['zip', 'rar', '7z'],
|
||||||
|
document: ['txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'odt', 'ods'],
|
||||||
|
};
|
||||||
|
|
||||||
|
export const ALLOWED_DOWNLOAD_EXTENSIONS = Object.values(KINDS).flat();
|
||||||
|
|
||||||
|
// Formate, die alle aktuellen Browser direkt im <audio>-Element abspielen (AIFF/WMA nicht).
|
||||||
|
const PLAYABLE_AUDIO = ['mp3', 'wav', 'flac', 'm4a', 'aac', 'ogg', 'opus'];
|
||||||
|
|
||||||
|
export const fileExtension = (fileName) => {
|
||||||
|
const dot = (fileName || '').lastIndexOf('.');
|
||||||
|
return dot === -1 ? '' : fileName.slice(dot + 1).toLowerCase();
|
||||||
|
};
|
||||||
|
|
||||||
|
export const fileKind = (fileName) => {
|
||||||
|
const ext = fileExtension(fileName);
|
||||||
|
return Object.keys(KINDS).find((kind) => KINDS[kind].includes(ext)) || 'document';
|
||||||
|
};
|
||||||
|
|
||||||
|
export const isPlayableAudio = (fileName) => PLAYABLE_AUDIO.includes(fileExtension(fileName));
|
||||||
|
|
||||||
|
export const formatFileSize = (bytes, locale = 'de-DE') => {
|
||||||
|
const units = ['B', 'KB', 'MB', 'GB'];
|
||||||
|
let value = Number(bytes) || 0;
|
||||||
|
let unit = 0;
|
||||||
|
while (value >= 1024 && unit < units.length - 1) {
|
||||||
|
value /= 1024;
|
||||||
|
unit += 1;
|
||||||
|
}
|
||||||
|
return `${new Intl.NumberFormat(locale, { maximumFractionDigits: unit >= 2 ? 1 : 0 }).format(value)} ${units[unit]}`;
|
||||||
|
};
|
||||||
|
|
@ -7,18 +7,13 @@ export default defineConfig({
|
||||||
build: {
|
build: {
|
||||||
outDir: '../hifi',
|
outDir: '../hifi',
|
||||||
emptyOutDir: false,
|
emptyOutDir: false,
|
||||||
rollupOptions: {
|
// Kein lucide-react/dynamic mehr - das erzeugte pro Icon eine eigene Chunk-Datei (~1600
|
||||||
output: {
|
// Stück, auf Shared-Hosting scheiterte das Hochladen/Entpacken), und die frühere
|
||||||
// Ohne das erzeugt lucide-react/dynamic pro Icon eine eigene Chunk-Datei
|
// manualChunks-Bündelung hing dafür die komplette Bibliothek an jeden Seitenaufruf.
|
||||||
// (~1600 Stück) - auf Shared-Hosting scheitert das Hochladen/Entpacken
|
// Jetzt: fest verwendete Icons einzeln importiert, frei wählbare aus EINEM nachgeladenen
|
||||||
// so vieler winziger Dateien. Hier alle Icons in eine Datei bündeln.
|
// Chunk (src/components/iconRegistry.jsx). Der liegt über der Standard-Warngrenze von
|
||||||
manualChunks(id) {
|
// 500 kB, wird aber nur bei Bedarf geladen.
|
||||||
if (id.includes('lucide-react')) {
|
chunkSizeWarningLimit: 1200,
|
||||||
return 'lucide-icons';
|
|
||||||
}
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
server: {
|
server: {
|
||||||
proxy: {
|
proxy: {
|
||||||
|
|
|
||||||
|
|
@ -13,6 +13,13 @@ RewriteBase /
|
||||||
<FilesMatch "\.(jpg|jpeg|png|webp|avif|gif|svg|ico|mp4|webm)$">
|
<FilesMatch "\.(jpg|jpeg|png|webp|avif|gif|svg|ico|mp4|webm)$">
|
||||||
Header set Cache-Control "public, max-age=31536000, immutable"
|
Header set Cache-Control "public, max-age=31536000, immutable"
|
||||||
</FilesMatch>
|
</FilesMatch>
|
||||||
|
# Gegenstueck: index.html (verweist auf die gehashten Dateien oben) muss der Browser bei
|
||||||
|
# jedem Aufruf kurz beim Server nachfragen (meist nur ein 304 ohne Inhalt). Ohne Angabe
|
||||||
|
# behalten Browser sie per Heuristik tagelang - nach einem Deploy laedt ein wiederkehrender
|
||||||
|
# Besucher dann noch die alte Seite samt inzwischen geloeschter Skripte (weisse Seite).
|
||||||
|
<FilesMatch "\.html$">
|
||||||
|
Header set Cache-Control "no-cache"
|
||||||
|
</FilesMatch>
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
||||||
# Ohne dies leitet Apache (mod_dir) Anfragen an /api/uploads mit einem 301 auf
|
# Ohne dies leitet Apache (mod_dir) Anfragen an /api/uploads mit einem 301 auf
|
||||||
|
|
|
||||||
30
hifi/api/database/migration_package_badges_downloads.sql
Normal file
30
hifi/api/database/migration_package_badges_downloads.sql
Normal file
|
|
@ -0,0 +1,30 @@
|
||||||
|
USE hifi_shop;
|
||||||
|
|
||||||
|
-- Pakete: per Klick ausblendbar (is_hidden), Markierung auf der Kachel (badge: recommended,
|
||||||
|
-- popular, tip, coming_soon oder custom mit eigenem badge_text) und optionaler Video-Link.
|
||||||
|
-- Dazu die neue Tabelle fuer den Download-Bereich samt optionalem Zugangspasswort
|
||||||
|
-- (app_settings.downloads_password, leer = oeffentlich). Additiv, nichts wird geloescht.
|
||||||
|
-- Hinweis: Auf der Live-Seite reicht stattdessen ein Klick auf "Datenbankstruktur aktualisieren"
|
||||||
|
-- unter Admin-Panel -> Einstellungen -> Datenbank.
|
||||||
|
|
||||||
|
ALTER TABLE packages
|
||||||
|
ADD COLUMN IF NOT EXISTS is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
ADD COLUMN IF NOT EXISTS badge VARCHAR(20) NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS badge_text VARCHAR(40) NULL,
|
||||||
|
ADD COLUMN IF NOT EXISTS video_url VARCHAR(500) NULL;
|
||||||
|
|
||||||
|
ALTER TABLE app_settings
|
||||||
|
ADD COLUMN IF NOT EXISTS downloads_password VARCHAR(100) NULL;
|
||||||
|
|
||||||
|
CREATE TABLE IF NOT EXISTS downloads (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title VARCHAR(150) NOT NULL,
|
||||||
|
description TEXT NULL,
|
||||||
|
file_path VARCHAR(255) NOT NULL,
|
||||||
|
file_name VARCHAR(255) NOT NULL,
|
||||||
|
file_size BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
@ -44,6 +44,7 @@ CREATE TABLE app_settings (
|
||||||
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
|
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
|
||||||
site_font VARCHAR(255) NULL,
|
site_font VARCHAR(255) NULL,
|
||||||
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
|
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
|
||||||
|
downloads_password VARCHAR(100) NULL,
|
||||||
mail_host VARCHAR(255) NULL,
|
mail_host VARCHAR(255) NULL,
|
||||||
mail_port INT NULL,
|
mail_port INT NULL,
|
||||||
mail_username VARCHAR(255) NULL,
|
mail_username VARCHAR(255) NULL,
|
||||||
|
|
@ -224,6 +225,10 @@ CREATE TABLE packages (
|
||||||
tagline VARCHAR(150) NULL,
|
tagline VARCHAR(150) NULL,
|
||||||
price_text VARCHAR(100) NULL,
|
price_text VARCHAR(100) NULL,
|
||||||
is_featured TINYINT(1) NOT NULL DEFAULT 0,
|
is_featured TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
badge VARCHAR(20) NULL,
|
||||||
|
badge_text VARCHAR(40) NULL,
|
||||||
|
video_url VARCHAR(500) NULL,
|
||||||
sort_order INT NOT NULL DEFAULT 0,
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
|
@ -292,4 +297,17 @@ CREATE TABLE contact_requests (
|
||||||
CONSTRAINT fk_contact_product FOREIGN KEY (package_product_id) REFERENCES package_products(id) ON DELETE SET NULL
|
CONSTRAINT fk_contact_product FOREIGN KEY (package_product_id) REFERENCES package_products(id) ON DELETE SET NULL
|
||||||
) ENGINE=InnoDB;
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
|
CREATE TABLE downloads (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title VARCHAR(150) NOT NULL,
|
||||||
|
description TEXT NULL,
|
||||||
|
file_path VARCHAR(255) NOT NULL,
|
||||||
|
file_name VARCHAR(255) NOT NULL,
|
||||||
|
file_size BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) ENGINE=InnoDB;
|
||||||
|
|
||||||
INSERT IGNORE INTO app_settings (id) VALUES (1);
|
INSERT IGNORE INTO app_settings (id) VALUES (1);
|
||||||
|
|
|
||||||
|
|
@ -15,6 +15,7 @@ use App\Controllers\BrandController;
|
||||||
use App\Controllers\ContactController;
|
use App\Controllers\ContactController;
|
||||||
use App\Controllers\CustomFontController;
|
use App\Controllers\CustomFontController;
|
||||||
use App\Controllers\DatabaseConfigController;
|
use App\Controllers\DatabaseConfigController;
|
||||||
|
use App\Controllers\DownloadController;
|
||||||
use App\Controllers\FaqController;
|
use App\Controllers\FaqController;
|
||||||
use App\Controllers\GalleryBrandController;
|
use App\Controllers\GalleryBrandController;
|
||||||
use App\Controllers\GalleryPhotoController;
|
use App\Controllers\GalleryPhotoController;
|
||||||
|
|
@ -59,13 +60,33 @@ if (($_SERVER['REQUEST_METHOD'] ?? '') === 'OPTIONS') {
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
||||||
|
$apiBase = rtrim($config['app']['base_path'], '/') . '/api';
|
||||||
|
$route = '/' . ltrim(substr($path, strlen($apiBase)), '/');
|
||||||
|
$route = rtrim($route, '/') ?: '/';
|
||||||
|
|
||||||
session_name($config['app']['session_name']);
|
session_name($config['app']['session_name']);
|
||||||
session_set_cookie_params([
|
session_set_cookie_params([
|
||||||
'path' => rtrim($config['app']['base_path'], '/') . '/',
|
'path' => rtrim($config['app']['base_path'], '/') . '/',
|
||||||
'httponly' => true,
|
'httponly' => true,
|
||||||
'samesite' => 'Lax',
|
'samesite' => 'Lax',
|
||||||
]);
|
]);
|
||||||
session_start();
|
|
||||||
|
// PHP sperrt die Session-Datei fuer die gesamte Laufzeit eines Requests - die parallelen
|
||||||
|
// API-Aufrufe, die jede Seite beim Laden abfeuert, liefen dadurch fuer jeden Besucher mit
|
||||||
|
// Session-Cookie strikt nacheinander ab. Deshalb: Besucher ohne Cookie bekommen gar keine
|
||||||
|
// Session (nur Login/Einrichtung legen eine an), und Sessions ohne Login-Zustand (z. B.
|
||||||
|
// nach einem Logout) geben die Sperre sofort wieder frei. Fuer eingeloggte Admins bleibt
|
||||||
|
// alles wie bisher.
|
||||||
|
$startsSession = in_array($route, ['/auth/login', '/setup/verify-password'], true);
|
||||||
|
if ($startsSession || isset($_COOKIE[session_name()])) {
|
||||||
|
session_start();
|
||||||
|
if (!$startsSession && empty($_SESSION['admin_id']) && empty($_SESSION['pending_2fa_user_id']) && empty($_SESSION['setup_verified'])) {
|
||||||
|
session_write_close();
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
$_SESSION = [];
|
||||||
|
}
|
||||||
|
|
||||||
$router = new Router();
|
$router = new Router();
|
||||||
|
|
||||||
|
|
@ -120,6 +141,7 @@ $router->get('/models/{brand_slug}/{model_slug}/packages', $maint('vehicles', fn
|
||||||
$router->get('/packages', $perm('packages.manage', fn($p) => PackageController::index()));
|
$router->get('/packages', $perm('packages.manage', fn($p) => PackageController::index()));
|
||||||
$router->post('/packages', $perm('packages.manage', fn($p) => PackageController::store()));
|
$router->post('/packages', $perm('packages.manage', fn($p) => PackageController::store()));
|
||||||
$router->put('/packages/{id}', $perm('packages.manage', fn($p) => PackageController::update($p)));
|
$router->put('/packages/{id}', $perm('packages.manage', fn($p) => PackageController::update($p)));
|
||||||
|
$router->patch('/packages/{id}/visibility', $perm('packages.manage', fn($p) => PackageController::setVisibility($p)));
|
||||||
$router->delete('/packages/{id}', $perm('packages.manage', fn($p) => PackageController::destroy($p)));
|
$router->delete('/packages/{id}', $perm('packages.manage', fn($p) => PackageController::destroy($p)));
|
||||||
$router->get('/packages/{id}/products', $perm('packages.manage', fn($p) => PackageController::products($p)));
|
$router->get('/packages/{id}/products', $perm('packages.manage', fn($p) => PackageController::products($p)));
|
||||||
$router->post('/models/{id}/copy-packages', $perm('packages.manage', fn($p) => PackageController::copyFromModel($p)));
|
$router->post('/models/{id}/copy-packages', $perm('packages.manage', fn($p) => PackageController::copyFromModel($p)));
|
||||||
|
|
@ -156,6 +178,16 @@ $router->get('/contact', $perm('contact.manage', fn($p) => ContactController::in
|
||||||
$router->patch('/contact/{id}', $perm('contact.manage', fn($p) => ContactController::updateStatus($p)));
|
$router->patch('/contact/{id}', $perm('contact.manage', fn($p) => ContactController::updateStatus($p)));
|
||||||
$router->delete('/contact/{id}', $perm('contact.delete', fn($p) => ContactController::destroy($p)));
|
$router->delete('/contact/{id}', $perm('contact.delete', fn($p) => ContactController::destroy($p)));
|
||||||
|
|
||||||
|
$router->get('/downloads', $maint(null, fn($p) => DownloadController::publicIndex()));
|
||||||
|
$router->get('/settings/downloads', $perm('downloads.manage', fn($p) => DownloadController::settings()));
|
||||||
|
$router->put('/settings/downloads', $perm('downloads.manage', fn($p) => DownloadController::updateSettings()));
|
||||||
|
$router->get('/downloads/manage', $perm('downloads.manage', fn($p) => DownloadController::adminIndex()));
|
||||||
|
$router->post('/downloads', $perm('downloads.manage', fn($p) => DownloadController::store()));
|
||||||
|
$router->put('/downloads/{id}', $perm('downloads.manage', fn($p) => DownloadController::update($p)));
|
||||||
|
$router->post('/downloads/{id}/file', $perm('downloads.manage', fn($p) => DownloadController::replaceFile($p)));
|
||||||
|
$router->patch('/downloads/{id}/visibility', $perm('downloads.manage', fn($p) => DownloadController::setVisibility($p)));
|
||||||
|
$router->delete('/downloads/{id}', $perm('downloads.manage', fn($p) => DownloadController::destroy($p)));
|
||||||
|
|
||||||
$router->post('/uploads', $anyPerm(['brands.manage', 'models.manage', 'services.manage', 'settings.manage', 'gallery.manage', 'content.manage'], fn($p) => UploadController::store()));
|
$router->post('/uploads', $anyPerm(['brands.manage', 'models.manage', 'services.manage', 'settings.manage', 'gallery.manage', 'content.manage'], fn($p) => UploadController::store()));
|
||||||
|
|
||||||
$router->get('/services', $maint('services', fn($p) => ServiceController::index()));
|
$router->get('/services', $maint('services', fn($p) => ServiceController::index()));
|
||||||
|
|
@ -257,17 +289,13 @@ $router->post('/setup/database', fn($p) => SetupController::saveDatabase());
|
||||||
$router->post('/setup/migrate', fn($p) => SetupController::migrateSchema());
|
$router->post('/setup/migrate', fn($p) => SetupController::migrateSchema());
|
||||||
$router->post('/setup/admin', fn($p) => SetupController::createAdmin());
|
$router->post('/setup/admin', fn($p) => SetupController::createAdmin());
|
||||||
|
|
||||||
$path = parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH);
|
|
||||||
$apiBase = rtrim($config['app']['base_path'], '/') . '/api';
|
|
||||||
$route = '/' . ltrim(substr($path, strlen($apiBase)), '/');
|
|
||||||
|
|
||||||
// Alles, was bis hierhin versehentlich ausgegeben wurde, verwerfen - danach
|
// Alles, was bis hierhin versehentlich ausgegeben wurde, verwerfen - danach
|
||||||
// kann der Content-Type-Header noch garantiert gesetzt werden.
|
// kann der Content-Type-Header noch garantiert gesetzt werden.
|
||||||
ob_clean();
|
ob_clean();
|
||||||
header('Content-Type: application/json; charset=utf-8');
|
header('Content-Type: application/json; charset=utf-8');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
$router->dispatch($_SERVER['REQUEST_METHOD'], rtrim($route, '/') ?: '/');
|
$router->dispatch($_SERVER['REQUEST_METHOD'], $route);
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
Http::error('Serverfehler: ' . $e->getMessage(), 500);
|
Http::error('Serverfehler: ' . $e->getMessage(), 500);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,6 +3,7 @@
|
||||||
require __DIR__ . '/../vendor/autoload.php';
|
require __DIR__ . '/../vendor/autoload.php';
|
||||||
|
|
||||||
use App\Config\Database;
|
use App\Config\Database;
|
||||||
|
use App\Controllers\DownloadController;
|
||||||
|
|
||||||
$config = require __DIR__ . '/../config/config.php';
|
$config = require __DIR__ . '/../config/config.php';
|
||||||
$siteUrl = rtrim($config['app']['site_url'], '/');
|
$siteUrl = rtrim($config['app']['site_url'], '/');
|
||||||
|
|
@ -19,6 +20,11 @@ $urls = [
|
||||||
['loc' => '/fahrzeuge', 'priority' => '0.9'],
|
['loc' => '/fahrzeuge', 'priority' => '0.9'],
|
||||||
['loc' => '/kontakt', 'priority' => '0.5'],
|
['loc' => '/kontakt', 'priority' => '0.5'],
|
||||||
];
|
];
|
||||||
|
// Passwortgeschuetzt zeigt die Seite nur ein Eingabefeld - nichts, was ein Suchmaschinen-
|
||||||
|
// Eintrag wert waere.
|
||||||
|
if (DownloadController::hasVisible() && !DownloadController::isProtected()) {
|
||||||
|
$urls[] = ['loc' => '/downloads', 'priority' => '0.4'];
|
||||||
|
}
|
||||||
|
|
||||||
foreach ($brands as $brand) {
|
foreach ($brands as $brand) {
|
||||||
$urls[] = ['loc' => "/fahrzeuge/{$brand['slug']}", 'priority' => '0.8', 'lastmod' => $brand['updated_at']];
|
$urls[] = ['loc' => "/fahrzeuge/{$brand['slug']}", 'priority' => '0.8', 'lastmod' => $brand['updated_at']];
|
||||||
|
|
|
||||||
|
|
@ -148,7 +148,10 @@ class AuthController
|
||||||
public static function logout(): void
|
public static function logout(): void
|
||||||
{
|
{
|
||||||
$_SESSION = [];
|
$_SESSION = [];
|
||||||
session_destroy();
|
// Ohne Login-Zustand startet index.php keine (bzw. keine offene) Session.
|
||||||
|
if (session_status() === PHP_SESSION_ACTIVE) {
|
||||||
|
session_destroy();
|
||||||
|
}
|
||||||
Http::send(['ok' => true]);
|
Http::send(['ok' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
345
hifi/api/src/Controllers/DownloadController.php
Normal file
345
hifi/api/src/Controllers/DownloadController.php
Normal file
|
|
@ -0,0 +1,345 @@
|
||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Controllers;
|
||||||
|
|
||||||
|
use App\Config\Database;
|
||||||
|
use App\Middleware\AuthMiddleware;
|
||||||
|
use App\Support\Http;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Download-Bereich (/downloads): Dateien wie Songs oder Anleitungen, die der Betrieb seinen
|
||||||
|
* Kunden bereitstellt. Die Dateien liegen unter einem zufaelligen Namen in
|
||||||
|
* api/uploads/downloads/ und werden direkt vom Webserver ausgeliefert (dadurch klappt auch
|
||||||
|
* Vorspulen im Audio-Player ohne PHP) - der Originalname steht in downloads.file_name.
|
||||||
|
*
|
||||||
|
* Optional per Zugangspasswort geschuetzt (app_settings.downloads_password, leer =
|
||||||
|
* oeffentlich): dann liefert publicIndex() die Liste nur gegen das Passwort. Die Dateien
|
||||||
|
* selbst bleiben direkt abrufbar, sind aber nur ueber diese Liste auffindbar (zufaellige
|
||||||
|
* 128-Bit-Namen, kein Verzeichnis-Listing - /api/* ohne echte Datei landet im Router).
|
||||||
|
* Wer freigeschaltet war, kann also einzelne Direktlinks weitergeben - fuer einen kleinen
|
||||||
|
* Kundenbereich bewusst so gewaehlt, statt jede Datei (inkl. Spulen im Player) durch PHP
|
||||||
|
* zu streamen.
|
||||||
|
*
|
||||||
|
* Bewusst NICHT Teil des Daten-Exports (SettingsController): Songs koennen schnell mehrere
|
||||||
|
* hundert MB gross sein, der Export bettet Dateien aber als Base64 in eine JSON-Datei ein.
|
||||||
|
*/
|
||||||
|
class DownloadController
|
||||||
|
{
|
||||||
|
private const DIR = __DIR__ . '/../../uploads/downloads/';
|
||||||
|
|
||||||
|
// Positivliste statt "alles ausser ...": die Dateien liegen auf derselben Domain wie die
|
||||||
|
// Seite, HTML/SVG/JS o. Ae. wuerden dort als Seite ausgefuehrt (Angriff auf eingeloggte
|
||||||
|
// Admins). Alles andere laesst sich als ZIP hochladen.
|
||||||
|
private const ALLOWED_EXTENSIONS = [
|
||||||
|
'mp3', 'wav', 'flac', 'm4a', 'aac', 'ogg', 'opus', 'aif', 'aiff', 'wma',
|
||||||
|
'mp4', 'mov', 'webm',
|
||||||
|
'pdf', 'txt', 'rtf', 'doc', 'docx', 'xls', 'xlsx', 'odt', 'ods',
|
||||||
|
'jpg', 'jpeg', 'png', 'webp', 'gif',
|
||||||
|
'zip', 'rar', '7z',
|
||||||
|
];
|
||||||
|
|
||||||
|
// Wird beim ersten Upload in api/uploads/downloads/ angelegt statt versioniert, weil das
|
||||||
|
// Auto-Update (GitUpdateService) api/uploads/ bewusst nie anfasst.
|
||||||
|
private const HTACCESS = <<<'HTACCESS'
|
||||||
|
# Automatisch angelegt von DownloadController.php - Dateien hier nie als Seite oder Skript
|
||||||
|
# interpretieren (die Ausfuehrung von PHP verbietet bereits ../.htaccess).
|
||||||
|
<IfModule mod_headers.c>
|
||||||
|
Header set X-Content-Type-Options "nosniff"
|
||||||
|
</IfModule>
|
||||||
|
|
||||||
|
HTACCESS;
|
||||||
|
|
||||||
|
private static function urlPrefix(): string
|
||||||
|
{
|
||||||
|
$config = require __DIR__ . '/../../config/config.php';
|
||||||
|
return rtrim($config['app']['base_path'], '/') . '/api/uploads/downloads/';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Zugangspasswort des Bereichs oder null, wenn er oeffentlich ist. Bewusst im Klartext
|
||||||
|
* gespeichert: ein gemeinsamer Zugangscode, den der Betrieb an seine Kunden weitergibt und
|
||||||
|
* im Admin nachschlagen koennen soll - kein Konto-Passwort.
|
||||||
|
*/
|
||||||
|
private static function accessPassword(): ?string
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
$password = Database::connection()
|
||||||
|
->query('SELECT downloads_password FROM app_settings WHERE id = 1')
|
||||||
|
->fetchColumn();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// Spalte existiert erst nach "Datenbankstruktur aktualisieren".
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
return is_string($password) && $password !== '' ? $password : null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function isProtected(): bool
|
||||||
|
{
|
||||||
|
return self::accessPassword() !== null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Antwortet immer mit 200 und { locked, items } statt 401 - "Passwort noetig" ist fuer
|
||||||
|
* diese Seite der Normalfall, kein Fehler (vgl. AuthController::me()).
|
||||||
|
*/
|
||||||
|
public static function publicIndex(): void
|
||||||
|
{
|
||||||
|
$password = self::accessPassword();
|
||||||
|
if ($password !== null && !self::isDownloadsAdmin()) {
|
||||||
|
// URL-kodiert, weil HTTP-Header nur ISO-8859-1 transportieren (Umlaute/Emoji).
|
||||||
|
$given = rawurldecode((string) ($_SERVER['HTTP_X_DOWNLOAD_PASSWORD'] ?? ''));
|
||||||
|
if ($given === '') {
|
||||||
|
Http::send(['locked' => true, 'wrong_password' => false, 'items' => []]);
|
||||||
|
}
|
||||||
|
if (!hash_equals($password, $given)) {
|
||||||
|
// Bremst simples Durchprobieren von Passwoertern aus.
|
||||||
|
sleep(1);
|
||||||
|
Http::send(['locked' => true, 'wrong_password' => true, 'items' => []]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
$rows = Database::connection()->query(
|
||||||
|
'SELECT id, title, description, file_path, file_name, file_size
|
||||||
|
FROM downloads WHERE is_hidden = 0 ORDER BY sort_order, id'
|
||||||
|
)->fetchAll();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
// Tabelle existiert erst nach "Datenbankstruktur aktualisieren".
|
||||||
|
$rows = [];
|
||||||
|
}
|
||||||
|
Http::send(['locked' => false, 'wrong_password' => false, 'items' => $rows]);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Eingeloggte Verwalter sehen die Liste auch ohne Passwort (Vorschau aus dem Admin heraus).
|
||||||
|
private static function isDownloadsAdmin(): bool
|
||||||
|
{
|
||||||
|
return !empty($_SESSION['admin_id'])
|
||||||
|
&& AuthMiddleware::userHasPermission((int) $_SESSION['admin_id'], 'downloads.manage');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function settings(): void
|
||||||
|
{
|
||||||
|
Http::send(['password' => self::accessPassword()]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function updateSettings(): void
|
||||||
|
{
|
||||||
|
$body = Http::jsonBody();
|
||||||
|
$password = trim((string) ($body['password'] ?? ''));
|
||||||
|
if (mb_strlen($password) > 100) {
|
||||||
|
Http::error('Das Passwort darf höchstens 100 Zeichen lang sein', 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$db = Database::connection();
|
||||||
|
$db->exec('INSERT IGNORE INTO app_settings (id) VALUES (1)');
|
||||||
|
$stmt = $db->prepare('UPDATE app_settings SET downloads_password = ? WHERE id = 1');
|
||||||
|
$stmt->execute([$password !== '' ? $password : null]);
|
||||||
|
|
||||||
|
Http::send(['password' => $password !== '' ? $password : null]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Fuer Navbar/Footer (ueber SiteSettingsController): den Menuepunkt nur zeigen, wenn es etwas gibt. */
|
||||||
|
public static function hasVisible(): bool
|
||||||
|
{
|
||||||
|
try {
|
||||||
|
return (bool) Database::connection()
|
||||||
|
->query('SELECT 1 FROM downloads WHERE is_hidden = 0 LIMIT 1')
|
||||||
|
->fetchColumn();
|
||||||
|
} catch (\Throwable $e) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function adminIndex(): void
|
||||||
|
{
|
||||||
|
$rows = Database::connection()->query(
|
||||||
|
'SELECT id, title, description, file_path, file_name, file_size, is_hidden, sort_order, created_at
|
||||||
|
FROM downloads ORDER BY sort_order, id'
|
||||||
|
)->fetchAll();
|
||||||
|
foreach ($rows as &$row) {
|
||||||
|
$row['is_hidden'] = (bool) $row['is_hidden'];
|
||||||
|
}
|
||||||
|
unset($row);
|
||||||
|
Http::send($rows);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function store(): void
|
||||||
|
{
|
||||||
|
$file = self::acceptUpload();
|
||||||
|
|
||||||
|
$title = mb_substr(trim((string) ($_POST['title'] ?? '')), 0, 150);
|
||||||
|
if ($title === '') {
|
||||||
|
// Ohne eigenen Titel: Dateiname ohne Endung ("Bass Test.mp3" -> "Bass Test").
|
||||||
|
$title = mb_substr(pathinfo($file['file_name'], PATHINFO_FILENAME), 0, 150) ?: $file['file_name'];
|
||||||
|
}
|
||||||
|
$description = trim((string) ($_POST['description'] ?? '')) ?: null;
|
||||||
|
|
||||||
|
$db = Database::connection();
|
||||||
|
// Neue Dateien ans Ende der Liste.
|
||||||
|
$sortOrder = (int) $db->query('SELECT COALESCE(MAX(sort_order), 0) + 10 FROM downloads')->fetchColumn();
|
||||||
|
|
||||||
|
$stmt = $db->prepare(
|
||||||
|
'INSERT INTO downloads (title, description, file_path, file_name, file_size, sort_order) VALUES (?, ?, ?, ?, ?, ?)'
|
||||||
|
);
|
||||||
|
$stmt->execute([$title, $description, $file['file_path'], $file['file_name'], $file['file_size'], $sortOrder]);
|
||||||
|
|
||||||
|
Http::send(['id' => (int) $db->lastInsertId()], 201);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function update(array $params): void
|
||||||
|
{
|
||||||
|
$id = (int) $params['id'];
|
||||||
|
$body = Http::jsonBody();
|
||||||
|
$title = mb_substr(trim((string) ($body['title'] ?? '')), 0, 150);
|
||||||
|
if ($title === '') {
|
||||||
|
Http::error('Titel erforderlich', 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$stmt = Database::connection()->prepare(
|
||||||
|
'UPDATE downloads SET title = ?, description = ?, sort_order = ? WHERE id = ?'
|
||||||
|
);
|
||||||
|
$stmt->execute([
|
||||||
|
$title,
|
||||||
|
trim((string) ($body['description'] ?? '')) ?: null,
|
||||||
|
(int) ($body['sort_order'] ?? 0),
|
||||||
|
$id,
|
||||||
|
]);
|
||||||
|
|
||||||
|
Http::send(['ok' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Ersetzt nur die Datei eines Eintrags (Titel, Beschreibung und Position bleiben). */
|
||||||
|
public static function replaceFile(array $params): void
|
||||||
|
{
|
||||||
|
$id = (int) $params['id'];
|
||||||
|
$old = self::find($id);
|
||||||
|
$file = self::acceptUpload();
|
||||||
|
|
||||||
|
$stmt = Database::connection()->prepare(
|
||||||
|
'UPDATE downloads SET file_path = ?, file_name = ?, file_size = ? WHERE id = ?'
|
||||||
|
);
|
||||||
|
$stmt->execute([$file['file_path'], $file['file_name'], $file['file_size'], $id]);
|
||||||
|
self::deleteFile($old['file_path']);
|
||||||
|
|
||||||
|
Http::send(['ok' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function setVisibility(array $params): void
|
||||||
|
{
|
||||||
|
$id = (int) $params['id'];
|
||||||
|
self::find($id);
|
||||||
|
$body = Http::jsonBody();
|
||||||
|
$hidden = !empty($body['is_hidden']);
|
||||||
|
|
||||||
|
$stmt = Database::connection()->prepare('UPDATE downloads SET is_hidden = ? WHERE id = ?');
|
||||||
|
$stmt->execute([$hidden ? 1 : 0, $id]);
|
||||||
|
|
||||||
|
Http::send(['ok' => true, 'is_hidden' => $hidden]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function destroy(array $params): void
|
||||||
|
{
|
||||||
|
$id = (int) $params['id'];
|
||||||
|
$old = self::find($id);
|
||||||
|
|
||||||
|
$stmt = Database::connection()->prepare('DELETE FROM downloads WHERE id = ?');
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
self::deleteFile($old['file_path']);
|
||||||
|
|
||||||
|
Http::send(['ok' => true]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function find(int $id): array
|
||||||
|
{
|
||||||
|
$stmt = Database::connection()->prepare('SELECT id, file_path FROM downloads WHERE id = ?');
|
||||||
|
$stmt->execute([$id]);
|
||||||
|
$row = $stmt->fetch();
|
||||||
|
if (!$row) {
|
||||||
|
Http::error('Download nicht gefunden', 404);
|
||||||
|
}
|
||||||
|
return $row;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Prueft den Upload aus $_FILES['file'] und legt ihn unter zufaelligem Namen ab.
|
||||||
|
*
|
||||||
|
* @return array{file_path: string, file_name: string, file_size: int}
|
||||||
|
*/
|
||||||
|
private static function acceptUpload(): array
|
||||||
|
{
|
||||||
|
if (empty($_FILES['file'])) {
|
||||||
|
// Ueberschreitet der Request post_max_size, verwirft PHP $_FILES UND $_POST
|
||||||
|
// kommentarlos - dann lieber das echte Limit nennen als "keine Datei".
|
||||||
|
$contentLength = (int) ($_SERVER['CONTENT_LENGTH'] ?? 0);
|
||||||
|
if ($contentLength > 0) {
|
||||||
|
Http::error('Die Datei ist zu groß für diesen Server (Limit: ' . ini_get('post_max_size') . ').', 422);
|
||||||
|
}
|
||||||
|
Http::error('Keine Datei übermittelt', 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
$file = $_FILES['file'];
|
||||||
|
if ($file['error'] === UPLOAD_ERR_INI_SIZE || $file['error'] === UPLOAD_ERR_FORM_SIZE) {
|
||||||
|
Http::error('Die Datei ist zu groß für diesen Server (Limit: ' . ini_get('upload_max_filesize') . ').', 422);
|
||||||
|
}
|
||||||
|
if ($file['error'] !== UPLOAD_ERR_OK) {
|
||||||
|
Http::error('Upload fehlgeschlagen (Fehlercode ' . $file['error'] . ')', 422);
|
||||||
|
}
|
||||||
|
if ((int) $file['size'] <= 0) {
|
||||||
|
Http::error('Die Datei ist leer', 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Nur den reinen Dateinamen behalten (manche Browser schicken Pfade mit) und
|
||||||
|
// Steuerzeichen entfernen - er landet spaeter im download-Attribut des Links. Kein
|
||||||
|
// basename(): das ist locale-abhaengig und kann Umlaute am Namensanfang verschlucken.
|
||||||
|
$originalName = str_replace('\\', '/', (string) $file['name']);
|
||||||
|
$originalName = substr($originalName, strrpos($originalName, '/') === false ? 0 : strrpos($originalName, '/') + 1);
|
||||||
|
$originalName = preg_replace('/[\x00-\x1F\x7F]/', '', $originalName);
|
||||||
|
$originalName = mb_substr(trim((string) $originalName), 0, 255) ?: 'download';
|
||||||
|
|
||||||
|
$extension = strtolower(pathinfo($originalName, PATHINFO_EXTENSION));
|
||||||
|
if (!in_array($extension, self::ALLOWED_EXTENSIONS, true)) {
|
||||||
|
Http::error(
|
||||||
|
'Dieser Dateityp ist nicht erlaubt. Erlaubt sind: ' . implode(', ', self::ALLOWED_EXTENSIONS) .
|
||||||
|
' – andere Dateien bitte als ZIP hochladen.',
|
||||||
|
422
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
self::ensureDir();
|
||||||
|
$filename = bin2hex(random_bytes(16)) . '.' . $extension;
|
||||||
|
if (!move_uploaded_file($file['tmp_name'], self::DIR . $filename)) {
|
||||||
|
Http::error('Datei konnte nicht gespeichert werden', 500);
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
'file_path' => self::urlPrefix() . $filename,
|
||||||
|
'file_name' => $originalName,
|
||||||
|
'file_size' => (int) $file['size'],
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function ensureDir(): void
|
||||||
|
{
|
||||||
|
if (!is_dir(self::DIR) && !@mkdir(self::DIR, 0755, true) && !is_dir(self::DIR)) {
|
||||||
|
Http::error('Download-Ordner konnte nicht angelegt werden (Schreibrechte von api/uploads/ prüfen)', 500);
|
||||||
|
}
|
||||||
|
if (!is_file(self::DIR . '.htaccess')) {
|
||||||
|
@file_put_contents(self::DIR . '.htaccess', self::HTACCESS);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Loescht eine Download-Datei - nur innerhalb von api/uploads/downloads/ (kein Path-Traversal). */
|
||||||
|
private static function deleteFile(?string $path): void
|
||||||
|
{
|
||||||
|
$filename = basename((string) $path);
|
||||||
|
if ($filename === '' || $filename === '.' || $filename === '..' || $filename === '.htaccess') {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$resolved = realpath(self::DIR . $filename);
|
||||||
|
$dir = realpath(self::DIR);
|
||||||
|
if ($resolved !== false && $dir !== false && str_starts_with($resolved, $dir . DIRECTORY_SEPARATOR) && is_file($resolved)) {
|
||||||
|
@unlink($resolved);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -122,45 +122,81 @@ class ModelController
|
||||||
Http::error('Modell nicht gefunden', 404);
|
Http::error('Modell nicht gefunden', 404);
|
||||||
}
|
}
|
||||||
|
|
||||||
$pkgStmt = $db->prepare(
|
// SELECT * statt fester Spaltenliste: so bleibt die Seite auch auf einer Datenbank
|
||||||
'SELECT id, name, slug, description, markup_type, markup_value, icon_name, tagline, price_text, is_featured, sort_order
|
// erreichbar, auf der "Datenbankstruktur aktualisieren" nach einem Update noch nicht
|
||||||
FROM packages WHERE car_model_id = ? ORDER BY sort_order, name'
|
// gelaufen ist (dann fehlen z. B. is_hidden/badge - siehe die ?? unten).
|
||||||
);
|
$pkgStmt = $db->prepare('SELECT * FROM packages WHERE car_model_id = ? ORDER BY sort_order, name');
|
||||||
$pkgStmt->execute([$model['id']]);
|
$pkgStmt->execute([$model['id']]);
|
||||||
$packages = $pkgStmt->fetchAll();
|
$rows = $pkgStmt->fetchAll();
|
||||||
|
|
||||||
if ($packages) {
|
// Alle Produkte des Modells in einer Abfrage statt zwei Abfragen pro Paket.
|
||||||
|
$productsByPackage = [];
|
||||||
|
if ($rows) {
|
||||||
|
$ids = array_column($rows, 'id');
|
||||||
|
$placeholders = implode(',', array_fill(0, count($ids), '?'));
|
||||||
$productStmt = $db->prepare(
|
$productStmt = $db->prepare(
|
||||||
'SELECT id, package_id, name_override, scraped_name, scraped_image_url, scrape_status, sort_order
|
"SELECT id, package_id, name_override, scraped_name, scraped_image_url, scrape_status, scraped_price, sort_order
|
||||||
FROM package_products WHERE package_id = ? ORDER BY sort_order, id'
|
FROM package_products WHERE package_id IN ($placeholders) ORDER BY sort_order, id"
|
||||||
);
|
);
|
||||||
|
$productStmt->execute($ids);
|
||||||
foreach ($packages as &$package) {
|
foreach ($productStmt->fetchAll() as $product) {
|
||||||
$productStmt->execute([$package['id']]);
|
$productsByPackage[$product['package_id']][] = $product;
|
||||||
$products = $productStmt->fetchAll();
|
|
||||||
|
|
||||||
// Preise werden serverseitig aufsummiert und mit dem Aufschlag verrechnet,
|
|
||||||
// aber nie pro Bauteil an den Client zurückgegeben – der Kunde sieht nur den Gesamtpreis.
|
|
||||||
$subtotalStmt = $db->prepare(
|
|
||||||
'SELECT COALESCE(SUM(scraped_price), 0) AS subtotal FROM package_products WHERE package_id = ?'
|
|
||||||
);
|
|
||||||
$subtotalStmt->execute([$package['id']]);
|
|
||||||
$subtotal = (float) $subtotalStmt->fetch()['subtotal'];
|
|
||||||
|
|
||||||
if ($package['markup_type'] === 'fixed') {
|
|
||||||
$total = $subtotal + (float) $package['markup_value'];
|
|
||||||
} elseif ($package['markup_type'] === 'percent') {
|
|
||||||
$total = $subtotal * (1 + (float) $package['markup_value'] / 100);
|
|
||||||
} else {
|
|
||||||
$total = $subtotal;
|
|
||||||
}
|
|
||||||
|
|
||||||
unset($package['markup_type'], $package['markup_value']);
|
|
||||||
$package['products'] = $products;
|
|
||||||
$package['total_price'] = round($total, 2);
|
|
||||||
$package['is_featured'] = (bool) $package['is_featured'];
|
|
||||||
}
|
}
|
||||||
unset($package);
|
}
|
||||||
|
|
||||||
|
// Preise werden serverseitig aufsummiert und mit dem Aufschlag verrechnet,
|
||||||
|
// aber nie pro Bauteil an den Client zurückgegeben – der Kunde sieht nur den Gesamtpreis.
|
||||||
|
$totals = [];
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
$subtotal = 0.0;
|
||||||
|
foreach ($productsByPackage[$row['id']] ?? [] as $product) {
|
||||||
|
$subtotal += (float) ($product['scraped_price'] ?? 0);
|
||||||
|
}
|
||||||
|
if ($row['markup_type'] === 'fixed') {
|
||||||
|
$total = $subtotal + (float) $row['markup_value'];
|
||||||
|
} elseif ($row['markup_type'] === 'percent') {
|
||||||
|
$total = $subtotal * (1 + (float) $row['markup_value'] / 100);
|
||||||
|
} else {
|
||||||
|
$total = $subtotal;
|
||||||
|
}
|
||||||
|
$totals[$row['id']] = round($total, 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preis-Rang ueber ALLE Pakete des Modells, auch die ausgeblendeten: ModelPage waehlt
|
||||||
|
// daraus Farbe/Strassenbild der Kachel. So behalten die sichtbaren Pakete ihr Aussehen,
|
||||||
|
// wenn eines dazwischen ausgeblendet wird (asort ist stabil - bei gleichem Preis
|
||||||
|
// entscheidet wie bisher die Sortierung).
|
||||||
|
$ranked = $totals;
|
||||||
|
asort($ranked);
|
||||||
|
$rankById = array_flip(array_keys($ranked));
|
||||||
|
|
||||||
|
$packages = [];
|
||||||
|
foreach ($rows as $row) {
|
||||||
|
if (!empty($row['is_hidden'])) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
$badge = PackageController::effectiveBadge($row);
|
||||||
|
$packages[] = [
|
||||||
|
'id' => $row['id'],
|
||||||
|
'name' => $row['name'],
|
||||||
|
'slug' => $row['slug'],
|
||||||
|
'description' => $row['description'],
|
||||||
|
'icon_name' => $row['icon_name'],
|
||||||
|
'tagline' => $row['tagline'],
|
||||||
|
'price_text' => $row['price_text'] ?? null,
|
||||||
|
'badge' => $badge,
|
||||||
|
'badge_text' => $badge === 'custom' ? ($row['badge_text'] ?? null) : null,
|
||||||
|
'video_url' => $row['video_url'] ?? null,
|
||||||
|
'is_featured' => $badge === 'recommended',
|
||||||
|
'sort_order' => $row['sort_order'],
|
||||||
|
'products' => array_map(static function (array $product): array {
|
||||||
|
unset($product['scraped_price']);
|
||||||
|
return $product;
|
||||||
|
}, $productsByPackage[$row['id']] ?? []),
|
||||||
|
'total_price' => $totals[$row['id']],
|
||||||
|
'tier_rank' => $rankById[$row['id']],
|
||||||
|
'tier_count' => count($rows),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
Http::send(['model' => $model, 'packages' => $packages]);
|
Http::send(['model' => $model, 'packages' => $packages]);
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@ use App\Support\TextStyleCleanup;
|
||||||
|
|
||||||
class PackageController
|
class PackageController
|
||||||
{
|
{
|
||||||
|
// Markierungen, die auf der Paket-Kachel oben als Badge erscheinen koennen. "custom" zeigt
|
||||||
|
// den frei eingegebenen badge_text, alle anderen werden im Frontend uebersetzt.
|
||||||
|
public const BADGES = ['recommended', 'popular', 'tip', 'coming_soon', 'custom'];
|
||||||
|
|
||||||
private static function normalizeMarkup(array $body): array
|
private static function normalizeMarkup(array $body): array
|
||||||
{
|
{
|
||||||
$type = $body['markup_type'] ?? 'none';
|
$type = $body['markup_type'] ?? 'none';
|
||||||
|
|
@ -20,11 +24,61 @@ class PackageController
|
||||||
return [$type, $value];
|
return [$type, $value];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return array{0: ?string, 1: ?string} [badge, badge_text]
|
||||||
|
*/
|
||||||
|
private static function normalizeBadge(array $body): array
|
||||||
|
{
|
||||||
|
// Aeltere Clients kennen nur die Empfohlen-Checkbox.
|
||||||
|
if (!array_key_exists('badge', $body)) {
|
||||||
|
return [!empty($body['is_featured']) ? 'recommended' : null, null];
|
||||||
|
}
|
||||||
|
|
||||||
|
$badge = (string) ($body['badge'] ?? '');
|
||||||
|
if (!in_array($badge, self::BADGES, true)) {
|
||||||
|
return [null, null];
|
||||||
|
}
|
||||||
|
if ($badge !== 'custom') {
|
||||||
|
return [$badge, null];
|
||||||
|
}
|
||||||
|
|
||||||
|
$text = mb_substr(trim((string) ($body['badge_text'] ?? '')), 0, 40);
|
||||||
|
return $text === '' ? [null, null] : ['custom', $text];
|
||||||
|
}
|
||||||
|
|
||||||
|
private static function normalizeVideoUrl(array $body): ?string
|
||||||
|
{
|
||||||
|
$url = trim((string) ($body['video_url'] ?? ''));
|
||||||
|
if ($url === '') {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
// "youtu.be/..." ohne Schema ist die haeufigste Eingabe aus der Zwischenablage.
|
||||||
|
if (!preg_match('#^https?://#i', $url)) {
|
||||||
|
$url = 'https://' . $url;
|
||||||
|
}
|
||||||
|
if (strlen($url) > 500 || !filter_var($url, FILTER_VALIDATE_URL)) {
|
||||||
|
Http::error('Video-Link ist keine gültige Adresse (z. B. https://youtu.be/...)', 422);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $url;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Pakete aus der Zeit vor der Markierungs-Auswahl hatten nur is_featured ("Empfohlen"). */
|
||||||
|
public static function effectiveBadge(array $package): ?string
|
||||||
|
{
|
||||||
|
$badge = $package['badge'] ?? null;
|
||||||
|
if ($badge !== null && $badge !== '') {
|
||||||
|
return $badge;
|
||||||
|
}
|
||||||
|
return !empty($package['is_featured']) ? 'recommended' : null;
|
||||||
|
}
|
||||||
|
|
||||||
public static function index(): void
|
public static function index(): void
|
||||||
{
|
{
|
||||||
$stmt = Database::connection()->query(
|
$stmt = Database::connection()->query(
|
||||||
'SELECT p.id, p.name, p.slug, p.description, p.markup_type, p.markup_value, p.icon_name, p.tagline,
|
'SELECT p.id, p.name, p.slug, p.description, p.markup_type, p.markup_value, p.icon_name, p.tagline,
|
||||||
p.price_text, p.is_featured, p.sort_order, p.car_model_id, m.name AS model_name, b.name AS brand_name
|
p.price_text, p.is_featured, p.is_hidden, p.badge, p.badge_text, p.video_url, p.sort_order,
|
||||||
|
p.car_model_id, m.name AS model_name, b.name AS brand_name
|
||||||
FROM packages p
|
FROM packages p
|
||||||
JOIN car_models m ON m.id = p.car_model_id
|
JOIN car_models m ON m.id = p.car_model_id
|
||||||
JOIN brands b ON b.id = m.brand_id
|
JOIN brands b ON b.id = m.brand_id
|
||||||
|
|
@ -32,7 +86,9 @@ class PackageController
|
||||||
);
|
);
|
||||||
$packages = $stmt->fetchAll();
|
$packages = $stmt->fetchAll();
|
||||||
foreach ($packages as &$package) {
|
foreach ($packages as &$package) {
|
||||||
$package['is_featured'] = (bool) $package['is_featured'];
|
$package['badge'] = self::effectiveBadge($package);
|
||||||
|
$package['is_featured'] = $package['badge'] === 'recommended';
|
||||||
|
$package['is_hidden'] = (bool) $package['is_hidden'];
|
||||||
}
|
}
|
||||||
unset($package);
|
unset($package);
|
||||||
Http::send($packages);
|
Http::send($packages);
|
||||||
|
|
@ -49,11 +105,14 @@ class PackageController
|
||||||
}
|
}
|
||||||
|
|
||||||
[$markupType, $markupValue] = self::normalizeMarkup($body);
|
[$markupType, $markupValue] = self::normalizeMarkup($body);
|
||||||
|
[$badge, $badgeText] = self::normalizeBadge($body);
|
||||||
|
$videoUrl = self::normalizeVideoUrl($body);
|
||||||
|
|
||||||
$db = Database::connection();
|
$db = Database::connection();
|
||||||
$stmt = $db->prepare(
|
$stmt = $db->prepare(
|
||||||
'INSERT INTO packages (car_model_id, name, slug, description, markup_type, markup_value, icon_name, tagline, price_text, is_featured, sort_order)
|
'INSERT INTO packages (car_model_id, name, slug, description, markup_type, markup_value, icon_name, tagline, price_text,
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
is_featured, badge, badge_text, video_url, sort_order)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||||
);
|
);
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
$modelId,
|
$modelId,
|
||||||
|
|
@ -65,7 +124,11 @@ class PackageController
|
||||||
trim($body['icon_name'] ?? '') ?: null,
|
trim($body['icon_name'] ?? '') ?: null,
|
||||||
trim($body['tagline'] ?? '') ?: null,
|
trim($body['tagline'] ?? '') ?: null,
|
||||||
trim($body['price_text'] ?? '') ?: null,
|
trim($body['price_text'] ?? '') ?: null,
|
||||||
!empty($body['is_featured']) ? 1 : 0,
|
// is_featured bleibt fuer Alt-Code/Exporte synchron zur Markierung "Empfohlen".
|
||||||
|
$badge === 'recommended' ? 1 : 0,
|
||||||
|
$badge,
|
||||||
|
$badgeText,
|
||||||
|
$videoUrl,
|
||||||
(int) ($body['sort_order'] ?? 0),
|
(int) ($body['sort_order'] ?? 0),
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
@ -84,9 +147,15 @@ class PackageController
|
||||||
}
|
}
|
||||||
|
|
||||||
[$markupType, $markupValue] = self::normalizeMarkup($body);
|
[$markupType, $markupValue] = self::normalizeMarkup($body);
|
||||||
|
[$badge, $badgeText] = self::normalizeBadge($body);
|
||||||
|
$videoUrl = self::normalizeVideoUrl($body);
|
||||||
|
|
||||||
|
// is_hidden bewusst nicht hier - das schaltet setVisibility() sofort per Klick um,
|
||||||
|
// unabhaengig vom "Alle speichern" des Batch-Editors.
|
||||||
$stmt = Database::connection()->prepare(
|
$stmt = Database::connection()->prepare(
|
||||||
'UPDATE packages SET car_model_id = ?, name = ?, slug = ?, description = ?, markup_type = ?, markup_value = ?, icon_name = ?, tagline = ?, price_text = ?, is_featured = ?, sort_order = ? WHERE id = ?'
|
'UPDATE packages SET car_model_id = ?, name = ?, slug = ?, description = ?, markup_type = ?, markup_value = ?, icon_name = ?,
|
||||||
|
tagline = ?, price_text = ?, is_featured = ?, badge = ?, badge_text = ?, video_url = ?, sort_order = ?
|
||||||
|
WHERE id = ?'
|
||||||
);
|
);
|
||||||
$stmt->execute([
|
$stmt->execute([
|
||||||
$modelId,
|
$modelId,
|
||||||
|
|
@ -98,7 +167,10 @@ class PackageController
|
||||||
trim($body['icon_name'] ?? '') ?: null,
|
trim($body['icon_name'] ?? '') ?: null,
|
||||||
trim($body['tagline'] ?? '') ?: null,
|
trim($body['tagline'] ?? '') ?: null,
|
||||||
trim($body['price_text'] ?? '') ?: null,
|
trim($body['price_text'] ?? '') ?: null,
|
||||||
!empty($body['is_featured']) ? 1 : 0,
|
$badge === 'recommended' ? 1 : 0,
|
||||||
|
$badge,
|
||||||
|
$badgeText,
|
||||||
|
$videoUrl,
|
||||||
(int) ($body['sort_order'] ?? 0),
|
(int) ($body['sort_order'] ?? 0),
|
||||||
$id,
|
$id,
|
||||||
]);
|
]);
|
||||||
|
|
@ -106,6 +178,29 @@ class PackageController
|
||||||
Http::send(['ok' => true]);
|
Http::send(['ok' => true]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Blendet ein Paket auf der oeffentlichen Modellseite aus bzw. wieder ein (ein Klick im Admin). */
|
||||||
|
public static function setVisibility(array $params): void
|
||||||
|
{
|
||||||
|
$id = (int) $params['id'];
|
||||||
|
$body = Http::jsonBody();
|
||||||
|
if (!array_key_exists('is_hidden', $body)) {
|
||||||
|
Http::error('is_hidden erforderlich', 422);
|
||||||
|
}
|
||||||
|
$hidden = !empty($body['is_hidden']);
|
||||||
|
|
||||||
|
$stmt = Database::connection()->prepare('UPDATE packages SET is_hidden = ? WHERE id = ?');
|
||||||
|
$stmt->execute([$hidden ? 1 : 0, $id]);
|
||||||
|
if ($stmt->rowCount() === 0) {
|
||||||
|
$exists = Database::connection()->prepare('SELECT 1 FROM packages WHERE id = ?');
|
||||||
|
$exists->execute([$id]);
|
||||||
|
if (!$exists->fetch()) {
|
||||||
|
Http::error('Paket nicht gefunden', 404);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Http::send(['ok' => true, 'is_hidden' => $hidden]);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Kopiert alle Pakete eines Quellmodells (inkl. der verknuepften
|
* Kopiert alle Pakete eines Quellmodells (inkl. der verknuepften
|
||||||
* package_products-Zeilen samt gecachter Scrape-Daten - KEIN Re-Scraping)
|
* package_products-Zeilen samt gecachter Scrape-Daten - KEIN Re-Scraping)
|
||||||
|
|
@ -148,8 +243,9 @@ class PackageController
|
||||||
$db->beginTransaction();
|
$db->beginTransaction();
|
||||||
try {
|
try {
|
||||||
$insertPackage = $db->prepare(
|
$insertPackage = $db->prepare(
|
||||||
'INSERT INTO packages (car_model_id, name, slug, description, markup_type, markup_value, icon_name, tagline, price_text, is_featured, sort_order)
|
'INSERT INTO packages (car_model_id, name, slug, description, markup_type, markup_value, icon_name, tagline, price_text,
|
||||||
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
is_featured, is_hidden, badge, badge_text, video_url, sort_order)
|
||||||
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)'
|
||||||
);
|
);
|
||||||
$copyProducts = $db->prepare(
|
$copyProducts = $db->prepare(
|
||||||
'INSERT INTO package_products (package_id, source_url, name_override, scraped_name, scraped_price, scraped_currency,
|
'INSERT INTO package_products (package_id, source_url, name_override, scraped_name, scraped_price, scraped_currency,
|
||||||
|
|
@ -175,6 +271,10 @@ class PackageController
|
||||||
$pkg['tagline'],
|
$pkg['tagline'],
|
||||||
$pkg['price_text'],
|
$pkg['price_text'],
|
||||||
(int) $pkg['is_featured'],
|
(int) $pkg['is_featured'],
|
||||||
|
(int) $pkg['is_hidden'],
|
||||||
|
$pkg['badge'],
|
||||||
|
$pkg['badge_text'],
|
||||||
|
$pkg['video_url'],
|
||||||
(int) $pkg['sort_order'],
|
(int) $pkg['sort_order'],
|
||||||
]);
|
]);
|
||||||
$newId = (int) $db->lastInsertId();
|
$newId = (int) $db->lastInsertId();
|
||||||
|
|
|
||||||
|
|
@ -60,15 +60,17 @@ HTML,
|
||||||
<p>Außerdem haben Sie das Recht, sich bei einer Datenschutz-Aufsichtsbehörde über die Verarbeitung Ihrer personenbezogenen Daten durch uns zu beschweren, zum Beispiel beim Bayerischen Landesamt für Datenschutzaufsicht (BayLDA).</p>
|
<p>Außerdem haben Sie das Recht, sich bei einer Datenschutz-Aufsichtsbehörde über die Verarbeitung Ihrer personenbezogenen Daten durch uns zu beschweren, zum Beispiel beim Bayerischen Landesamt für Datenschutzaufsicht (BayLDA).</p>
|
||||||
<h2>3. Hosting und Server-Logfiles</h2>
|
<h2>3. Hosting und Server-Logfiles</h2>
|
||||||
<p>Beim Aufruf dieser Website erhebt der Webserver automatisch Daten in sogenannten Server-Logfiles, die Ihr Browser übermittelt. Dazu gehören: IP-Adresse, Datum und Uhrzeit der Anfrage, aufgerufene Seite, verwendeter Browser und Betriebssystem sowie die zuvor besuchte Seite (Referrer-URL). Diese Daten dienen ausschließlich der technisch fehlerfreien Auslieferung der Website sowie der IT-Sicherheit (z. B. zur Abwehr von Angriffen) und werden nicht mit anderen Datenquellen zusammengeführt. Rechtsgrundlage ist unser berechtigtes Interesse an einem sicheren und stabilen Betrieb der Website (Art. 6 Abs. 1 lit. f DSGVO).</p>
|
<p>Beim Aufruf dieser Website erhebt der Webserver automatisch Daten in sogenannten Server-Logfiles, die Ihr Browser übermittelt. Dazu gehören: IP-Adresse, Datum und Uhrzeit der Anfrage, aufgerufene Seite, verwendeter Browser und Betriebssystem sowie die zuvor besuchte Seite (Referrer-URL). Diese Daten dienen ausschließlich der technisch fehlerfreien Auslieferung der Website sowie der IT-Sicherheit (z. B. zur Abwehr von Angriffen) und werden nicht mit anderen Datenquellen zusammengeführt. Rechtsgrundlage ist unser berechtigtes Interesse an einem sicheren und stabilen Betrieb der Website (Art. 6 Abs. 1 lit. f DSGVO).</p>
|
||||||
|
<p><strong>Schriftarten:</strong> Die auf dieser Website verwendeten Schriftarten sind lokal auf unserem Webserver gespeichert und werden direkt von dort geladen. Eine Verbindung zu Servern von Google (Google Fonts) oder anderen Schriftarten-Anbietern wird dabei nicht aufgebaut; es werden keine Daten an Dritte übertragen.</p>
|
||||||
<h2>4. Kontaktformular</h2>
|
<h2>4. Kontaktformular</h2>
|
||||||
<p>Wenn Sie uns über das Kontaktformular eine Anfrage zukommen lassen, werden Ihre Angaben aus dem Formular (Name, E-Mail-Adresse, optional Telefonnummer, Nachricht sowie ggf. der Kontext Ihrer Anfrage wie Marke, Modell oder Paket) inklusive der von Ihnen dort angegebenen Kontaktdaten bei uns gespeichert, um Ihre Anfrage zu bearbeiten und zu beantworten. Die Verarbeitung erfolgt auf Grundlage Ihrer Einwilligung durch Absenden des Formulars (Art. 6 Abs. 1 lit. a DSGVO) bzw., sofern Ihre Anfrage der Vorbereitung eines Vertrags dient, auf Grundlage von Art. 6 Abs. 1 lit. b DSGVO. Wir löschen die Anfrage inklusive der Kontaktdaten, sobald der jeweilige Sachverhalt abschließend geklärt ist und keine gesetzlichen Aufbewahrungspflichten entgegenstehen. Diese Einwilligung können Sie jederzeit widerrufen, indem Sie uns formlos per E-Mail kontaktieren.</p>
|
<p>Wenn Sie uns über das Kontaktformular eine Anfrage zukommen lassen, werden Ihre Angaben aus dem Formular (Name, E-Mail-Adresse, optional Telefonnummer, Nachricht sowie ggf. der Kontext Ihrer Anfrage wie Marke, Modell oder Paket) inklusive der von Ihnen dort angegebenen Kontaktdaten bei uns gespeichert, um Ihre Anfrage zu bearbeiten und zu beantworten. Die Verarbeitung erfolgt auf Grundlage Ihrer Einwilligung durch Absenden des Formulars (Art. 6 Abs. 1 lit. a DSGVO) bzw., sofern Ihre Anfrage der Vorbereitung eines Vertrags dient, auf Grundlage von Art. 6 Abs. 1 lit. b DSGVO. Wir löschen die Anfrage inklusive der Kontaktdaten, sobald der jeweilige Sachverhalt abschließend geklärt ist und keine gesetzlichen Aufbewahrungspflichten entgegenstehen. Diese Einwilligung können Sie jederzeit widerrufen, indem Sie uns formlos per E-Mail kontaktieren.</p>
|
||||||
<h2>5. Cookies und lokale Speicherung</h2>
|
<h2>5. Cookies und lokale Speicherung</h2>
|
||||||
<p>Diese Website verwendet technisch notwendige Cookies bzw. Speichertechnologien, die für den Betrieb der Seite erforderlich sind und ohne die einzelne Funktionen nicht funktionieren würden. Dazu gehören:</p>
|
<p>Diese Website verwendet technisch notwendige Cookies bzw. Speichertechnologien, die für den Betrieb der Seite erforderlich sind und ohne die einzelne Funktionen nicht funktionieren würden. Dazu gehören:</p>
|
||||||
<ul>
|
<ul>
|
||||||
<li>ein Session-Cookie (<code>hifi_admin_session</code>), das für den Anmeldestatus im Mitarbeiter-Login benötigt wird und mit Ende der Browsersitzung abläuft,</li>
|
<li>ein Session-Cookie (<code>hifi_admin_session</code>), das für den Anmeldestatus im Mitarbeiter-Login benötigt wird und mit Ende der Browsersitzung abläuft,</li>
|
||||||
<li>eine lokale Speicherung (<code>localStorage</code>) Ihrer Hell-/Dunkelmodus-Einstellung sowie Ihrer Cookie-Auswahl, damit wir Sie nicht bei jedem Besuch erneut danach fragen müssen.</li>
|
<li>eine lokale Speicherung (<code>localStorage</code>) Ihrer Hell-/Dunkelmodus-Einstellung, Ihrer Sprachauswahl sowie Ihrer Cookie-Auswahl, damit wir Sie nicht bei jedem Besuch erneut danach fragen müssen,</li>
|
||||||
|
<li>falls Sie unseren passwortgeschützten Download-Bereich nutzen, eine lokale Speicherung (<code>localStorage</code>) des von Ihnen eingegebenen Zugangspassworts, damit Sie es nicht bei jedem Besuch erneut eingeben müssen.</li>
|
||||||
</ul>
|
</ul>
|
||||||
<p>Für diese technisch notwendigen Cookies ist gemäß § 25 Abs. 2 Nr. 2 TTDSG keine Einwilligung erforderlich. Rechtsgrundlage ist unser berechtigtes Interesse am technischen Betrieb der Website (Art. 6 Abs. 1 lit. f DSGVO). Für alle darüber hinausgehenden Inhalte und Dienste – aktuell die eingebundenen Google Maps- und YouTube-Elemente sowie Google Analytics – fragen wir Sie beim ersten Besuch aktiv nach Ihrer Einwilligung. Sie können Ihre Auswahl jederzeit über den Link „Cookie-Einstellungen" im Footer ändern.</p>
|
<p>Für diese technisch notwendigen Cookies und Speichervorgänge ist gemäß § 25 Abs. 2 Nr. 2 TDDDG keine Einwilligung erforderlich. Rechtsgrundlage ist unser berechtigtes Interesse am technischen Betrieb der Website (Art. 6 Abs. 1 lit. f DSGVO). Für alle darüber hinausgehenden Inhalte und Dienste – aktuell die eingebundenen Google Maps- und YouTube-Elemente sowie Google Analytics – fragen wir Sie beim ersten Besuch aktiv nach Ihrer Einwilligung. Sie können Ihre Auswahl jederzeit über den Link „Cookie-Einstellungen" im Footer ändern.</p>
|
||||||
<h2>6. Google Maps</h2>
|
<h2>6. Google Maps</h2>
|
||||||
<p>Auf unserer Kontaktseite und im Footer binden wir Kartenmaterial des Dienstes „Google Maps" ein, um Ihnen die Anfahrt zu unserem Standort zu erleichtern. Anbieter ist Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Irland. Die eingebettete Karte wird erst geladen, nachdem Sie dem im Cookie-Banner unter „Externe Medien" zugestimmt haben. Beim Laden der Karte wird Ihre IP-Adresse an Google übertragen; eine Verarbeitung kann dabei auch auf Servern außerhalb der EU/des EWR erfolgen. Die Verarbeitung erfolgt auf Grundlage Ihrer Einwilligung (Art. 6 Abs. 1 lit. a DSGVO), die Sie jederzeit über die Cookie-Einstellungen widerrufen können. Weitere Informationen finden Sie in der <a href="https://policies.google.com/privacy" target="_blank" rel="noopener noreferrer">Datenschutzerklärung von Google</a>.</p>
|
<p>Auf unserer Kontaktseite und im Footer binden wir Kartenmaterial des Dienstes „Google Maps" ein, um Ihnen die Anfahrt zu unserem Standort zu erleichtern. Anbieter ist Google Ireland Limited, Gordon House, Barrow Street, Dublin 4, Irland. Die eingebettete Karte wird erst geladen, nachdem Sie dem im Cookie-Banner unter „Externe Medien" zugestimmt haben. Beim Laden der Karte wird Ihre IP-Adresse an Google übertragen; eine Verarbeitung kann dabei auch auf Servern außerhalb der EU/des EWR erfolgen. Die Verarbeitung erfolgt auf Grundlage Ihrer Einwilligung (Art. 6 Abs. 1 lit. a DSGVO), die Sie jederzeit über die Cookie-Einstellungen widerrufen können. Weitere Informationen finden Sie in der <a href="https://policies.google.com/privacy" target="_blank" rel="noopener noreferrer">Datenschutzerklärung von Google</a>.</p>
|
||||||
<h2>7. YouTube</h2>
|
<h2>7. YouTube</h2>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class SettingsController
|
||||||
'brands' => ['id', 'name', 'slug', 'image_path', 'sort_order', 'created_at', 'updated_at'],
|
'brands' => ['id', 'name', 'slug', 'image_path', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'partners' => ['id', 'name', 'logo_path', 'sort_order', 'created_at', 'updated_at'],
|
'partners' => ['id', 'name', 'logo_path', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'car_models' => ['id', 'brand_id', 'name', 'slug', 'image_path', 'sort_order', 'created_at', 'updated_at'],
|
'car_models' => ['id', 'brand_id', 'name', 'slug', 'image_path', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'packages' => ['id', 'car_model_id', 'name', 'slug', 'description', 'markup_type', 'markup_value', 'icon_name', 'tagline', 'price_text', 'is_featured', 'sort_order', 'created_at', 'updated_at'],
|
'packages' => ['id', 'car_model_id', 'name', 'slug', 'description', 'markup_type', 'markup_value', 'icon_name', 'tagline', 'price_text', 'is_featured', 'is_hidden', 'badge', 'badge_text', 'video_url', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'package_products' => ['id', 'package_id', 'source_url', 'name_override', 'scraped_name', 'scraped_price', 'scraped_currency', 'scraped_image_url', 'price_updated_at', 'scrape_status', 'scrape_error', 'sort_order', 'created_at', 'updated_at'],
|
'package_products' => ['id', 'package_id', 'source_url', 'name_override', 'scraped_name', 'scraped_price', 'scraped_currency', 'scraped_image_url', 'price_updated_at', 'scrape_status', 'scrape_error', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'package_upgrades' => ['id', 'package_id', 'name', 'description', 'price', 'sort_order', 'created_at', 'updated_at'],
|
'package_upgrades' => ['id', 'package_id', 'name', 'description', 'price', 'sort_order', 'created_at', 'updated_at'],
|
||||||
'services' => ['id', 'icon_name', 'title', 'description', 'image_path', 'cta_label', 'cta_url', 'sort_order', 'created_at', 'updated_at'],
|
'services' => ['id', 'icon_name', 'title', 'description', 'image_path', 'cta_label', 'cta_url', 'sort_order', 'created_at', 'updated_at'],
|
||||||
|
|
@ -33,6 +33,8 @@ class SettingsController
|
||||||
// selbst, aus denselben Gruenden wie die komplett ausgeschlossene google_reviews-Tabelle)
|
// selbst, aus denselben Gruenden wie die komplett ausgeschlossene google_reviews-Tabelle)
|
||||||
// und ohne id/updated_at (Singleton-Zeile mit fester id=1, kein Fremdschluessel zeigt
|
// und ohne id/updated_at (Singleton-Zeile mit fester id=1, kein Fremdschluessel zeigt
|
||||||
// darauf - updated_at bekommt beim Import ohnehin automatisch den aktuellen Zeitstempel).
|
// darauf - updated_at bekommt beim Import ohnehin automatisch den aktuellen Zeitstempel).
|
||||||
|
// downloads_password fehlt ebenfalls bewusst - wie die Download-Dateien selbst (siehe
|
||||||
|
// DownloadController), die ein Export ohnehin nicht mitnimmt.
|
||||||
'app_settings' => [
|
'app_settings' => [
|
||||||
'maintenance_global', 'maintenance_global_message',
|
'maintenance_global', 'maintenance_global_message',
|
||||||
'maintenance_services', 'maintenance_services_message',
|
'maintenance_services', 'maintenance_services_message',
|
||||||
|
|
|
||||||
|
|
@ -67,8 +67,11 @@ class SetupController
|
||||||
$databaseOk = $db !== null;
|
$databaseOk = $db !== null;
|
||||||
$schemaOk = $databaseOk && self::schemaOk($db);
|
$schemaOk = $databaseOk && self::schemaOk($db);
|
||||||
|
|
||||||
|
// Bewusst nicht an $schemaOk gekoppelt: bringt ein Code-Update eine neue Tabelle mit,
|
||||||
|
// fehlt die bis zum Klick auf "Datenbankstruktur aktualisieren" - die Seite darf deshalb
|
||||||
|
// nicht auf den Ersteinrichtungs-Assistenten umleiten, solange es einen Admin gibt.
|
||||||
$adminOk = false;
|
$adminOk = false;
|
||||||
if ($schemaOk) {
|
if ($databaseOk) {
|
||||||
try {
|
try {
|
||||||
$adminOk = ((int) $db->query('SELECT COUNT(*) FROM admin_users')->fetchColumn()) > 0;
|
$adminOk = ((int) $db->query('SELECT COUNT(*) FROM admin_users')->fetchColumn()) > 0;
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
|
|
||||||
|
|
@ -72,6 +72,8 @@ class SiteSettingsController
|
||||||
}
|
}
|
||||||
$decodedHours = is_string($row['business_hours'] ?? null) ? json_decode($row['business_hours'], true) : null;
|
$decodedHours = is_string($row['business_hours'] ?? null) ? json_decode($row['business_hours'], true) : null;
|
||||||
$result['business_hours'] = is_array($decodedHours) ? $decodedHours : self::DEFAULT_BUSINESS_HOURS;
|
$result['business_hours'] = is_array($decodedHours) ? $decodedHours : self::DEFAULT_BUSINESS_HOURS;
|
||||||
|
// Navbar/Footer zeigen "Downloads" nur, wenn dort auch etwas zu finden ist.
|
||||||
|
$result['has_downloads'] = DownloadController::hasVisible();
|
||||||
|
|
||||||
Http::send($result);
|
Http::send($result);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,7 @@ class Permissions
|
||||||
'services.manage' => 'Leistungen verwalten',
|
'services.manage' => 'Leistungen verwalten',
|
||||||
'content.manage' => 'Startseiten-Inhalte (z. B. FAQ) verwalten',
|
'content.manage' => 'Startseiten-Inhalte (z. B. FAQ) verwalten',
|
||||||
'gallery.manage' => 'Bildergalerie verwalten',
|
'gallery.manage' => 'Bildergalerie verwalten',
|
||||||
|
'downloads.manage' => 'Download-Bereich verwalten (Dateien für Kunden)',
|
||||||
'contact.manage' => 'Kontaktanfragen ansehen & bearbeiten',
|
'contact.manage' => 'Kontaktanfragen ansehen & bearbeiten',
|
||||||
'contact.delete' => 'Kontaktanfragen löschen',
|
'contact.delete' => 'Kontaktanfragen löschen',
|
||||||
'users.manage' => 'Benutzer verwalten',
|
'users.manage' => 'Benutzer verwalten',
|
||||||
|
|
|
||||||
|
|
@ -61,6 +61,7 @@ class Schema
|
||||||
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
|
gallery_card_text_y TINYINT UNSIGNED NOT NULL DEFAULT 100,
|
||||||
site_font VARCHAR(255) NULL,
|
site_font VARCHAR(255) NULL,
|
||||||
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
|
page_loader_enabled TINYINT(1) NOT NULL DEFAULT 1,
|
||||||
|
downloads_password VARCHAR(100) NULL,
|
||||||
mail_host VARCHAR(255) NULL,
|
mail_host VARCHAR(255) NULL,
|
||||||
mail_port INT NULL,
|
mail_port INT NULL,
|
||||||
mail_username VARCHAR(255) NULL,
|
mail_username VARCHAR(255) NULL,
|
||||||
|
|
@ -259,6 +260,10 @@ class Schema
|
||||||
tagline VARCHAR(150) NULL,
|
tagline VARCHAR(150) NULL,
|
||||||
price_text VARCHAR(100) NULL,
|
price_text VARCHAR(100) NULL,
|
||||||
is_featured TINYINT(1) NOT NULL DEFAULT 0,
|
is_featured TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
badge VARCHAR(20) NULL,
|
||||||
|
badge_text VARCHAR(40) NULL,
|
||||||
|
video_url VARCHAR(500) NULL,
|
||||||
sort_order INT NOT NULL DEFAULT 0,
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
|
||||||
|
|
@ -342,6 +347,23 @@ class Schema
|
||||||
sort_order INT NOT NULL DEFAULT 0,
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP
|
||||||
) ENGINE=InnoDB",
|
) ENGINE=InnoDB",
|
||||||
|
|
||||||
|
// Download-Bereich (/downloads): vom Admin hochgeladene Dateien fuer Kunden (Songs,
|
||||||
|
// Anleitungen, ...). Die Datei selbst liegt unter einem zufaelligen Namen in
|
||||||
|
// api/uploads/downloads/ (siehe DownloadController), file_name ist der Originalname,
|
||||||
|
// unter dem der Besucher sie herunterlaedt.
|
||||||
|
'downloads' => "CREATE TABLE downloads (
|
||||||
|
id INT AUTO_INCREMENT PRIMARY KEY,
|
||||||
|
title VARCHAR(150) NOT NULL,
|
||||||
|
description TEXT NULL,
|
||||||
|
file_path VARCHAR(255) NOT NULL,
|
||||||
|
file_name VARCHAR(255) NOT NULL,
|
||||||
|
file_size BIGINT UNSIGNED NOT NULL DEFAULT 0,
|
||||||
|
is_hidden TINYINT(1) NOT NULL DEFAULT 0,
|
||||||
|
sort_order INT NOT NULL DEFAULT 0,
|
||||||
|
created_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||||
|
updated_at DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP
|
||||||
|
) ENGINE=InnoDB",
|
||||||
];
|
];
|
||||||
|
|
||||||
// Erwartete Spalten je Tabelle (ohne Primary Key / Unique / Foreign-Key-Klauseln –
|
// Erwartete Spalten je Tabelle (ohne Primary Key / Unique / Foreign-Key-Klauseln –
|
||||||
|
|
@ -398,6 +420,7 @@ class Schema
|
||||||
'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100',
|
'gallery_card_text_y' => 'TINYINT UNSIGNED NOT NULL DEFAULT 100',
|
||||||
'site_font' => 'VARCHAR(255) NULL',
|
'site_font' => 'VARCHAR(255) NULL',
|
||||||
'page_loader_enabled' => 'TINYINT(1) NOT NULL DEFAULT 1',
|
'page_loader_enabled' => 'TINYINT(1) NOT NULL DEFAULT 1',
|
||||||
|
'downloads_password' => 'VARCHAR(100) NULL',
|
||||||
'mail_host' => 'VARCHAR(255) NULL',
|
'mail_host' => 'VARCHAR(255) NULL',
|
||||||
'mail_port' => 'INT NULL',
|
'mail_port' => 'INT NULL',
|
||||||
'mail_username' => 'VARCHAR(255) NULL',
|
'mail_username' => 'VARCHAR(255) NULL',
|
||||||
|
|
@ -550,6 +573,10 @@ class Schema
|
||||||
'tagline' => 'VARCHAR(150) NULL',
|
'tagline' => 'VARCHAR(150) NULL',
|
||||||
'price_text' => 'VARCHAR(100) NULL',
|
'price_text' => 'VARCHAR(100) NULL',
|
||||||
'is_featured' => 'TINYINT(1) NOT NULL DEFAULT 0',
|
'is_featured' => 'TINYINT(1) NOT NULL DEFAULT 0',
|
||||||
|
'is_hidden' => 'TINYINT(1) NOT NULL DEFAULT 0',
|
||||||
|
'badge' => 'VARCHAR(20) NULL',
|
||||||
|
'badge_text' => 'VARCHAR(40) NULL',
|
||||||
|
'video_url' => 'VARCHAR(500) NULL',
|
||||||
'sort_order' => 'INT NOT NULL DEFAULT 0',
|
'sort_order' => 'INT NOT NULL DEFAULT 0',
|
||||||
'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
'updated_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP',
|
||||||
|
|
@ -619,6 +646,18 @@ class Schema
|
||||||
'sort_order' => 'INT NOT NULL DEFAULT 0',
|
'sort_order' => 'INT NOT NULL DEFAULT 0',
|
||||||
'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
],
|
],
|
||||||
|
'downloads' => [
|
||||||
|
'id' => 'INT AUTO_INCREMENT PRIMARY KEY',
|
||||||
|
'title' => 'VARCHAR(150) NOT NULL',
|
||||||
|
'description' => 'TEXT NULL',
|
||||||
|
'file_path' => 'VARCHAR(255) NOT NULL',
|
||||||
|
'file_name' => 'VARCHAR(255) NOT NULL',
|
||||||
|
'file_size' => 'BIGINT UNSIGNED NOT NULL DEFAULT 0',
|
||||||
|
'is_hidden' => 'TINYINT(1) NOT NULL DEFAULT 0',
|
||||||
|
'sort_order' => 'INT NOT NULL DEFAULT 0',
|
||||||
|
'created_at' => 'DATETIME NOT NULL DEFAULT CURRENT_TIMESTAMP',
|
||||||
|
'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
|
||||||
|
|
|
||||||
8
hifi/assets/AccountSettings-DDTEFT25.js
Normal file
8
hifi/assets/AccountSettings-DDTEFT25.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/AdminUsers-ByQIq3tE.js
Normal file
1
hifi/assets/AdminUsers-ByQIq3tE.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/Brands-vqxdbQxK.js
Normal file
1
hifi/assets/Brands-vqxdbQxK.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as l,j as e,L as k,a as n}from"./index-CA8nTsDv.js";import{I as N}from"./ImageUploadField-BcYYcPAm.js";import{T as f}from"./TextStyleWidget-BJ8A0Q5H.js";const u={name:"",image_path:"",sort_order:0};function _(){const[i,h]=l.useState([]),[r,s]=l.useState(u),[a,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),s({name:t.name,image_path:t.image_path||"",sort_order:t.sort_order})},x=()=>{o(null),s(u)},b=async t=>{t.preventDefault(),m("");try{a?await n.put(`/brands/${a}`,r):await n.post("/brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Modelle/Pakete/Produkte wirklich löschen?")&&(await n.delete(`/brands/${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-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Marken"}),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:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),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:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.image_path?e.jsx("img",{src:t.image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(k,{to:`/marken/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,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:a?"Marke bearbeiten":"Neue Marke"}),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=>s({...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"}),a&&e.jsx(f,{fieldKey:`brands.${a}.name`,previewText:r.name||"Beispieltext"})]}),e.jsx(N,{value:r.image_path,onChange:t=>s({...r,image_path:t}),label:"Bild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>s({...r,sort_order:Number(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"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),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:a?"Speichern":"Anlegen"}),a&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{_ as default};
|
||||||
1
hifi/assets/ContactRequests-D83PSee5.js
Normal file
1
hifi/assets/ContactRequests-D83PSee5.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{b as f,r as l,j as t,a as c}from"./index-CA8nTsDv.js";const j=d=>new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(d),k={new:"Neu",in_progress:"In Bearbeitung",done:"Erledigt"},v={new:"bg-brand-100 text-brand-700 dark:bg-brand-900/40 dark:text-brand-300",in_progress:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",done:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"},N=()=>t.jsx("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.75",className:"h-4 w-4",children:t.jsx("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4 7h16M9 7V5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v2m3 0-.8 12.1a1 1 0 0 1-1 .9H7.8a1 1 0 0 1-1-.9L6 7h12ZM10 11v6M14 11v6"})});function _(){const{hasPermission:d}=f(),[n,u]=l.useState([]),[s,m]=l.useState("all"),i=()=>c.get("/contact").then(u);l.useEffect(()=>{i()},[]);const x=async(e,r)=>{await c.patch(`/contact/${e}`,{status:r}),i()},h=async e=>{confirm("Diese Kontaktanfrage wirklich unwiderruflich löschen?")&&(await c.delete(`/contact/${e}`),i())},g=l.useMemo(()=>({all:n.length,new:n.filter(e=>e.status==="new").length,in_progress:n.filter(e=>e.status==="in_progress").length,done:n.filter(e=>e.status==="done").length}),[n]),o=s==="all"?n:n.filter(e=>e.status===s),b=[{value:"all",label:"Alle"},{value:"new",label:"Neu"},{value:"in_progress",label:"In Bearbeitung"},{value:"done",label:"Erledigt"}];return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Kontaktanfragen"}),t.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Alle Anfragen deiner Kunden. Wähle oben einen Reiter, um nur bestimmte Anfragen zu sehen."}),t.jsx("div",{className:"mb-5 flex flex-wrap gap-2",children:b.map(e=>t.jsxs("button",{onClick:()=>m(e.value),className:`rounded-full px-4 py-1.5 text-sm font-medium transition ${s===e.value?"bg-brand-500 text-white":"bg-neutral-100 text-neutral-600 hover:bg-neutral-200 dark:bg-neutral-800 dark:text-neutral-300 dark:hover:bg-neutral-700"}`,children:[e.label," (",g[e.value],")"]},e.value))}),t.jsxs("div",{className:"space-y-3",children:[o.map(e=>{var r;return t.jsxs("div",{className:"rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[t.jsxs("div",{className:"mb-2 flex flex-wrap items-start justify-between gap-2",children:[t.jsxs("div",{children:[t.jsxs("p",{className:"font-semibold text-neutral-800 dark:text-neutral-100",children:[e.name," · ",e.email,e.phone?` · ${e.phone}`:""]}),e.vin&&t.jsxs("p",{className:"text-xs text-neutral-500 dark:text-neutral-400",children:["FIN: ",t.jsx("span",{className:"font-mono",children:e.vin})]}),t.jsx("p",{className:"text-xs text-neutral-400",children:new Date(e.created_at.replace(" ","T")).toLocaleString("de-DE")})]}),t.jsxs("div",{className:"flex items-center gap-2",children:[t.jsx("select",{value:e.status,onChange:a=>x(e.id,a.target.value),className:`rounded-full border-0 px-3 py-1 text-xs font-medium ${v[e.status]}`,children:Object.entries(k).map(([a,p])=>t.jsx("option",{value:a,children:p},a))}),d("contact.delete")&&t.jsx("button",{onClick:()=>h(e.id),"aria-label":"Anfrage löschen",title:"Anfrage löschen",className:"rounded-md p-1.5 text-neutral-400 hover:bg-red-50 hover:text-red-600 dark:hover:bg-red-900/20",children:t.jsx(N,{})})]})]}),(e.brand_name||e.model_name||e.package_name||e.product_name)&&t.jsx("p",{className:"mb-2 text-sm text-neutral-500 dark:text-neutral-400",children:[e.brand_name,e.model_name,e.package_name,e.product_name].filter(Boolean).join(" · ")}),((r=e.selected_upgrades)==null?void 0:r.length)>0&&t.jsxs("div",{className:"mb-2 rounded-md bg-brand-50 p-2 text-sm text-brand-800 dark:bg-brand-900/20 dark:text-brand-200",children:[t.jsx("p",{className:"font-semibold",children:"Gewünschte Upgrades:"}),t.jsx("ul",{className:"list-disc pl-5",children:e.selected_upgrades.map(a=>t.jsxs("li",{children:[a.name," – ",j(a.price)]},a.id))})]}),e.message&&t.jsx("p",{className:"text-sm text-neutral-700 dark:text-neutral-300",children:e.message})]},e.id)}),o.length===0&&t.jsx("p",{className:"text-neutral-400",children:s==="all"?"Noch keine Kontaktanfragen eingegangen.":"Keine Anfragen mit diesem Status."})]})]})}export{_ as default};
|
||||||
1
hifi/assets/Dashboard-NbR3Ooj7.js
Normal file
1
hifi/assets/Dashboard-NbR3Ooj7.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/DatabaseSettings-Cb0c_VcO.js
Normal file
1
hifi/assets/DatabaseSettings-Cb0c_VcO.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/Downloads-CL1Jhgqp.js
Normal file
1
hifi/assets/Downloads-CL1Jhgqp.js
Normal file
File diff suppressed because one or more lines are too long
2
hifi/assets/EmailSettings-CqQsV22t.js
Normal file
2
hifi/assets/EmailSettings-CqQsV22t.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/ExportImportSettings-BcCG7j3_.js
Normal file
1
hifi/assets/ExportImportSettings-BcCG7j3_.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/Faqs-DLPVuJHB.js
Normal file
1
hifi/assets/Faqs-DLPVuJHB.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/GalleryBrands-D1j5xSDf.js
Normal file
1
hifi/assets/GalleryBrands-D1j5xSDf.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as l,j as e,L as N,a as n}from"./index-CA8nTsDv.js";import{I as k}from"./ImageUploadField-BcYYcPAm.js";const u={name:"",cover_image_path:"",sort_order:0};function f(){const[i,h]=l.useState([]),[r,a]=l.useState(u),[s,o]=l.useState(null),[c,m]=l.useState(""),d=()=>n.get("/gallery-brands").then(h);l.useEffect(()=>{d()},[]);const p=t=>{o(t.id),a({name:t.name,cover_image_path:t.cover_image_path||"",sort_order:t.sort_order})},x=()=>{o(null),a(u)},b=async t=>{t.preventDefault(),m("");try{s?await n.put(`/gallery-brands/${s}`,r):await n.post("/gallery-brands",r),x(),d()}catch(j){m(j.message)}},g=async t=>{confirm("Marke inkl. aller Projekte/Fotos wirklich löschen?")&&(await n.delete(`/gallery-brands/${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-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Galerie-Marken"}),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:"Bild"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),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:[i.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.cover_image_path?e.jsx("img",{src:t.cover_image_path,alt:"",className:"h-10 w-10 rounded-md object-cover"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:e.jsx(N,{to:`/galerie/${t.slug}`,target:"_blank",className:"hover:text-brand-500",children:t.name})}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>p(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),i.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Galerie-Marken angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:b,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:s?"Marke bearbeiten":"Neue Marke"}),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.jsx(k,{value:r.cover_image_path,onChange:t=>a({...r,cover_image_path:t}),aspect:4/3,label:"Titelbild (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(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"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),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:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:x,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{f as default};
|
||||||
1
hifi/assets/GalleryPhotos-DGMVFfyC.js
Normal file
1
hifi/assets/GalleryPhotos-DGMVFfyC.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{e as w,r as l,j as t,L as P,a as n}from"./index-CA8nTsDv.js";function C(){const{projectId:d}=w(),[i,c]=l.useState([]),[m,h]=l.useState(""),[x,g]=l.useState(!1),[f,p]=l.useState(""),u=l.useRef(null),o=()=>n.get(`/gallery-projects/${d}/photos`).then(c);l.useEffect(()=>{o()},[d]);const j=async e=>{const r=Array.from(e.target.files||[]);if(r.length!==0){h(""),g(!0);try{for(let a=0;a<r.length;a++){p(`Lade Bild ${a+1} von ${r.length} hoch…`);const s=new FormData;s.append("file",r[a]);const v=await n.post("/uploads",s);await n.post("/gallery-photos",{gallery_project_id:Number(d),image_path:v.path,sort_order:i.length+a})}o()}catch(a){h(a.message)}finally{g(!1),p(""),u.current&&(u.current.value="")}}},N=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,caption:r}:s))},k=(e,r)=>{c(a=>a.map(s=>s.id===e.id?{...s,sort_order:r}:s))},b=async e=>{await n.put(`/gallery-photos/${e.id}`,{caption:e.caption,sort_order:e.sort_order}),o()},y=async e=>{confirm("Foto wirklich entfernen?")&&(await n.delete(`/gallery-photos/${e}`),o())};return t.jsxs("div",{children:[t.jsx("p",{className:"mb-2 text-sm",children:t.jsx(P,{to:"/admin/gallery-projects",className:"text-brand-600 hover:underline",children:"← Zurück zu den Projekten"})}),t.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Fotos im Projekt"}),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:u,type:"file",multiple:!0,accept:"image/png,image/jpeg,image/webp",onChange:j,disabled:x,className:"text-sm"}),x&&t.jsx("p",{className:"mt-2 text-sm text-neutral-500",children:f})]}),m&&t.jsx("p",{className:"mb-4 text-sm text-red-600",children:m}),t.jsxs("div",{className:"grid grid-cols-2 gap-4 sm:grid-cols-3 md:grid-cols-4",children:[i.map(e=>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"}),t.jsxs("div",{className:"space-y-2 p-3",children:[t.jsx("input",{value:e.caption||"",onChange:r=>N(e,r.target.value),onBlur:()=>b(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 gap-2",children:[t.jsx("input",{type:"number",value:e.sort_order,onChange:r=>k(e,Number(r.target.value)),onBlur:()=>b(e),className:"w-16 rounded-md border border-neutral-300 bg-white px-2 py-1 text-xs dark:border-neutral-700 dark:bg-neutral-900"}),t.jsx("button",{onClick:()=>y(e.id),className:"text-xs text-red-600 hover:underline",children:"Entfernen"})]})]})]},e.id)),i.length===0&&t.jsx("p",{className:"col-span-full py-6 text-center text-neutral-400",children:"Noch keine Fotos in diesem Projekt."})]})]})}export{C as default};
|
||||||
1
hifi/assets/GalleryProjects-LRqhs8Yz.js
Normal file
1
hifi/assets/GalleryProjects-LRqhs8Yz.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/HomeSections-BGS9Sedm.js
Normal file
1
hifi/assets/HomeSections-BGS9Sedm.js
Normal file
File diff suppressed because one or more lines are too long
95
hifi/assets/ImageUploadField-BcYYcPAm.js
Normal file
95
hifi/assets/ImageUploadField-BcYYcPAm.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/LegalSettings-kVcunIgr.js
Normal file
1
hifi/assets/LegalSettings-kVcunIgr.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as s,a as b,j as e}from"./index-CA8nTsDv.js";import{R as v}from"./RichTextEditor-AMyLKCg7.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};
|
||||||
1
hifi/assets/Login-fD1Gc69Y.js
Normal file
1
hifi/assets/Login-fD1Gc69Y.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{b as N,c as v,r,j as e,N as y,l as C,d as S}from"./index-CA8nTsDv.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};
|
||||||
1
hifi/assets/MaintenanceSettings-MgDlXntb.js
Normal file
1
hifi/assets/MaintenanceSettings-MgDlXntb.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as s,a as o,j as a}from"./index-CA8nTsDv.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};
|
||||||
1
hifi/assets/Models-ziTFkF11.js
Normal file
1
hifi/assets/Models-ziTFkF11.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/PackageProducts-BiHhjH75.js
Normal file
1
hifi/assets/PackageProducts-BiHhjH75.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{e as j,r as a,j as e,L as N,a as l}from"./index-CA8nTsDv.js";const y=t=>t==null?"–":new Intl.NumberFormat("de-DE",{style:"currency",currency:"EUR"}).format(t),w={ok:"bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300",pending:"bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300",error:"bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"};function _(){const{packageId:t}=j(),[n,p]=a.useState([]),[c,i]=a.useState(""),[u,o]=a.useState(""),[x,m]=a.useState(""),[h,s]=a.useState(!1),d=()=>l.get(`/packages/${t}/products`).then(p);a.useEffect(()=>{d()},[t]);const b=async r=>{r.preventDefault(),m(""),s(!0);try{await l.post("/products",{package_id:Number(t),source_url:c,name_override:u||null}),i(""),o(""),d()}catch(f){m(f.message)}finally{s(!1)}},k=async r=>{s(!0);try{await l.post(`/products/${r}/refresh-price`,{}),d()}finally{s(!1)}},g=async r=>{confirm("Produkt wirklich entfernen?")&&(await l.delete(`/products/${r}`),d())};return e.jsxs("div",{children:[e.jsx("p",{className:"mb-2 text-sm",children:e.jsx(N,{to:"/admin/packages",className:"text-brand-600 hover:underline",children:"← Zurück zu den Paketen"})}),e.jsx("h1",{className:"mb-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Produkte im Paket"}),e.jsxs("form",{onSubmit:b,className:"mb-6 flex flex-wrap items-end gap-3 rounded-xl border border-neutral-200 bg-white p-4 dark:border-neutral-800 dark:bg-neutral-900",children:[e.jsxs("div",{className:"flex-1 min-w-[240px]",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"audio4cars.de Produkt-URL *"}),e.jsx("input",{required:!0,type:"url",placeholder:"https://www.audio4cars.de/produkt/...",value:c,onChange:r=>i(r.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",{className:"w-56",children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Name überschreiben (optional)"}),e.jsx("input",{value:u,onChange:r=>o(r.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("button",{disabled:h,type:"submit",className:"rounded-md bg-brand-500 px-4 py-2 text-sm font-semibold text-white hover:bg-brand-600 disabled:opacity-60",children:"Hinzufügen"})]}),x&&e.jsx("p",{className:"mb-4 text-sm text-red-600",children:x}),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:"Produkt"}),e.jsx("th",{className:"px-4 py-2",children:"Preis"}),e.jsx("th",{className:"px-4 py-2",children:"Status"}),e.jsx("th",{className:"px-4 py-2",children:"Zuletzt aktualisiert"}),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:[n.map(r=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsxs("td",{className:"px-4 py-2",children:[e.jsx("a",{href:r.source_url,target:"_blank",rel:"noreferrer",className:"font-medium text-neutral-800 hover:underline dark:text-neutral-100",children:r.name_override||r.scraped_name||r.source_url}),r.scrape_status==="error"&&e.jsx("p",{className:"text-xs text-red-500",children:r.scrape_error})]}),e.jsx("td",{className:"px-4 py-2",children:y(r.scraped_price)}),e.jsx("td",{className:"px-4 py-2",children:e.jsx("span",{className:`rounded-full px-2 py-0.5 text-xs font-medium ${w[r.scrape_status]}`,children:r.scrape_status})}),e.jsx("td",{className:"px-4 py-2 text-neutral-500 dark:text-neutral-400",children:r.price_updated_at?new Date(r.price_updated_at.replace(" ","T")).toLocaleString("de-DE"):"–"}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{disabled:h,onClick:()=>k(r.id),className:"mr-3 text-brand-600 hover:underline disabled:opacity-60",children:"Preis aktualisieren"}),e.jsx("button",{onClick:()=>g(r.id),className:"text-red-600 hover:underline",children:"Entfernen"})]})]},r.id)),n.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:5,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Produkte im Paket."})})]})]})})]})}export{_ as default};
|
||||||
1
hifi/assets/PackageUpgrades-CqegMehR.js
Normal file
1
hifi/assets/PackageUpgrades-CqegMehR.js
Normal file
File diff suppressed because one or more lines are too long
3
hifi/assets/Packages-yKMipMRC.js
Normal file
3
hifi/assets/Packages-yKMipMRC.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/Partners-_sfjbipE.js
Normal file
1
hifi/assets/Partners-_sfjbipE.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as l,j as e,a as n}from"./index-CA8nTsDv.js";import{I as N}from"./ImageUploadField-BcYYcPAm.js";const u={name:"",logo_path:"",sort_order:0};function y(){const[o,h]=l.useState([]),[r,a]=l.useState(u),[s,i]=l.useState(null),[c,x]=l.useState(""),d=()=>n.get("/partners").then(h);l.useEffect(()=>{d()},[]);const b=t=>{i(t.id),a({name:t.name,logo_path:t.logo_path||"",sort_order:t.sort_order})},m=()=>{i(null),a(u)},p=async t=>{t.preventDefault(),x("");try{s?await n.put(`/partners/${s}`,r):await n.post("/partners",r),m(),d()}catch(j){x(j.message)}},g=async t=>{confirm("Partner wirklich löschen?")&&(await n.delete(`/partners/${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-4 text-xl font-bold text-neutral-900 dark:text-white",children:"Partner"}),e.jsx("p",{className:"mb-4 text-sm text-neutral-500 dark:text-neutral-400",children:"Die Marken-Logozeile auf der Startseite. Ohne Logo wird der Name als Text angezeigt."}),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:"Logo"}),e.jsx("th",{className:"px-4 py-2",children:"Name"}),e.jsx("th",{className:"px-4 py-2",children:"Sortierung"}),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:[o.map(t=>e.jsxs("tr",{className:"bg-white dark:bg-neutral-950",children:[e.jsx("td",{className:"px-4 py-2",children:t.logo_path?e.jsx("img",{src:t.logo_path,alt:"",className:"h-10 w-10 rounded-md object-contain"}):e.jsx("span",{className:"flex h-10 w-10 items-center justify-center rounded-md bg-neutral-100 text-xs text-neutral-400 dark:bg-neutral-800",children:"–"})}),e.jsx("td",{className:"px-4 py-2 font-medium text-neutral-800 dark:text-neutral-100",children:t.name}),e.jsx("td",{className:"px-4 py-2",children:t.sort_order}),e.jsxs("td",{className:"px-4 py-2 text-right",children:[e.jsx("button",{onClick:()=>b(t),className:"mr-3 text-brand-600 hover:underline",children:"Bearbeiten"}),e.jsx("button",{onClick:()=>g(t.id),className:"text-red-600 hover:underline",children:"Löschen"})]})]},t.id)),o.length===0&&e.jsx("tr",{children:e.jsx("td",{colSpan:4,className:"px-4 py-6 text-center text-neutral-400",children:"Noch keine Partner angelegt."})})]})]})})]}),e.jsxs("form",{onSubmit:p,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:s?"Partner bearbeiten":"Neuer Partner"}),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.jsx(N,{value:r.logo_path,onChange:t=>a({...r,logo_path:t}),label:"Logo (optional)"}),e.jsxs("div",{children:[e.jsx("label",{className:"mb-1 block text-sm font-medium text-neutral-700 dark:text-neutral-300",children:"Sortierung"}),e.jsx("input",{type:"number",value:r.sort_order,onChange:t=>a({...r,sort_order:Number(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"})]}),c&&e.jsx("p",{className:"text-sm text-red-600",children:c}),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:s?"Speichern":"Anlegen"}),s&&e.jsx("button",{type:"button",onClick:m,className:"rounded-md border border-neutral-300 px-4 py-2 text-sm dark:border-neutral-700",children:"Abbrechen"})]})]})]})}export{y as default};
|
||||||
1
hifi/assets/PermissionGroups-Dj1eCZ_1.js
Normal file
1
hifi/assets/PermissionGroups-Dj1eCZ_1.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{r as n,j as e,a as i}from"./index-CA8nTsDv.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};
|
||||||
1
hifi/assets/ResetSettings-FyPtzEXN.js
Normal file
1
hifi/assets/ResetSettings-FyPtzEXN.js
Normal file
File diff suppressed because one or more lines are too long
154
hifi/assets/RichTextEditor-AMyLKCg7.js
Normal file
154
hifi/assets/RichTextEditor-AMyLKCg7.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/Services-CYRt7nkD.js
Normal file
1
hifi/assets/Services-CYRt7nkD.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/SettingsLayout-D9TLUu2J.js
Normal file
1
hifi/assets/SettingsLayout-D9TLUu2J.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{b as l,j as t,k as i,r,O as m}from"./index-CA8nTsDv.js";const o=[{to:"/admin/settings/website",label:"Website"},{to:"/admin/settings/legal",label:"Rechtstexte"},{to:"/admin/settings/email",label:"E-Mail"},{to:"/admin/settings/database",label:"Datenbank"},{to:"/admin/settings/export-import",label:"Export & Import"},{to:"/admin/settings/maintenance",label:"Wartungsmodus"},{to:"/admin/settings/update",label:"Updates",permission:"system.update"},{to:"/admin/settings/reset",label:"Zurücksetzen"}];function u(){const{hasPermission:s}=l(),a=o.filter(e=>!e.permission||s(e.permission)),n=({isActive:e})=>`rounded-md px-4 py-2 text-sm font-medium transition ${e?"bg-brand-500 text-white":"text-neutral-600 hover:bg-neutral-100 dark:text-neutral-300 dark:hover:bg-neutral-800"}`;return t.jsxs("div",{children:[t.jsx("h1",{className:"mb-1 text-xl font-bold text-neutral-900 dark:text-white",children:"Einstellungen"}),t.jsx("p",{className:"mb-5 text-sm text-neutral-500 dark:text-neutral-400",children:"Werkzeuge rund um Datenbank, Server-Umzug und Zurücksetzen dieser Seite."}),t.jsx("nav",{className:"mb-6 flex flex-wrap gap-2",children:a.map(e=>t.jsx(i,{to:e.to,className:n,children:e.label},e.to))}),t.jsx(r.Suspense,{fallback:t.jsx("p",{className:"text-sm text-neutral-400",children:"Lädt…"}),children:t.jsx(m,{})})]})}export{u as default};
|
||||||
1
hifi/assets/SetupWizard-BhmlGYjq.js
Normal file
1
hifi/assets/SetupWizard-BhmlGYjq.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/TextStyleWidget-BJ8A0Q5H.js
Normal file
1
hifi/assets/TextStyleWidget-BJ8A0Q5H.js
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
import{h as g,r as l,a as x,j as t}from"./index-CA8nTsDv.js";const h=[{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:h.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};
|
||||||
1
hifi/assets/UpdateSettings-DgFhzAXU.js
Normal file
1
hifi/assets/UpdateSettings-DgFhzAXU.js
Normal file
File diff suppressed because one or more lines are too long
1
hifi/assets/WebsiteSettings-CUqt2H1_.js
Normal file
1
hifi/assets/WebsiteSettings-CUqt2H1_.js
Normal file
File diff suppressed because one or more lines are too long
BIN
hifi/assets/barlow-condensed-latin-500-normal-BgYH2mbd.woff2
Normal file
BIN
hifi/assets/barlow-condensed-latin-500-normal-BgYH2mbd.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-500-normal-HIEiP5Ov.woff
Normal file
BIN
hifi/assets/barlow-condensed-latin-500-normal-HIEiP5Ov.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-600-normal-BFJEwTuo.woff
Normal file
BIN
hifi/assets/barlow-condensed-latin-600-normal-BFJEwTuo.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-600-normal-DepVgxBB.woff2
Normal file
BIN
hifi/assets/barlow-condensed-latin-600-normal-DepVgxBB.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-ext-500-normal-B1RE8WP7.woff
Normal file
BIN
hifi/assets/barlow-condensed-latin-ext-500-normal-B1RE8WP7.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-ext-500-normal-yA5ONLQ9.woff2
Normal file
BIN
hifi/assets/barlow-condensed-latin-ext-500-normal-yA5ONLQ9.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-ext-600-normal-18ESti3H.woff2
Normal file
BIN
hifi/assets/barlow-condensed-latin-ext-600-normal-18ESti3H.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-latin-ext-600-normal-Clv9cIcR.woff
Normal file
BIN
hifi/assets/barlow-condensed-latin-ext-600-normal-Clv9cIcR.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-condensed-vietnamese-500-normal-CsrJDWc5.woff
Normal file
BIN
hifi/assets/barlow-condensed-vietnamese-500-normal-CsrJDWc5.woff
Normal file
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
hifi/assets/barlow-condensed-vietnamese-600-normal-CNlPk46_.woff
Normal file
BIN
hifi/assets/barlow-condensed-vietnamese-600-normal-CNlPk46_.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-400-normal-fsAxiSwU.woff
Normal file
BIN
hifi/assets/barlow-latin-400-normal-fsAxiSwU.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-400-normal-qiz4-Cze.woff2
Normal file
BIN
hifi/assets/barlow-latin-400-normal-qiz4-Cze.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-500-normal-BPAOfeC8.woff2
Normal file
BIN
hifi/assets/barlow-latin-500-normal-BPAOfeC8.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-500-normal-C1h8hMer.woff
Normal file
BIN
hifi/assets/barlow-latin-500-normal-C1h8hMer.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-600-normal-CNwfPWQD.woff
Normal file
BIN
hifi/assets/barlow-latin-600-normal-CNwfPWQD.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-600-normal-DILqtrty.woff2
Normal file
BIN
hifi/assets/barlow-latin-600-normal-DILqtrty.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-700-normal-A9pxMQ4z.woff2
Normal file
BIN
hifi/assets/barlow-latin-700-normal-A9pxMQ4z.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-700-normal-__SGTsZ1.woff
Normal file
BIN
hifi/assets/barlow-latin-700-normal-__SGTsZ1.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-ext-400-normal-CvBsJvxq.woff
Normal file
BIN
hifi/assets/barlow-latin-ext-400-normal-CvBsJvxq.woff
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-ext-400-normal-HxX4XjxC.woff2
Normal file
BIN
hifi/assets/barlow-latin-ext-400-normal-HxX4XjxC.woff2
Normal file
Binary file not shown.
BIN
hifi/assets/barlow-latin-ext-500-normal-CJPcKP2Q.woff
Normal file
BIN
hifi/assets/barlow-latin-ext-500-normal-CJPcKP2Q.woff
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue