From dfa357bbd16171451f415026c8ac6028b4d5b7fa Mon Sep 17 00:00:00 2001 From: Daniel S Date: Sat, 8 Aug 2026 18:56:18 +0200 Subject: [PATCH] feat(waas-engine): add dynamic site config schema and slotId placement types --- app/data/site.config.json | 104 +++++++++++++++++ app/data/smtp.config.json | 10 ++ app/data/theme.config.json | 7 ++ data_template/site.config.json | 63 ++++++++++ data_template/smtp.config.json | 10 ++ data_template/theme.config.json | 7 ++ src/utils/configLoader.ts | 199 ++++++++++++++++++++++++++++++++ src/utils/themePresets.ts | 124 ++++++++++++++++++++ 8 files changed, 524 insertions(+) create mode 100644 app/data/site.config.json create mode 100644 app/data/smtp.config.json create mode 100644 app/data/theme.config.json create mode 100644 data_template/site.config.json create mode 100644 data_template/smtp.config.json create mode 100644 data_template/theme.config.json create mode 100644 src/utils/configLoader.ts create mode 100644 src/utils/themePresets.ts diff --git a/app/data/site.config.json b/app/data/site.config.json new file mode 100644 index 0000000..0eab3a3 --- /dev/null +++ b/app/data/site.config.json @@ -0,0 +1,104 @@ +{ + "siteName": "N&D IT Solutions", + "metaDescription": "High-Performance Webdesign & Digital Solutions - 100% DSGVO-konform.", + "hero": { + "badge": "⚡ WaaS Enterprise Baukastensystem", + "title": "Maßgeschneiderte Webseiten. Digital im Griff.", + "subtitle": "Wir entwickeln blitzschnelle, DSGVO-konforme High-End Webseiten für Ihr Unternehmen zum monatlichen Festpreis – inklusive Wartung & Hosting.", + "ctaPrimaryText": "Projekt anfragen", + "ctaPrimaryLink": "#contact", + "ctaSecondaryText": "Mehr erfahren", + "ctaSecondaryLink": "#services", + "elements": [ + { + "id": "el-1", + "type": "badge", + "content": "š WaaS Engine" + }, + { + "id": "el-2", + "type": "button", + "content": "Neuer Button", + "link": "#contact", + "animation0": "spring-fade", + "style": "primary" + } + ] + }, + "bento": { + "sectionTitle": "High-End Features & Leistung", + "sectionSubtitle": "Modernste Technologie & Höchster Datenschutz vereint.", + "cards": [ + { + "id": "card-1", + "title": "Ultra Fast SSR", + "description": "Sub-100ms Ladezeiten dank Astro Hybrid SSR Architecture. Google Core Web Vitals > 95%.", + "colSpan": 2, + "badge": "Performance", + "icon": "zap" + }, + { + "id": "card-2", + "title": "100% DSGVO-Sicher", + "description": "Keine Cookies, keine Tracking-Skripte, Zero Third-Party Requests.", + "colSpan": 1, + "badge": "Datenschutz", + "icon": "shield" + }, + { + "id": "card-3", + "title": "Liquid Glass UI", + "description": "Moderne Ästhetik mit matte Boxen, Aurora Glows und physischen Kanten-Effekten.", + "colSpan": 1, + "badge": "Design", + "icon": "layers" + }, + { + "id": "card-4", + "title": "Sorgenfrei-Paket", + "description": "Hosting, SSL, Wartung und regelmäßige Inhalts-Updates komplett inklusive.", + "colSpan": 2, + "badge": "Full-Service", + "icon": "check" + } + ] + }, + "contact": { + "title": "Bereit für Ihr Projekt?", + "subtitle": "Schreiben Sie uns direkt. Wir antworten innerhalb von 24 Stunden persönlich.", + "recipientEmail": "kontakt@ndsolutions.de", + "phone": "+49 (0) 123 456789", + "address": "Deutschland" + }, + "sectionsOrder": [ + "hero", + "bento", + "contact" + ], + "sectionsDetails": [ + { + "id": "hero", + "type": "hero", + "title": "Hero Sektion", + "elements": [ + { + "id": "el-1", + "type": "badge", + "content": "š WaaS Engine" + } + ] + }, + { + "id": "bento", + "type": "bento", + "title": "Bento Grid", + "elements": [] + }, + { + "id": "contact", + "type": "contact", + "title": "Contact Section", + "elements": [] + } + ] +} \ No newline at end of file diff --git a/app/data/smtp.config.json b/app/data/smtp.config.json new file mode 100644 index 0000000..3026752 --- /dev/null +++ b/app/data/smtp.config.json @@ -0,0 +1,10 @@ +{ + "host": "smtp.placeholder.local", + "port": 587, + "secure": false, + "user": "placeholder@domain.de", + "pass": "****", + "fromName": "N&D IT Solutions System", + "fromEmail": "noreply@ndsolutions.de", + "isConfigured": false +} \ No newline at end of file diff --git a/app/data/theme.config.json b/app/data/theme.config.json new file mode 100644 index 0000000..dde2770 --- /dev/null +++ b/app/data/theme.config.json @@ -0,0 +1,7 @@ +{ + "activePreset": "sunsetCoral", + "customColors": { + "bg": "#0B0F19", + "accent": "#38BDF8" + } +} \ No newline at end of file diff --git a/data_template/site.config.json b/data_template/site.config.json new file mode 100644 index 0000000..a5ae14d --- /dev/null +++ b/data_template/site.config.json @@ -0,0 +1,63 @@ +{ + "siteName": "N&D IT Solutions", + "metaDescription": "High-Performance Webdesign & Digital Solutions - 100% DSGVO-konform.", + "hero": { + "badge": "⚡ WaaS Enterprise Baukastensystem", + "title": "Maßgeschneiderte Webseiten. Digital im Griff.", + "subtitle": "Wir entwickeln blitzschnelle, DSGVO-konforme High-End Webseiten für Ihr Unternehmen zum monatlichen Festpreis – inklusive Wartung & Hosting.", + "ctaPrimaryText": "Projekt anfragen", + "ctaPrimaryLink": "#contact", + "ctaSecondaryText": "Mehr erfahren", + "ctaSecondaryLink": "#services" + }, + "bento": { + "sectionTitle": "High-End Features & Leistung", + "sectionSubtitle": "Modernste Technologie & Höchster Datenschutz vereint.", + "cards": [ + { + "id": "card-1", + "title": "Ultra Fast SSR", + "description": "Sub-100ms Ladezeiten dank Astro Hybrid SSR Architecture. Google Core Web Vitals > 95%.", + "colSpan": 2, + "badge": "Performance", + "icon": "zap" + }, + { + "id": "card-2", + "title": "100% DSGVO-Sicher", + "description": "Keine Cookies, keine Tracking-Skripte, Zero Third-Party Requests.", + "colSpan": 1, + "badge": "Datenschutz", + "icon": "shield" + }, + { + "id": "card-3", + "title": "Liquid Glass UI", + "description": "Moderne Ästhetik mit matte Boxen, Aurora Glows und physischen Kanten-Effekten.", + "colSpan": 1, + "badge": "Design", + "icon": "layers" + }, + { + "id": "card-4", + "title": "Sorgenfrei-Paket", + "description": "Hosting, SSL, Wartung und regelmäßige Inhalts-Updates komplett inklusive.", + "colSpan": 2, + "badge": "Full-Service", + "icon": "check" + } + ] + }, + "contact": { + "title": "Bereit für Ihr Projekt?", + "subtitle": "Schreiben Sie uns direkt. Wir antworten innerhalb von 24 Stunden persönlich.", + "recipientEmail": "kontakt@ndsolutions.de", + "phone": "+49 (0) 123 456789", + "address": "Deutschland" + }, + "sectionsOrder": [ + "hero", + "bento", + "contact" + ] +} \ No newline at end of file diff --git a/data_template/smtp.config.json b/data_template/smtp.config.json new file mode 100644 index 0000000..3026752 --- /dev/null +++ b/data_template/smtp.config.json @@ -0,0 +1,10 @@ +{ + "host": "smtp.placeholder.local", + "port": 587, + "secure": false, + "user": "placeholder@domain.de", + "pass": "****", + "fromName": "N&D IT Solutions System", + "fromEmail": "noreply@ndsolutions.de", + "isConfigured": false +} \ No newline at end of file diff --git a/data_template/theme.config.json b/data_template/theme.config.json new file mode 100644 index 0000000..d3ee68d --- /dev/null +++ b/data_template/theme.config.json @@ -0,0 +1,7 @@ +{ + "activePreset": "corporateDark", + "customColors": { + "bg": "#0B0F19", + "accent": "#38BDF8" + } +} \ No newline at end of file diff --git a/src/utils/configLoader.ts b/src/utils/configLoader.ts new file mode 100644 index 0000000..5bd187f --- /dev/null +++ b/src/utils/configLoader.ts @@ -0,0 +1,199 @@ +import fs from 'fs'; +import path from 'path'; + +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') + orderIndex?: number; // Position / Reihenfolge auf dem Platz + type: 'button' | 'badge' | 'text' | 'card' | 'accordion' | 'stat-box' | 'testimonial' | 'cta-box'; + content: string; + link?: string; + animation0?: string; // e.g. 'spring-fade', 'hover-bounce', 'pulse-glow' + style?: 'primary' | 'secondary' | 'outline' | 'glass'; +} + +export interface SectionConfig { + id: string; + type: 'hero' | 'bento' | 'contact' | 'custom'; + title?: string; + subtitle?: string; + badge?: string; + elements?: UIComponent[]; +} + +export interface SiteConfig { + siteName: string; + metaDescription: string; + hero: { + badge: string; + title: string; + subtitle: string; + ctaPrimaryText: string; + ctaPrimaryLink: string; + ctaSecondaryText: string; + ctaSecondaryLink: string; + elements?: UIComponent[]; + }; + bento: { + sectionTitle: string; + sectionSubtitle: string; + cards: Array<{ + id: string; + title: string; + description: string; + colSpan?: number; + badge?: string; + icon?: string; + }>; + }; + contact: { + title: string; + subtitle: string; + recipientEmail: string; + phone?: string; + address?: string; + }; + sectionsOrder: string[]; + sectionsDetails?: SectionConfig[]; +} + +export interface ThemeConfig { + activePreset: string; + customColors?: { + bg?: string; + accent?: string; + }; +} + +export interface SmtpConfig { + host: string; + port: number; + secure: boolean; + user: string; + pass: string; + fromName: string; + fromEmail: string; + isConfigured: boolean; +} + +export const FALLBACK_SITE_CONFIG: SiteConfig = { + siteName: 'N&D IT Solutions', + metaDescription: 'High-Performance Webdesign & Digital Solutions - 100% DSGVO-konform.', + hero: { + badge: 'š Waas Enterprise Baukastensystem', + title: 'Maßgeschneiderte Webseiten. Digital im Griff.', + subtitle: 'Wir entwickeln blitzschnelle, DSGVO-konforme High-End Webseiten für Ihr Unternehmen zum monatlichen Festpreis – inklusive Wartung & Hosting.', + ctaPrimaryText: 'Projekt anfragen', + ctaPrimaryLink: '#contact', + ctaSecondaryText: 'Mehr erfahren', + ctaSecondaryLink: '#services', + elements: [ + { id: 'el-1', type: 'badge', content: 'š WaaS Engine' }, + { id: 'el-2', type: 'button', content: 'Neuer Button', link: '#contact', animation0: 'spring-fade', style: 'primary' } + ] + }, + bento: { + sectionTitle: 'High-End Features & Leistung', + sectionSubtitle: 'Modernste Technologie & Höchster Datenschutz vereint.', + cards: [ + { + id: 'card-1', + title: 'Ultra Fast SSR', + description: 'Sub-100ms Ladezeiten dank Astro Hybrid SSR Architecture. Google Core Web Vitals > 95%.', + colSpan: 2, + badge: 'Performance', + icon: 'zap' + }, + { + id: 'card-2', + title: '100% DSGVO-Sicher', + description: 'Keine Cookies, keine Tracking-Skripte, Zero Third-Party Requests.', + colSpan: 1, + badge: 'Datenschutz', + icon: 'shield' + }, + { + id: 'card-3', + title: 'Liquid Glass UI', + description: 'Moderne � sthetik mit matte Boxen, Aurora Glows und physikalischen Kanten-Effekten.', + colSpan: 1, + badge: 'Design', + icon: 'layers' + }, + { + id: 'card-4', + title: 'Sorgenfrei-Paket', + description: 'Hosting, SSL, Wartung und regelmäßige Inhalts-Updates komplett inklusive.', + colSpan: 2, + badge: 'Full-Service', + icon: 'check' + } + ] + }, + contact: { + title: 'Bereit für Ihr Projekt?', + subtitle: 'Schreiben Sie uns direkt. Wir antworten innerhalb von 24 Stunden persúnlich.', + recipientEmail: 'kontakt@ndsolutions.de', + phone: '+49 (0) 123 456789', + address: 'Deutschland' + }, + sectionsOrder: ['hero', 'bento', 'contact'], + sectionsDetails: [ + { id: 'hero', type: 'hero', title: 'Hero Sektion', elements: [ {id: 'el-1', type: 'badge', content: 'š WaaS Engine' } ] }, + { id: 'bento', type: 'bento', title: 'Bento Grid', elements: [] }, + { id: 'contact', type: 'contact', title: 'Contact Section', elements: [] } + ] +}; + +export const FALLBACK_THEME_CONFIG: ThemeConfig = { + activePreset: 'corporateDark' +}; + +export const FALLBACK_SMTP_CONFIG: SmtpConfig = { + host: 'smtp.placeholder.local', + port: 587, + secure: false, + user: 'placeholder@domain.de', + pass: '****', + fromName: 'N&D IT Solutions System', + fromEmail: 'noreply@ndsolutions.de', + isConfigured: false +}; + +function readJsonFile(filePath: string, fallback: T): T { + try { + if (!fs.existsSync(filePath)) { + return fallback; + } + const content = fs.readFileSync(filePath, 'utf-8'); + if (!content.trim()) { + return fallback; + } + const parsed = JSON.parse(content); + return { ...fallback, ...parsed }; + } catch (error) { + console.warn(`[WaaS ConfigLoader] Warning loading ${filePath}, using fallback defaults.`, error); + return fallback; + } +} + +export function loadWaasConfigs() { + 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 rawSite = readJsonFile>(sitePath, FALLBACK_SITE_CONFIG); + const siteConfig: SiteConfig = { + ...FALLBACK_SITE_CONFIG, + ...rawSite, + hero: { ...FALLBACK_SITE_CONFIG.hero, ...(rawSite.hero || {}) }, + bento: { ...FALLBACK_SITE_CONFIG.bento, ...(rawSite.bento || {}) }, + contact: { ...FALLBACK_SITE_CONFIG.contact, ...(rawSite.contact || {}) } + }; + + const themeConfig = readJsonFile(themePath, FALLBACK_THEME_CONFIG); + const smtpConfig = readJsonFile(smtpPath, FALLBACK_SMTP_CONFIG); + + return { siteConfig, themeConfig, smtpConfig }; +} diff --git a/src/utils/themePresets.ts b/src/utils/themePresets.ts new file mode 100644 index 0000000..4f2471e --- /dev/null +++ b/src/utils/themePresets.ts @@ -0,0 +1,124 @@ +export interface ThemePreset { + id: string; + name: string; + colors: { + bg: string; + cardBg: string; + text: string; + accent: string; + border: string; + }; +} + +export const THEME_PRESETS: Record = { + corporateDark: { + id: 'corporateDark', + name: 'Corporate Dark Mode', + colors: { + bg: '#0B0F19', + cardBg: 'rgba(15, 23, 42, 0.4)', + text: '#F8FAFC', + accent: '#38BDF8', + border: 'rgba(255, 255, 255, 0.1)' + } + }, + cyberNeon: { + id: 'cyberNeon', + name: 'Cyber Neon', + colors: { + bg: '#05050A', + cardBg: 'rgba(10, 10, 25, 0.5)', + text: '#FFFFFF', + accent: '#F43F5E', + border: 'rgba(244, 63, 94, 0.2)' + } + }, + emeraldCraft: { + id: 'emeraldCraft', + name: 'Emerald Craft', + colors: { + bg: '#022C22', + cardBg: 'rgba(6, 78, 59, 0.4)', + text: '#ECFDF5', + accent: '#34D399', + border: 'rgba(52, 211, 153, 0.2)' + } + }, + royalViolet: { + id: 'royalViolet', + name: 'Royal Violet', + colors: { + bg: '#0F0728', + cardBg: 'rgba(30, 15, 65, 0.4)', + text: '#FAF5FF', + accent: '#A855F7', + border: 'rgba(168, 85, 247, 0.2)' + } + }, + midnightBlue: { + id: 'midnightBlue', + name: 'Midnight Blue', + colors: { + bg: '#030712', + cardBg: 'rgba(17, 24, 39, 0.5)', + text: '#F9FAFB', + accent: '#60A5FA', + border: 'rgba(96, 165, 250, 0.2)' + } + }, + amberGlow: { + id: 'amberGlow', + name: 'Amber Glow', + colors: { + bg: '#180E02', + cardBg: 'rgba(45, 26, 8, 0.5)', + text: '#FFFBEB', + accent: '#F59E0B', + border: 'rgba(245, 158, 11, 0.2)' + } + }, + monochromeMinimal: { + id: 'monochromeMinimal', + name: 'Monochrome Minimal', + colors: { + bg: '#121212', + cardBg: 'rgba(255, 255, 255, 0.05)', + text: '#E0E0E0', + accent: '#FFFFFF', + border: 'rgba(255, 255, 255, 0.15)' + } + }, + arcticFrost: { + id: 'arcticFrost', + name: 'Arctic Frost', + colors: { + bg: '#0B132B', + cardBg: 'rgba(28, 37, 65, 0.4)', + text: '#E0FBFC', + accent: '#70E000', + border: 'rgba(112, 224, 0, 0.2)' + } + }, + sunsetCoral: { + id: 'sunsetCoral', + name: 'Sunset Coral', + colors: { + bg: '#1C0A10', + cardBg: 'rgba(50, 15, 28, 0.4)', + text: '#FFF1F2', + accent: '#FB7185', + border: 'rgba(251, 113, 133, 0.2)' + } + }, + titaniumSteel: { + id: 'titaniumSteel', + name: 'Titanium Steel', + colors: { + bg: '#18181B', + cardBg: 'rgba(39, 39, 42, 0.5)', + text: '#F4F4F5', + accent: '#A1A1AA', + border: 'rgba(161, 161, 170, 0.2)' + } + } +};