aboutsummaryrefslogtreecommitdiff
path: root/src/lib/List
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-25 21:33:11 -0700
committerFuwn <[email protected]>2023-09-25 21:33:11 -0700
commit59c404317de10d04119089ad4eddfbc1a49740b4 (patch)
treedb7cc73979ff6ca1946d16010a92992eb7aa8647 /src/lib/List
parentrefactor(history): move to tools (diff)
downloaddue.moe-59c404317de10d04119089ad4eddfbc1a49740b4.tar.xz
due.moe-59c404317de10d04119089ad4eddfbc1a49740b4.zip
feat(manga): replace list titles
Diffstat (limited to 'src/lib/List')
-rw-r--r--src/lib/List/Due/MangaList.svelte19
-rw-r--r--src/lib/List/Due/MangaTitle.svelte8
2 files changed, 19 insertions, 8 deletions
diff --git a/src/lib/List/Due/MangaList.svelte b/src/lib/List/Due/MangaList.svelte
index 4b207351..0f3e511b 100644
--- a/src/lib/List/Due/MangaList.svelte
+++ b/src/lib/List/Due/MangaList.svelte
@@ -2,11 +2,12 @@
import { mediaListCollection, Type, type Media } from '$lib/AniList/media';
import type { UserIdentity, AniListAuthorisation } from '$lib/AniList/identity';
import { onDestroy, onMount } from 'svelte';
- import { chapterCount } from '$lib/Media/manga';
+ import { chapterCount, pruneAllManga } from '$lib/Media/manga';
import manga from '../../../stores/manga';
import { chapterDatabase } from '$lib/Media/chapters';
import settings from '../../../stores/settings';
import lastPruneTimes from '../../../stores/lastPruneTimes';
+ import MangaTitle from './MangaTitle.svelte';
export let user: AniListAuthorisation;
export let identity: UserIdentity;
@@ -112,7 +113,9 @@
});
};
- const cleanCache = () => {
+ const cleanCache = async () => {
+ await pruneAllManga();
+
mangaLists = mediaListCollection(
user,
identity,
@@ -125,19 +128,18 @@
</script>
{#await mangaLists}
- <summary>Manga & Light Novels [...] <small style="opacity: 50%">...s</small></summary>
+ <MangaTitle />
<ul><li>Loading ...</li></ul>
{:then media}
{#await cleanMedia(media, displayUnresolved)}
- <summary>Manga & Light Novels [...] <small style="opacity: 50%">...s</small></summary>
+ <MangaTitle />
<ul><li>Loading ...</li></ul>
{:then cleanedMedia}
- <summary>
- Manga & Light Novels [{cleanedMedia.length}]
- <small style="opacity: 50%">{endTime / 1000}s</small>
- </summary>
+ <MangaTitle count={cleanedMedia.length} time={endTime / 1000}>
+ <a href={'#'} title="Force a refresh" on:click={cleanCache}>Force</a>
+ </MangaTitle>
{#if cleanedMedia.length === 0}
<ul>
@@ -160,6 +162,7 @@
</ul>
{:catch}
<summary>Manga & Light Novels [?] <small style="opacity: 50%">0s</small></summary>
+ <MangaTitle count={'?'} time={0} />
<ul>
<li>
diff --git a/src/lib/List/Due/MangaTitle.svelte b/src/lib/List/Due/MangaTitle.svelte
new file mode 100644
index 00000000..aee467dd
--- /dev/null
+++ b/src/lib/List/Due/MangaTitle.svelte
@@ -0,0 +1,8 @@
+<script lang="ts">
+ export let time: number | string = '...';
+ export let count: number | string = '...';
+</script>
+
+<summary
+ >Manga & Light Novels [{count}] <small style="opacity: 50%">{time}s</small> <slot /></summary
+>