'use client' import { useState } from 'react' import type { VideoScript } from '@/lib/sdk/training/types' import { previewVideoScript } from '@/lib/sdk/training/api' interface ScriptPreviewProps { moduleId: string } export default function ScriptPreview({ moduleId }: ScriptPreviewProps) { const [script, setScript] = useState(null) const [loading, setLoading] = useState(false) const [error, setError] = useState(null) async function handlePreview() { setLoading(true) setError(null) try { const result = await previewVideoScript(moduleId) setScript(result as VideoScript) } catch (e) { setError(e instanceof Error ? e.message : 'Fehler bei der Script-Vorschau') } finally { setLoading(false) } } return (

Folien-Vorschau

{error && (
{error}
)} {loading && (
Folien-Script wird generiert...
)} {script && (
{script.title}
{script.sections.map((section, i) => (
{i + 1}
{section.heading}
{section.text && (

{section.text}

)} {section.bullet_points && section.bullet_points.length > 0 && (
    {section.bullet_points.map((bp, j) => (
  • {String.fromCharCode(8226)} {bp}
  • ))}
)}
))}

{script.sections.length} Folien

)}
) }