feat: Implement admin background task management and configurable media block transcript visibility.

This commit is contained in:
2026-01-16 17:02:00 -03:00
parent 55aede97ed
commit 2cfd1f204b
12 changed files with 309 additions and 5 deletions
+4 -1
View File
@@ -1,7 +1,7 @@
"use client";
import { useAuth } from "@/context/AuthContext";
import { LogOut, ShieldAlert, Building2 } from "lucide-react";
import { LogOut, ShieldAlert, Building2, Activity } from "lucide-react";
import Link from "next/link";
export default function AuthHeader() {
@@ -16,6 +16,9 @@ export default function AuthHeader() {
<Link href="/admin/audit" className="text-xs font-bold uppercase tracking-widest text-gray-400 hover:text-white transition-colors flex items-center gap-2">
<ShieldAlert size={16} /> Audit
</Link>
<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">
<Activity size={16} /> Tasks
</Link>
</>
)}
{user && (
@@ -13,9 +13,10 @@ interface MediaBlockProps {
config: {
maxPlays?: number;
currentPlays?: number;
show_transcript?: boolean;
};
editMode: boolean;
onChange: (updates: { title?: string; url?: string; config?: { maxPlays?: number; currentPlays?: number } }) => void;
onChange: (updates: { title?: string; url?: string; config?: { maxPlays?: number; currentPlays?: number; show_transcript?: boolean } }) => void;
transcription?: {
en?: string;
es?: string;
@@ -109,6 +110,23 @@ export default function MediaBlock({ title, url, type, config, editMode, onChang
/>
<p className="text-[10px] text-gray-500 uppercase leading-relaxed mt-2">Prevent content fatigue by limiting how many times a student can watch/listen.</p>
</div>
<div className="space-y-2">
<label className="text-xs font-bold text-gray-500 uppercase tracking-widest">Additional Options</label>
<div className="flex items-center gap-3 bg-white/5 border border-white/10 rounded-lg px-4 py-2 h-11">
<input
type="checkbox"
id={`show-transcript-${title}`} // Unique ID
checked={config.show_transcript !== false} // Default to true
onChange={(e) => onChange({ config: { ...config, show_transcript: e.target.checked } })}
className="w-4 h-4 rounded border-gray-600 text-blue-600 focus:ring-blue-500 bg-gray-700"
/>
<label htmlFor={`show-transcript-${title}`} className="text-sm text-gray-300 font-medium select-none cursor-pointer">
Show Interactive Transcript
</label>
</div>
<p className="text-[10px] text-gray-500 uppercase leading-relaxed mt-2">Uncheck to hide transcription text (e.g. for listening tests).</p>
</div>
</div>
</div>
)}