feat: implement device-specific configurations for desktop, tablet, and mobile
All checks were successful
Production Build & Deploy / build-and-deploy (push) Successful in 57s

This commit is contained in:
Daniel S
2026-08-09 12:35:46 +02:00
parent eb4bb601d7
commit b159b061ae
14 changed files with 61 additions and 21 deletions

View File

@@ -1,6 +1,6 @@
import fs from 'fs';
import path from 'path';
import { detectDeviceType } from './deviceDetect';
export interface UIComponent {
id: string; // Eindeutige ID (z.B. uuid / timestamp)
slotId: string; // Platz-ID (z.B. 'hero-badge-slot', 'hero-actions-slot', 'bento-slot-1')
@@ -206,11 +206,20 @@ function readJsonFile<T>(filePath: string, fallback: T): T {
}
}
export function loadWaasConfigs() {
export function loadWaasConfigs(userAgent: string = '') {
const dataDir = process.env.DATA_DIR || path.join(process.cwd(), 'app', 'data');
const sitePath = path.join(dataDir, 'site.config.json');
const themePath = path.join(dataDir, 'theme.config.json');
const smtpPath = path.join(dataDir, 'smtp.config.json');
const device = detectDeviceType(userAgent);
const deviceSitePath = path.join(dataDir, `site.${device}.config.json`);
const genericSitePath = path.join(dataDir, 'site.config.json');
const sitePath = fs.existsSync(deviceSitePath) ? deviceSitePath : genericSitePath;
const deviceThemePath = path.join(dataDir, `theme.${device}.config.json`);
const genericThemePath = path.join(dataDir, 'theme.config.json');
const themePath = fs.existsSync(deviceThemePath) ? deviceThemePath : genericThemePath;
const deviceSmtpPath = path.join(dataDir, `smtp.${device}.config.json`);
const genericSmtpPath = path.join(dataDir, 'smtp.config.json');
const smtpPath = fs.existsSync(deviceSmtpPath) ? deviceSmtpPath : genericSmtpPath;
const rawSite = readJsonFile<Partial<SiteConfig>>(sitePath, FALLBACK_SITE_CONFIG);
const siteConfig: SiteConfig = {