Fix AI question parsing and expose token admin
This commit is contained in:
@@ -13,7 +13,8 @@ import {
|
||||
Activity,
|
||||
TrendingUp,
|
||||
Mic,
|
||||
FileArchive
|
||||
FileArchive,
|
||||
Gauge
|
||||
} from "lucide-react";
|
||||
|
||||
export default function AdminLayout({ children }: { children: React.ReactNode }) {
|
||||
@@ -23,6 +24,7 @@ export default function AdminLayout({ children }: { children: React.ReactNode })
|
||||
{ icon: LayoutDashboard, label: "Dashboard", href: "/admin" },
|
||||
{ icon: Building2, label: "Organizations", href: "/admin" },
|
||||
{ icon: Users, label: "Users", href: "/admin/users" },
|
||||
{ icon: Gauge, label: "Tokens IA", href: "/admin/token-usage" },
|
||||
{ icon: FileArchive, label: "Material Compartido", href: "/admin/materials" },
|
||||
{ icon: Mic, label: "Audio Evaluations", href: "/admin/audio-evaluations" },
|
||||
{ icon: ClipboardList, label: "Audit Logs", href: "/admin/audit" },
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
"use client";
|
||||
|
||||
import { useAuth } from "@/context/AuthContext";
|
||||
import { LogOut, ShieldAlert, Building2, Activity, Settings } from "lucide-react";
|
||||
import { LogOut, ShieldAlert, Building2, Activity, Settings, Gauge } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
|
||||
export default function AuthHeader() {
|
||||
@@ -19,6 +19,9 @@ export default function AuthHeader() {
|
||||
<Link href="/admin/tasks" className="text-xs font-bold uppercase tracking-widest text-gray-400 hover:text-white transition-colors flex items-center gap-2" title="Tasks">
|
||||
<Activity size={16} /> <span className="hidden md:inline">Tasks</span>
|
||||
</Link>
|
||||
<Link href="/admin/token-usage" className="text-xs font-bold uppercase tracking-widest text-gray-400 hover:text-white transition-colors flex items-center gap-2" title="Tokens IA">
|
||||
<Gauge size={16} /> <span className="hidden md:inline">Tokens</span>
|
||||
</Link>
|
||||
<Link href="/settings" className="text-xs font-bold uppercase tracking-widest text-gray-400 hover:text-white transition-colors flex items-center gap-2" title="Settings">
|
||||
<Settings size={16} /> <span className="hidden md:inline">Settings</span>
|
||||
</Link>
|
||||
|
||||
@@ -118,6 +118,38 @@ export default function QuestionBankCard({ question, onEdit, onDelete }: Questio
|
||||
{safeQuestionText as any}
|
||||
</p>
|
||||
|
||||
{/* Matching Pairs Preview */}
|
||||
{question.question_type === 'matching' && (
|
||||
<div className="mb-3 space-y-2">
|
||||
{(() => {
|
||||
// Try to get pairs from different possible locations
|
||||
let pairs = question.pairs ||
|
||||
(question.correct_answer && Array.isArray(question.correct_answer) ? question.correct_answer : null) ||
|
||||
(question.correct_answer && question.correct_answer.pairs ? question.correct_answer.pairs : null);
|
||||
|
||||
if (!Array.isArray(pairs) || pairs.length === 0) {
|
||||
return <div className="text-xs text-gray-400">Sin pares definidos</div>;
|
||||
}
|
||||
|
||||
return pairs.slice(0, 3).map((pair: any, idx: number) => (
|
||||
<div key={idx} className="text-xs bg-gray-50 dark:bg-gray-700/50 p-2 rounded flex items-center gap-2">
|
||||
<span className="flex-1 text-gray-700 dark:text-gray-300">{pair.left || pair[0]}</span>
|
||||
<span className="text-gray-400">→</span>
|
||||
<span className="flex-1 text-gray-600 dark:text-gray-400 line-clamp-1">{pair.right || pair[1]}</span>
|
||||
</div>
|
||||
));
|
||||
})()}
|
||||
{(() => {
|
||||
let pairs = question.pairs ||
|
||||
(question.correct_answer && Array.isArray(question.correct_answer) ? question.correct_answer : null) ||
|
||||
(question.correct_answer && question.correct_answer.pairs ? question.correct_answer.pairs : null);
|
||||
return Array.isArray(pairs) && pairs.length > 3 ? (
|
||||
<div className="text-xs text-gray-400">+{pairs.length - 3} pares más</div>
|
||||
) : null;
|
||||
})()}
|
||||
</div>
|
||||
)}
|
||||
|
||||
{/* Audio Player */}
|
||||
{question.audio_url && (
|
||||
<div className="mb-3">
|
||||
|
||||
Reference in New Issue
Block a user