diff --git a/src/components/RecordModal.jsx b/src/components/RecordModal.jsx index e688000..d84f70d 100644 --- a/src/components/RecordModal.jsx +++ b/src/components/RecordModal.jsx @@ -80,6 +80,20 @@ function EditableField({ fieldKey, value, fieldDef, onChange }) { ); } + if (type === 'boolean') { + return ( + + ); + } + if (type === 'number') { return ( `/words/${id}/categories`, - display: c => c.name_de || c.id, + display: c => c.titel_de || c.id, targetTable: 'categories', linkEndpoint: (id, targetId) => `/words/${id}/categories/${targetId}`, searchEndpoint: '/categories', - searchLabel: c => c.name_de || c.id, + searchLabel: c => c.titel_de || c.id, }, ], }, + pictures: { label: 'Bilder', icon: 'πŸ–ΌοΈ', endpoint: '/pictures', statusField: 'status', primaryLabel: 'design', - columns: ['design', 'status', 'picture_link', 'blurhash', 'created_at'], + columns: ['design', 'status', 'objects_created', 'picture_link', 'blurhash', 'generation_prompt', 'created_at'], linkedFields: {}, heroPanel: { imageField: 'picture_link', @@ -51,10 +52,13 @@ export const TABLES = { quickRelatedKey: 'words', }, editableFields: { - design: { type: 'text' }, - status: { type: 'select', options: ['published', 'blocked', 'uploaded', 'requested', 'generated'] }, - picture_link: { type: 'text' }, - blurhash: { type: 'text' }, + design: { type: 'text' }, + status: { type: 'select', options: ['uploaded', 'published', 'blocked'] }, + picture_link: { type: 'text' }, + blurhash: { type: 'text' }, + generation_prompt:{ type: 'textarea' }, + blocked_reason: { type: 'select', options: ['regenerate', 'not_to_use'] }, + objects_created: { type: 'boolean' }, }, fetchRelated: [ { @@ -69,17 +73,19 @@ export const TABLES = { }, ], }, + objects: { label: 'Objekte', icon: 'πŸ“¦', endpoint: '/objects', statusField: 'status', primaryLabel: 'notes', - columns: ['id', 'status', 'notes', 'created_at'], + columns: ['id', 'status', 'notes', 'blocked_topic', 'created_at'], linkedFields: { word_ids: 'words', picture_ids: 'pictures', pair_ids: 'pairs' }, editableFields: { - notes: { type: 'textarea' }, - status: { type: 'select', options: ['published', 'blocked', 'draft'] }, + notes: { type: 'textarea' }, + blocked_topic:{ type: 'text' }, + status: { type: 'select', options: ['draft', 'published', 'blocked'] }, }, fetchRelated: [ { @@ -104,69 +110,166 @@ export const TABLES = { }, ], }, + pairs: { label: 'Pairs', icon: 'πŸ”—', endpoint: '/pairs', statusField: 'status', primaryLabel: 'id', - columns: ['id', 'answer_type', 'difficulty_level', 'status', 'question_id', 'positive_statement_id', 'created_at'], + columns: ['id', 'answer_type', 'difficulty_level', 'status', 'question_id', 'positive_statement_id', 'negative_statement_id', 'created_at'], linkedFields: { - question_id: 'questions', + question_id: 'questions', positive_statement_id: 'statements', negative_statement_id: 'statements', }, editableFields: { - answer_type: { type: 'select', options: ['word', 'sentence'] }, - difficulty_level:{ type: 'number', min: 1, max: 10 }, - status: { type: 'select', options: ['published', 'blocked', 'draft'] }, + answer_type: { type: 'select', options: ['yes_no', 'text', 'question', 'word'] }, + difficulty_level: { type: 'number', min: 1, max: 50 }, + blocked_topic: { type: 'text' }, + status: { type: 'select', options: ['draft', 'published', 'blocked'] }, }, fetchRelated: [], }, + questions: { label: 'Fragen', icon: '❓', endpoint: '/questions', statusField: 'status', primaryLabel: 'sentence_de', - columns: ['sentence_de', 'sentence_en', 'status', 'created_at'], + columns: ['sentence_de', 'sentence_en', 'sentence_sv', 'status', 'blocked_topic', 'created_at'], linkedFields: {}, editableFields: { - sentence_de: { type: 'textarea' }, - sentence_en: { type: 'textarea' }, - status: { type: 'select', options: ['published', 'blocked', 'draft'] }, + sentence_de: { type: 'textarea' }, + sentence_en: { type: 'textarea' }, + sentence_sv: { type: 'textarea' }, + blocked_topic:{ type: 'text' }, + status: { type: 'select', options: ['draft', 'published', 'blocked'] }, }, fetchRelated: [], }, + statements: { label: 'Statements', icon: 'πŸ’¬', endpoint: '/statements', statusField: 'status', primaryLabel: 'positive_sentence_de', - columns: ['positive_sentence_de', 'negative_sentence_de', 'status', 'created_at'], + columns: ['positive_sentence_de', 'negative_sentence_de', 'answer', 'status', 'created_at'], linkedFields: {}, editableFields: { positive_sentence_de: { type: 'textarea' }, negative_sentence_de: { type: 'textarea' }, positive_sentence_en: { type: 'textarea' }, negative_sentence_en: { type: 'textarea' }, - status: { type: 'select', options: ['published', 'blocked', 'draft'] }, + positive_sentence_sv: { type: 'textarea' }, + negative_sentence_sv: { type: 'textarea' }, + answer: { type: 'boolean' }, + blocked_topic: { type: 'text' }, + status: { type: 'select', options: ['draft', 'published', 'blocked'] }, }, fetchRelated: [], }, + categories: { label: 'Kategorien', icon: '🏷️', endpoint: '/categories', - statusField: null, - primaryLabel: 'name_de', - columns: ['name_de', 'name_en', 'name_sv', 'created_at'], + statusField: 'status', + primaryLabel: 'titel_de', + columns: ['titel_de', 'titel_en', 'titel_sv', 'status', 'difficulty_level', 'created_at'], linkedFields: {}, editableFields: { - name_de: { type: 'text' }, - name_en: { type: 'text' }, - name_sv: { type: 'text' }, + titel_de: { type: 'text' }, + titel_en: { type: 'text' }, + titel_sv: { type: 'text' }, + status: { type: 'select', options: ['requested', 'published', 'blocked'] }, + difficulty_level:{ type: 'number', min: 1, max: 50 }, + }, + fetchRelated: [], + }, + + languages: { + label: 'Sprachen', + icon: '🌐', + endpoint: '/languages', + statusField: 'status', + primaryLabel: 'titel_en', + columns: ['titel_en', 'titel_de', 'titel_sv', 'short_en', 'status', 'created_at'], + linkedFields: {}, + editableFields: { + titel_en: { type: 'text' }, + titel_de: { type: 'text' }, + titel_sv: { type: 'text' }, + short_en: { type: 'text' }, + status: { type: 'select', options: ['draft', 'published', 'blocked'] }, + }, + fetchRelated: [], + }, + + users: { + label: 'Users', + icon: 'πŸ‘€', + endpoint: '/users', + statusField: null, + primaryLabel: 'email', + columns: ['email', 'role', 'is_active', 'created_at'], + linkedFields: {}, + editableFields: { + role: { type: 'select', options: ['end-user', 'admin'] }, + is_active: { type: 'boolean' }, + }, + fetchRelated: [], + }, + + blocklist: { + label: 'Blocklist', + icon: '🚫', + endpoint: '/blocklist', + statusField: null, + primaryLabel: 'email', + columns: ['email', 'username', 'phone', 'ip', 'is_blocked', 'blocked_at', 'created_at'], + linkedFields: {}, + editableFields: { + email: { type: 'text' }, + username: { type: 'text' }, + phone: { type: 'text' }, + ip: { type: 'text' }, + is_blocked: { type: 'boolean' }, + }, + fetchRelated: [], + }, + + 'user-names': { + label: 'Usernames', + icon: 'πŸͺͺ', + endpoint: '/user-names', + statusField: null, + primaryLabel: 'username', + columns: ['username', 'username_lowercase', 'created_at'], + linkedFields: {}, + editableFields: { + username: { type: 'text' }, + }, + fetchRelated: [], + }, + + 'users-public': { + label: 'Users Public', + icon: 'πŸ§‘β€πŸ€β€πŸ§‘', + endpoint: '/users-public', + statusField: null, + primaryLabel: 'id', + columns: ['id', 'username_id', 'language_native_id', 'language_target_id', 'created_at'], + linkedFields: { + username_id: 'user-names', + language_native_id: 'languages', + language_target_id: 'languages', + }, + editableFields: { + language_native_id: { type: 'text' }, + language_target_id: { type: 'text' }, }, fetchRelated: [], },