aboutsummaryrefslogtreecommitdiff
path: root/src/lib/List/Due
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-09-26 17:31:12 -0700
committerFuwn <[email protected]>2023-09-26 17:31:12 -0700
commitf70417fb60a2aadf8e8323a13a6dcfda51a7b6c7 (patch)
tree13bc3504064d4791c870ffe6dfe4f37a53483d9f /src/lib/List/Due
parentrefactor(title): move out of due (diff)
downloaddue.moe-f70417fb60a2aadf8e8323a13a6dcfda51a7b6c7.tar.xz
due.moe-f70417fb60a2aadf8e8323a13a6dcfda51a7b6c7.zip
refactor(anime): move list to component
Diffstat (limited to 'src/lib/List/Due')
-rw-r--r--src/lib/List/Due/AnimeList.svelte63
1 files changed, 2 insertions, 61 deletions
diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte
index 32ad440f..0df57b1b 100644
--- a/src/lib/List/Due/AnimeList.svelte
+++ b/src/lib/List/Due/AnimeList.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 { onDestroy, onMount } from 'svelte';
import anime from '../../../stores/anime';
import settings from '../../../stores/settings';
import lastPruneTimes from '../../../stores/lastPruneTimes';
- import { airingTime, 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;
@@ -106,59 +102,4 @@
};
</script>
-{#await animeLists}
- <ListTitle anime />
-
- <ul><li>Loading ...</li></ul>
-{:then media}
- {@const cleanedMedia = cleanMedia(media, displayUnresolved)}
-
- <ListTitle time={endTime / 1000} count={cleanedMedia.length} 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 }).progress}{@html totalEpisodes(anime)}
- <a
- href={'#'}
- on:click={() =>
- updateMedia(
- anime.id,
- anime.mediaListEntry?.progress,
- () => (animeLists = cleanCache(user, identity))
- )}>+</a
- >
- [{anime.nextAiringEpisode?.episode === -1
- ? '?'
- : (anime.nextAiringEpisode?.episode || 1) - 1}]
- {@html airingTime(anime)}
- </li>
- {/each}
- </ul>
-{:catch}
- <ListTitle time={0} count={'?'} anime />
-
- <Error />
-{/await}
+<AnimeList {endTime} {cleanMedia} {animeLists} {user} {identity} {displayUnresolved} />