import { useState } from "react"; import { Edit, Info, Loader2, Play, Rocket } from "lucide-react"; import { PersonaAvatar } from "../../../../components/personas/PersonaAvatar"; import { Button } from "../../../../components/ui/button"; import { Card } from "../../../../components/ui/card"; import { cn } from "../../../../lib/utils"; import { UnassignedLabel, isUnassignedLabel } from "../../../../lib/displayValue" export type PracticeReviewQuestion = { id: string; questionText: string; voicePrompt: string; sampleAnswerVoicePrompt: string; tips?: string; }; export type PracticeReviewMetadataItem = { label: string; value: string; }; export type PracticeSequentialReviewProps = { practiceTitle: string; thumbnailUrl?: string | null; thumbnailKind?: "image" | "video" | "vimeo" | "gradient"; persona?: { name: string; avatar: string } | null; metadata?: PracticeReviewMetadataItem[]; parentLink?: string | null; guidanceText: string; questions: PracticeReviewQuestion[]; saving?: boolean; saveError?: string | null; canPublish?: boolean; showMissingParentWarning?: boolean; showUnlinkedBanner?: boolean; onEditContext?: () => void; onEditQuestions?: () => void; onBack: () => void; onSaveDraft: () => void; onPublish: () => void; publishLabel?: string; publishingLabel?: string; sectionTitle?: string; sectionSubtitle?: string; }; function audioFileLabel(url: string, fallback: string): string { const trimmed = url.trim(); if (!trimmed) return fallback; try { const path = new URL(trimmed).pathname.split("/").filter(Boolean).pop(); if (path) return decodeURIComponent(path); } catch { // fall through } const seg = trimmed.split("/").filter(Boolean).pop(); return seg && seg.length < 64 ? seg : fallback; } export function ReviewAudioPlayer({ src, label, className, }: { src: string; label: string; className?: string; }) { const [playing, setPlaying] = useState(false); const fileName = audioFileLabel(src, label); if (!src.trim()) { return (
No audio URL provided
); } return ({sectionSubtitle}
) : null}Not attached yet
This practice will be saved without course, module, or lesson links. Attach locations later from the practice editor.
Missing parent for the API
Open Add Practice from a course, module, or lesson so parent IDs are in the URL.
Link:{" "} {parentLink}
) : null}
{isUnassignedLabel(guidanceText) ?
Text prompt
{question.questionText.trim() ||
Voice prompt
Voice prompt
{saveError}