aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-25 21:41:53 -0700
committerFuwn <[email protected]>2023-09-25 21:41:53 -0700
commit1e2c754ea1813b87636c405eb10cf135a6517260 (patch)
tree9016e6b81b89c7b23601c74dc4920f762c8cdf7e
parentrefactor(anime): use title component (diff)
downloaddue.moe-1e2c754ea1813b87636c405eb10cf135a6517260.tar.xz
due.moe-1e2c754ea1813b87636c405eb10cf135a6517260.zip
refactor(completed): title component
-rw-r--r--src/lib/List/Due/ListTitle.svelte4
-rw-r--r--src/lib/List/WatchingAnimeList.svelte10
-rw-r--r--src/routes/+page.svelte3
3 files changed, 9 insertions, 8 deletions
diff --git a/src/lib/List/Due/ListTitle.svelte b/src/lib/List/Due/ListTitle.svelte
index 5a37850c..2aa580d3 100644
--- a/src/lib/List/Due/ListTitle.svelte
+++ b/src/lib/List/Due/ListTitle.svelte
@@ -2,9 +2,11 @@
export let time: number | string = '...';
export let count: number | string = '...';
export let anime = false;
+ export let custom = '';
</script>
<summary>
- {anime ? 'Anime' : 'Manga & Light Novels'} [{count}] <small style="opacity: 50%">{time}s</small>
+ {custom.length !== 0 ? custom : anime ? 'Anime' : 'Manga & Light Novels'} [{count}]
+ <small style="opacity: 50%">{time}s</small>
<slot />
</summary>
diff --git a/src/lib/List/WatchingAnimeList.svelte b/src/lib/List/WatchingAnimeList.svelte
index f86ede7d..02b35b01 100644
--- a/src/lib/List/WatchingAnimeList.svelte
+++ b/src/lib/List/WatchingAnimeList.svelte
@@ -8,6 +8,7 @@
import lastPruneTimes from '../../stores/lastPruneTimes';
import settings from '../../stores/settings';
import { cleanCache, totalEpisodes, updateMedia } from '$lib/Media/anime';
+ import ListTitle from './Due/ListTitle.svelte';
export let user: AniListAuthorisation;
export let identity: UserIdentity;
@@ -62,16 +63,13 @@
</script>
{#await animeLists}
- <summary>Completed Anime [...] <small style="opacity: 50%">...s</small></summary>
+ <ListTitle custom="Completed Anime" />
<ul><li>Loading ...</li></ul>
{:then media}
{@const cleanedMedia = cleanMedia(media)}
- <summary
- >Completed Anime [{cleanedMedia.length}]
- <small style="opacity: 50%">{endTime / 1000}s</small></summary
- >
+ <ListTitle count={cleanedMedia.length} time={endTime / 1000} custom="Completed Anime" />
{#if cleanedMedia.length === 0}
<ul>
@@ -112,7 +110,7 @@
{/each}
</ul>
{:catch}
- <summary>Upcoming Episodes [?] <small style="opacity: 50%">0s</small></summary>
+ <ListTitle count="?" time="0" custom="Completed Anime" />
<ul>
<li>
diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
index 9a9f598d..f617f618 100644
--- a/src/routes/+page.svelte
+++ b/src/routes/+page.svelte
@@ -129,7 +129,8 @@
{#if currentUserIdentity.id != -1}
<WatchingAnimeList user={data.user} identity={currentUserIdentity} />
{:else}
- <summary>Completed Anime [...] <small style="opacity: 50%">...s</small></summary>
+ <ListTitle custom="Completed Anime" />
+
<ul><li>Loading ...</li></ul>
{/if}
</details>