import React, { useEffect, useState } from "react"; import { api, subscribeState } from "./api.js"; import { StatusChip, ProgressBar, Spinner } from "./ui.jsx"; import Chapters from "./Chapters.jsx"; import AnalysisEditor from "./AnalysisEditor.jsx"; import CastEditor from "./CastEditor.jsx"; import PronunciationEditor from "./PronunciationEditor.jsx"; const STAGES = [ { key: "analyze", label: "Analyse", action: (s) => api.analyze(s), hint: "Découpe le texte, détecte les locuteurs et le casting." }, { key: "cast", label: "Casting", action: (s) => api.castAuto(s), hint: "Attribue une voix à chaque personnage." }, { key: "pronounce", label: "Prononciations", action: (s) => api.pronounce(s), hint: "Repère les mots à risque de mauvaise prononciation." }, ]; export default function BookView({ slug, onBack }) { const [data, setData] = useState(null); const [state, setState] = useState(null); const [tab, setTab] = useState("chapters"); useEffect(() => { api.getBook(slug).then((d) => { setData(d); setState(d.state); }); const unsub = subscribeState(slug, setState); return unsub; }, [slug]); if (!data) return
{book.author}
{book.chapters.filter((c) => c.render).length} chapitres à narrer
{busy && ({stage.hint}