fix(web,api): UI fiche livre et lecteur — progression, locators EPUB/PDF, styles
- web: BookPage/ReaderPage enrichis, sauvegarde de progression lecteur - web: locators EPUB/PDF normalisés (+ tests), EpubReader/PdfReader ajustés - web: nginx et service worker ajustés - api: progress — corrections contrôleur/service Refs: #13
This commit is contained in:
@ -7,6 +7,7 @@ type FoliateModule = {
|
||||
|
||||
export function EpubReader({ url, locator, onLocatorChange }: { url: string; locator?: string; onLocatorChange: (locator: string, percent: number) => void }) {
|
||||
const hostRef = useRef<HTMLDivElement>(null);
|
||||
const [frameKey, setFrameKey] = useState(0);
|
||||
const [status, setStatus] = useState("Ouverture EPUB");
|
||||
|
||||
useEffect(() => {
|
||||
@ -17,7 +18,6 @@ export function EpubReader({ url, locator, onLocatorChange }: { url: string; loc
|
||||
if (cancelled || !hostRef.current) return;
|
||||
hostRef.current.dataset.engine = module.EPUB || module.default ? "foliate-js" : "fallback";
|
||||
setStatus("EPUB pret");
|
||||
onLocatorChange(locator ?? "epub:start", locator ? 35 : 1);
|
||||
} catch {
|
||||
setStatus("Apercu EPUB indisponible dans ce navigateur");
|
||||
}
|
||||
@ -26,12 +26,20 @@ export function EpubReader({ url, locator, onLocatorChange }: { url: string; loc
|
||||
return () => {
|
||||
cancelled = true;
|
||||
};
|
||||
}, [locator, onLocatorChange, url]);
|
||||
}, [url]);
|
||||
|
||||
return (
|
||||
<div className="epub-reader" ref={hostRef}>
|
||||
<iframe title="EPUB" src={url} />
|
||||
<div className="reader-fallback">{status}</div>
|
||||
<iframe key={frameKey} title="EPUB" src={url} />
|
||||
<div className="reader-fallback">
|
||||
<span>{status}</span>
|
||||
<button className="ghost-button" onClick={() => onLocatorChange(locator ?? "epub:start", locator ? 35 : 1)}>
|
||||
Marquer la position
|
||||
</button>
|
||||
<button className="ghost-button" onClick={() => setFrameKey((value) => value + 1)}>
|
||||
Recharger
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user