Refactor code structure for improved readability and maintainability
This commit is contained in:
@@ -223,7 +223,7 @@ export default function StudioLoginPage() {
|
||||
<div className="mt-6 pt-6 border-t border-gray-200 dark:border-white/10 text-center transition-colors">
|
||||
<p className="text-sm text-gray-500 dark:text-gray-400">
|
||||
Are you a student?{" "}
|
||||
<a href="https://learning.norteamericano.com/auth/login" className="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-bold transition-colors">
|
||||
<a href={`https://${process.env.NEXT_PUBLIC_LEARNING_DOMAIN || 'learning.norteamericano.com'}/auth/login`} className="text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 font-bold transition-colors">
|
||||
Go to Student Portal
|
||||
</a>
|
||||
</p>
|
||||
|
||||
@@ -197,7 +197,7 @@ export default function LessonEditor({ params }: { params: { id: string; lessonI
|
||||
}
|
||||
|
||||
const updated = await cmsApi.updateLesson(lesson.id, {
|
||||
metadata: { ...lesson.metadata },
|
||||
metadata: lesson.metadata ?? { blocks: [] },
|
||||
content_blocks: blocks,
|
||||
content_url,
|
||||
content_type, // Sync type to ensure backend triggers transcription
|
||||
@@ -348,11 +348,16 @@ export default function LessonEditor({ params }: { params: { id: string; lessonI
|
||||
};
|
||||
setBlocks([...blocks, newBlock]);
|
||||
} else {
|
||||
const newBlocks = await cmsApi.generateQuiz(lesson.id, {
|
||||
const generatedQuiz = await cmsApi.generateQuiz(lesson.id, {
|
||||
prompt_hint: aiQuizContext,
|
||||
quiz_type: aiQuizType
|
||||
});
|
||||
setBlocks([...blocks, ...newBlocks]);
|
||||
const newBlock: Block = {
|
||||
id: Math.random().toString(36).substr(2, 9),
|
||||
type: 'quiz',
|
||||
quiz_data: { questions: generatedQuiz.questions }
|
||||
};
|
||||
setBlocks([...blocks, newBlock]);
|
||||
}
|
||||
setAiQuizContext("");
|
||||
} catch (err) {
|
||||
|
||||
@@ -1,28 +1,25 @@
|
||||
'use client';
|
||||
|
||||
import React from 'react';
|
||||
import React, { useState } from 'react';
|
||||
import PageLayout from '@/components/PageLayout';
|
||||
import { AlertTriangle } from 'lucide-react';
|
||||
import TestTemplateManager from '@/components/TestTemplates/TestTemplateManager';
|
||||
import TestTemplateForm from '@/components/TestTemplates/TestTemplateForm';
|
||||
|
||||
export default function TestTemplatesPage() {
|
||||
const [view, setView] = useState<'list' | 'create'>('list');
|
||||
|
||||
return (
|
||||
<PageLayout title="Plantillas de Pruebas">
|
||||
<div className="flex flex-col items-center justify-center p-8">
|
||||
<div className="bg-yellow-50 border border-yellow-200 rounded-lg p-6 max-w-2xl">
|
||||
<div className="flex items-center gap-3 mb-4">
|
||||
<AlertTriangle className="w-8 h-8 text-yellow-600" />
|
||||
<h2 className="text-xl font-semibold text-yellow-800">
|
||||
Funcionalidad Temporalmente Desactivada
|
||||
</h2>
|
||||
</div>
|
||||
<p className="text-yellow-700 mb-4">
|
||||
Las plantillas de pruebas están temporalmente desactivadas mientras se realizan mejoras en el sistema.
|
||||
</p>
|
||||
<p className="text-yellow-600 text-sm">
|
||||
Esta funcionalidad estará disponible próximamente.
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
{view === 'list' ? (
|
||||
<TestTemplateManager
|
||||
onCreateTemplate={() => setView('create')}
|
||||
/>
|
||||
) : (
|
||||
<TestTemplateForm
|
||||
onSuccess={() => setView('list')}
|
||||
onCancel={() => setView('list')}
|
||||
/>
|
||||
)}
|
||||
</PageLayout>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user