Flesh out volume data

This commit is contained in:
ZXY101
2023-10-03 12:44:59 +02:00
parent aff1566e28
commit 316b99c20f
8 changed files with 128 additions and 27 deletions

View File

@@ -0,0 +1,30 @@
<script lang="ts">
import { volumes } from '$lib/settings';
import { AccordionItem, P } from 'flowbite-svelte';
$: completed = Object.values($volumes).reduce((total: number, { completed }) => {
if (completed) {
total++;
}
return total;
}, 0);
$: pagesRead = Object.values($volumes).reduce((total: number, { progress }) => {
total += progress;
return total;
}, 0);
$: charsRead = Object.values($volumes).reduce((total: number, { chars }) => {
total += chars;
return total;
}, 0);
</script>
<AccordionItem>
<span slot="header">Stats</span>
<div>
<p>Completed volumes: {completed}</p>
<p>Pages read: {pagesRead}</p>
<p>Characters read: {charsRead}</p>
</div>
</AccordionItem>