diff --git a/app/data/site.config.json b/app/data/site.config.json index d225c69..a9ab874 100644 --- a/app/data/site.config.json +++ b/app/data/site.config.json @@ -52,9 +52,43 @@ "title": "Bereit für Ihr Projekt?", "subtitle": "Schreiben Sie uns direkt. Wir antworten innerhalb von 24 Stunden persönlich." } + }, + { + "id": "sec_bentogrid_1786313652833", + "type": "BentoGrid", + "settings": { + "sectionTitle": "Unsere Highlights", + "sectionSubtitle": "Modernste Features im Überblick" + } + }, + { + "id": "sec_herosection_1786313653735", + "type": "HeroSection", + "settings": { + "title": "Neue Überschrift", + "subtitle": "Beschreibungstext hier eingeben.", + "ctaPrimaryText": "Jetzt anfragen", + "ctaPrimaryLink": "#contact" + } + }, + { + "id": "sec_contactsection_1786313654351", + "type": "ContactSection", + "settings": { + "title": "Kontaktieren Sie uns", + "subtitle": "Wir antworten innerhalb von 24 Stunden." + } + }, + { + "id": "sec_bentogrid_1786313698683", + "type": "BentoGrid", + "settings": { + "sectionTitle": "Unsere Highlights", + "sectionSubtitle": "Modernste Features im Überblick" + } } ] } ], - "updated_at": "2026-08-09T22:08:57.203Z" + "updated_at": "2026-08-09T22:16:29.073Z" } \ No newline at end of file diff --git a/app/data/waas.db b/app/data/waas.db index 947edab..6fb3f45 100644 Binary files a/app/data/waas.db and b/app/data/waas.db differ diff --git a/src/pages/api/editor/add-section.ts b/src/pages/api/editor/add-section.ts index 88233e8..ba2882f 100644 --- a/src/pages/api/editor/add-section.ts +++ b/src/pages/api/editor/add-section.ts @@ -53,6 +53,7 @@ export const POST: APIRoute = async ({ request }) => { return new Response(JSON.stringify({ success: true, section_id: secId }), { status: 201 }); } catch (error) { + console.error('[API /api/editor/add-section] Exception:', error); return new Response(JSON.stringify({ error: 'Fehler beim Hinzufügen der Sektion' }), { status: 500 }); } }; diff --git a/src/pages/api/editor/delete-section.ts b/src/pages/api/editor/delete-section.ts index 70b8046..43dd2b2 100644 --- a/src/pages/api/editor/delete-section.ts +++ b/src/pages/api/editor/delete-section.ts @@ -20,6 +20,7 @@ export const POST: APIRoute = async ({ request }) => { return new Response(JSON.stringify({ success: true, message: 'Sektion gelöscht' }), { status: 200 }); } catch (error) { + console.error('[API /api/editor/delete-section] Exception:', error); return new Response(JSON.stringify({ error: 'Fehler beim Löschen der Sektion' }), { status: 500 }); } }; diff --git a/src/pages/api/editor/update-section-settings.ts b/src/pages/api/editor/update-section-settings.ts index c57b7e9..01010a3 100644 --- a/src/pages/api/editor/update-section-settings.ts +++ b/src/pages/api/editor/update-section-settings.ts @@ -50,6 +50,7 @@ export const POST: APIRoute = async ({ request }) => { return new Response(JSON.stringify({ success: true, settings: { ...updatedDraft, ...updatedStyles } }), { status: 200 }); } catch (error) { + console.error('[API /api/editor/update-section-settings] Exception:', error); return new Response(JSON.stringify({ error: 'Fehler beim Aktualisieren der Sektions-Einstellungen' }), { status: 500 }); } }; diff --git a/src/pages/api/editor/update-section.ts b/src/pages/api/editor/update-section.ts index a9f1803..f92501c 100644 --- a/src/pages/api/editor/update-section.ts +++ b/src/pages/api/editor/update-section.ts @@ -28,6 +28,7 @@ export const POST: APIRoute = async ({ request }) => { { status: 200 } ); } catch (error) { + console.error('[API /api/editor/update-section] Exception:', error); return new Response(JSON.stringify({ error: 'Fehler beim Aktualisieren der Sektionen' }), { status: 500 }); } }; diff --git a/src/utils/configLoader.ts b/src/utils/configLoader.ts index 4bf0572..de0485d 100644 --- a/src/utils/configLoader.ts +++ b/src/utils/configLoader.ts @@ -1,6 +1,7 @@ import fs from 'fs'; import path from 'path'; import { detectDeviceType } from './deviceDetect'; +import { getDb } from '../db/index'; 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') @@ -283,7 +284,29 @@ export function loadWaasConfigs(userAgent: string = '', isDraft: boolean = false const genericSitePath = path.join(dataDir, 'site.config.json'); let sitePath = genericSitePath; - if (isDraft && fs.existsSync(draftSitePath)) { + if (isDraft) { + if (!fs.existsSync(draftSitePath)) { + try { + const db = getDb(); + const settingsRow = db.prepare('SELECT value_json FROM site_settings WHERE key = ?').get('site_config') as { value_json: string } | undefined; + const baseConfig = settingsRow ? JSON.parse(settingsRow.value_json) : {}; + const pagesRows = db.prepare('SELECT * FROM pages ORDER BY created_at ASC').all() as any[]; + const pages = pagesRows.map((page) => { + const sectionsRows = db.prepare('SELECT * FROM page_sections WHERE page_id = ? ORDER BY order_index ASC').all(page.id) as any[]; + const sections = sectionsRows.map((sec) => ({ + id: sec.id, + type: sec.section_type, + settings: { ...JSON.parse(sec.content_draft_json || '{}'), ...JSON.parse(sec.styles_json || '{}') } + })); + return { id: page.id, slug: page.slug, title: page.title, is_published: page.status === 'published', sections }; + }); + const fullDraftConfig = { ...baseConfig, pages, updated_at: new Date().toISOString() }; + fs.mkdirSync(dataDir, { recursive: true }); + fs.writeFileSync(draftSitePath, JSON.stringify(fullDraftConfig, null, 2), 'utf-8'); + } catch (e) { + console.warn('[WaaS ConfigLoader] Fallback draft compilation warning:', e); + } + } sitePath = draftSitePath; } else if (fs.existsSync(deviceSitePath)) { sitePath = deviceSitePath;