<script>
	import { page } from '$app/state';
	import EpubReader from '$lib/components/reader/epub-reader.svelte';

	let { data } = $props();

	let fileId = page.params.fileId;
	let bookId = page.params.bookId;

	// Make sure this endpoint returns the complete EPUB file
	let bookUrl = `/api/books/download/${bookId}/${fileId}`;
</script>

<div class="h-screen w-screen">
	<EpubReader
		{bookUrl}
		{bookId}
		initialProgress={data.bookProgress?.progress}
		initialEpubLoc={data.bookProgress?.epub_loc}
	/>
</div>
