diff options
| author | Fuwn <[email protected]> | 2023-11-06 18:23:53 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-11-06 18:23:53 -0800 |
| commit | cfc1a9221e4ddabcd0f7090358f19ad374346e3a (patch) | |
| tree | 4a68a03af410c29031be93ddaa83f623637d00c9 /src/lib/List/Anime/AnimeListTemplate.svelte | |
| parent | fix(manga): wait for prune on clean (diff) | |
| download | due.moe-cfc1a9221e4ddabcd0f7090358f19ad374346e3a.tar.xz due.moe-cfc1a9221e4ddabcd0f7090358f19ad374346e3a.zip | |
refactor(list): move modules to sub-modules
Diffstat (limited to 'src/lib/List/Anime/AnimeListTemplate.svelte')
| -rw-r--r-- | src/lib/List/Anime/AnimeListTemplate.svelte | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/src/lib/List/Anime/AnimeListTemplate.svelte b/src/lib/List/Anime/AnimeListTemplate.svelte new file mode 100644 index 00000000..2c806a2f --- /dev/null +++ b/src/lib/List/Anime/AnimeListTemplate.svelte @@ -0,0 +1,63 @@ +<script lang="ts"> + /* eslint svelte/no-at-html-tags: "off" */ + + import type { AniListAuthorisation, UserIdentity } from '$lib/AniList/identity'; + import type { Media } from '$lib/AniList/media'; + import Error from '$lib/Error.svelte'; + import settings from '../../../stores/settings'; + import CleanAnimeList from './CleanAnimeList.svelte'; + import ListTitle from '../ListTitle.svelte'; + + export let endTime: number; + export let cleanMedia: (media: Media[], displayUnresolved: boolean) => Media[]; + export let animeLists: Promise<Media[]>; + export let user: AniListAuthorisation; + export let identity: UserIdentity; + export let title: string; + export let completed = false; + + let lastUpdatedMedia = -1; + let previousAnimeList: Media[]; + let pendingUpdate: number | null = null; +</script> + +{#await animeLists} + {#if previousAnimeList} + <CleanAnimeList + media={previousAnimeList} + {title} + bind:animeLists + {user} + {identity} + {endTime} + bind:lastUpdatedMedia + {completed} + bind:previousAnimeList + disableIncrement + bind:pendingUpdate + /> + {:else} + <ListTitle custom={title} /> + + <ul><li>Loading ...</li></ul> + {/if} +{:then media} + {@const cleanedMedia = cleanMedia(media, $settings.displayUnresolved)} + + <CleanAnimeList + media={cleanedMedia} + {title} + bind:animeLists + {user} + {identity} + {endTime} + bind:lastUpdatedMedia + {completed} + bind:previousAnimeList + bind:pendingUpdate + /> +{:catch} + <ListTitle time={0} count={-1337} custom={title} /> + + <Error /> +{/await} |