aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-26 17:40:08 -0700
committerFuwn <[email protected]>2023-09-26 17:40:08 -0700
commitc94d5a24d50f37a60ceaa9f7acc5bf420229f988 (patch)
treef2708bccb145badd9d3872e4a7765a6547ec95f7
parentfeat(anime): component title field (diff)
downloaddue.moe-c94d5a24d50f37a60ceaa9f7acc5bf420229f988.tar.xz
due.moe-c94d5a24d50f37a60ceaa9f7acc5bf420229f988.zip
refactor(anime): completed as component
-rw-r--r--src/lib/List/AnimeList.svelte13
-rw-r--r--src/lib/List/WatchingAnimeList.svelte59
2 files changed, 10 insertions, 62 deletions
diff --git a/src/lib/List/AnimeList.svelte b/src/lib/List/AnimeList.svelte
index dd1b69ac..03d58b1f 100644
--- a/src/lib/List/AnimeList.svelte
+++ b/src/lib/List/AnimeList.svelte
@@ -13,7 +13,7 @@
export let animeLists: Promise<Media[]>;
export let user: AniListAuthorisation;
export let identity: UserIdentity;
- export let displayUnresolved: boolean;
+ export let displayUnresolved = false;
export let title: string;
</script>
@@ -51,6 +51,7 @@
{anime.title.english || anime.title.romaji || anime.title.native}
</a>
<span style="opacity: 50%;">|</span>
+ <!-- {anime.mediaListEntry?.progress || 0}{@html totalEpisodes(anime)} -->
{(anime.mediaListEntry || { progress: 0 }).progress}{@html totalEpisodes(anime)}
<a
href={'#'}
@@ -61,10 +62,12 @@
() => (animeLists = cleanCache(user, identity))
)}>+</a
>
- [{anime.nextAiringEpisode?.episode === -1
- ? '?'
- : (anime.nextAiringEpisode?.episode || 1) - 1}]
- {@html airingTime(anime)}
+ {#if !title.includes('Completed')}
+ [{anime.nextAiringEpisode?.episode === -1
+ ? '?'
+ : (anime.nextAiringEpisode?.episode || 1) - 1}]
+ {@html airingTime(anime)}
+ {/if}
</li>
{/each}
</ul>
diff --git a/src/lib/List/WatchingAnimeList.svelte b/src/lib/List/WatchingAnimeList.svelte
index 069ed5cf..9573b661 100644
--- a/src/lib/List/WatchingAnimeList.svelte
+++ b/src/lib/List/WatchingAnimeList.svelte
@@ -1,15 +1,11 @@
<script lang="ts">
- /* eslint svelte/no-at-html-tags: "off" */
-
import { mediaListCollection, Type, type Media } from '$lib/AniList/media';
import type { UserIdentity, AniListAuthorisation } from '$lib/AniList/identity';
import { onMount } from 'svelte';
import anime from '../../stores/anime';
import lastPruneTimes from '../../stores/lastPruneTimes';
import settings from '../../stores/settings';
- import { cleanCache, totalEpisodes, updateMedia } from '$lib/Media/anime';
- import ListTitle from './ListTitle.svelte';
- import Error from '$lib/Error.svelte';
+ import AnimeList from './AnimeList.svelte';
export let user: AniListAuthorisation;
export let identity: UserIdentity;
@@ -63,55 +59,4 @@
};
</script>
-{#await animeLists}
- <ListTitle custom="Completed Anime" />
-
- <ul><li>Loading ...</li></ul>
-{:then media}
- {@const cleanedMedia = cleanMedia(media)}
-
- <ListTitle count={cleanedMedia.length} time={endTime / 1000} custom="Completed Anime" />
-
- {#if cleanedMedia.length === 0}
- <ul>
- <li>
- No anime to display. <a
- href={'#'}
- on:click={() => (animeLists = cleanCache(user, identity))}>Force refresh</a
- >
- </li>
- </ul>
- {/if}
-
- <ul>
- {#each cleanedMedia as anime}
- <li>
- <a
- href={$settings.linkToAniList
- ? `https://anilist.co/anime/${anime.id}`
- : `https://www.livechart.me/search?q=${
- anime.title.native || anime.title.english || anime.title.romaji
- }`}
- target="_blank"
- >
- {anime.title.english || anime.title.romaji || anime.title.native}
- </a>
- <span style="opacity: 50%;">|</span>
- {anime.mediaListEntry?.progress || 0}{@html totalEpisodes(anime)}
- <a
- href={'#'}
- on:click={() =>
- updateMedia(
- anime.id,
- anime.mediaListEntry?.progress,
- () => (animeLists = cleanCache(user, identity))
- )}>+</a
- >
- </li>
- {/each}
- </ul>
-{:catch}
- <ListTitle count="?" time="0" custom="Completed Anime" />
-
- <Error />
-{/await}
+<AnimeList {endTime} {cleanMedia} {animeLists} {user} {identity} title="Completed Anime" />