feat: complete editorial overhaul with CMS dynamic labels
Centralized UI labels in Directus, integrated AI Chat and Status into Bento grid, created standalone Books page, and redesigned project sub-pages for consistent high-end aesthetic.
This commit is contained in:
@@ -91,54 +91,34 @@ async function directusRequest<T>(
|
||||
}
|
||||
}
|
||||
|
||||
export async function getMessage(key: string, locale: string): Promise<string | null> {
|
||||
// Note: messages collection doesn't exist in Directus yet
|
||||
// The app uses JSON files as fallback via i18n-loader
|
||||
// Return null to skip Directus and use JSON fallback directly
|
||||
return null;
|
||||
|
||||
/* Commented out until messages collection is created in Directus
|
||||
export async function getMessages(locale: string): Promise<Record<string, string>> {
|
||||
const directusLocale = toDirectusLocale(locale);
|
||||
|
||||
// GraphQL Query für Directus Native Translations
|
||||
// Hole alle translations, filter client-side da GraphQL filter komplex ist
|
||||
const query = `
|
||||
query {
|
||||
messages(filter: {key: {_eq: "${key}"}}, limit: 1) {
|
||||
messages {
|
||||
key
|
||||
translations {
|
||||
value
|
||||
languages_code {
|
||||
code
|
||||
}
|
||||
languages_code { code }
|
||||
}
|
||||
}
|
||||
}
|
||||
`;
|
||||
|
||||
try {
|
||||
const result = await directusRequest(
|
||||
'',
|
||||
{ body: { query } }
|
||||
);
|
||||
const result = await directusRequest('', { body: { query } });
|
||||
const messages = (result as any)?.messages || [];
|
||||
const dictionary: Record<string, string> = {};
|
||||
|
||||
const messages = (result as any)?.messages;
|
||||
if (!messages || messages.length === 0) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// Hole die Translation für die gewünschte Locale (client-side filter)
|
||||
const translations = messages[0]?.translations || [];
|
||||
const translation = translations.find((t: any) =>
|
||||
t.languages_code?.code === directusLocale
|
||||
);
|
||||
|
||||
return translation?.value || null;
|
||||
messages.forEach((m: any) => {
|
||||
const trans = m.translations?.find((t: any) => t.languages_code?.code === directusLocale);
|
||||
if (trans?.value) dictionary[m.key] = trans.value;
|
||||
});
|
||||
|
||||
return dictionary;
|
||||
} catch (error) {
|
||||
console.error(`Failed to fetch message ${key} (${locale}):`, error);
|
||||
return null;
|
||||
return {};
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
export async function getContentPage(
|
||||
|
||||
Reference in New Issue
Block a user