feat: ultimate dynamic editorial overhaul

Automated CMS content seeding, integrated interactive AI Chat into Bento grid, implemented intelligent idle quote logic, and unified editorial styling across all sub-pages.
This commit is contained in:
2026-02-16 01:18:34 +01:00
parent f5081f8765
commit c3f55c92ed
6 changed files with 239 additions and 407 deletions

View File

@@ -0,0 +1,53 @@
#!/usr/bin/env node
require('dotenv').config();
const DIRECTUS_URL = process.env.DIRECTUS_URL || 'https://cms.dk0.dev';
const DIRECTUS_TOKEN = process.env.DIRECTUS_STATIC_TOKEN;
async function api(endpoint, method = 'POST', body = null) {
const res = await fetch(`${DIRECTUS_URL}/${endpoint}`, {
method,
headers: { 'Authorization': `Bearer ${DIRECTUS_TOKEN}`, 'Content-Type': 'application/json' },
body: body ? JSON.stringify(body) : null
});
const data = await res.json().catch(() => ({}));
return { ok: res.ok, data };
}
async function fixMessagesCollection() {
console.log('🛠 Repariere "messages" Collection...');
// 1. Key-Feld hinzufügen (falls es fehlt)
// Wir nutzen type: string und schema: {} um eine echte Spalte zu erzeugen
const fieldRes = await api('fields/messages', 'POST', {
field: 'key',
type: 'string',
schema: {
is_nullable: false,
is_unique: true
},
meta: {
interface: 'input',
options: { placeholder: 'z.B. hero.title' },
required: true
}
});
if (fieldRes.ok) {
console.log('✅ "key" Feld erfolgreich erstellt.');
} else {
console.log('⚠️ "key" Feld konnte nicht erstellt werden (existiert evtl schon).');
}
// 2. Übersetzungs-Feld in der Untertabelle reparieren
console.log('🛠 Prüfe messages_translations...');
await api('fields/messages_translations', 'POST', {
field: 'value',
type: 'text',
schema: {},
meta: { interface: 'input-multiline' }
}).catch(() => {});
console.log('✅ Fix abgeschlossen! Bitte lade Directus neu.');
}
fixMessagesCollection().catch(console.error);

View File

@@ -0,0 +1,37 @@
#!/usr/bin/env node
require('dotenv').config();
const DIRECTUS_URL = process.env.DIRECTUS_URL || 'https://cms.dk0.dev';
const DIRECTUS_TOKEN = process.env.DIRECTUS_STATIC_TOKEN;
async function api(endpoint, method = 'POST', body = null) {
const res = await fetch(`${DIRECTUS_URL}/${endpoint}`, {
method,
headers: { 'Authorization': `Bearer ${DIRECTUS_TOKEN}`, 'Content-Type': 'application/json' },
body: body ? JSON.stringify(body) : null
});
return res.ok ? await res.json() : { error: true, status: res.status };
}
const seedData = [
{ key: 'hero.badge', de: 'Student & Self-Hoster', en: 'Student & Self-Hoster' },
{ key: 'hero.line1', de: 'Building', en: 'Building' },
{ key: 'hero.line2', de: 'Stuff.', en: 'Stuff.' },
{ key: 'about.quote.idle', de: 'Gerade am Planen des nächsten großen Projekts.', en: 'Currently planning the next big thing.' }
];
async function seedMessages() {
console.log('🌱 Befülle Directus mit Inhalten...');
for (const item of seedData) {
console.log(`- Erstelle Key: ${item.key}`);
const res = await api('items/messages', 'POST', {
key: item.key,
translations: [
{ languages_code: 'de-DE', value: item.de },
{ languages_code: 'en-US', value: item.en }
]
});
}
console.log('✅ CMS erfolgreich befüllt!');
}
seedMessages().catch(console.error);