aboutsummaryrefslogtreecommitdiff
path: root/src/lib/List
diff options
context:
space:
mode:
Diffstat (limited to 'src/lib/List')
-rw-r--r--src/lib/List/Due/AnimeList.svelte26
-rw-r--r--src/lib/List/Due/MangaList.svelte29
-rw-r--r--src/lib/List/UpcomingAnimeList.svelte26
-rw-r--r--src/lib/List/WatchingAnimeList.svelte26
4 files changed, 84 insertions, 23 deletions
diff --git a/src/lib/List/Due/AnimeList.svelte b/src/lib/List/Due/AnimeList.svelte
index 5024f8c2..83511ca0 100644
--- a/src/lib/List/Due/AnimeList.svelte
+++ b/src/lib/List/Due/AnimeList.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
/* eslint svelte/no-at-html-tags: "off" */
- import { mediaListCollection, Type, flattenLists, type Media } from '$lib/AniList/media';
+ 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';
@@ -12,7 +12,7 @@
export let identity: UserIdentity;
export let displayUnresolved: boolean;
- let animeLists: Promise<{ entries: { media: Media }[] }[]>;
+ let animeLists: Promise<Media[]>;
let startTime: number;
let endTime: number;
@@ -38,13 +38,12 @@
clearInterval(keyCacher);
});
- const cleanMedia = (media: { entries: { media: Media }[] }[], displayUnresolved: boolean) => {
+ const cleanMedia = (media: Media[], displayUnresolved: boolean) => {
if (media === undefined) {
return [];
}
- const flattenedLists = flattenLists(media);
- const releasingMedia = flattenedLists.filter(
+ const releasingMedia = media.filter(
(media: Media) =>
media.status == 'RELEASING' &&
(media.mediaListEntry || { status: 'DROPPED' }).status !=
@@ -152,6 +151,17 @@
);
});
};
+
+ const cleanCache = () => {
+ animeLists = mediaListCollection(
+ user,
+ identity,
+ Type.Anime,
+ $anime,
+ $lastPruneTimes.anime,
+ true
+ );
+ };
</script>
{#await animeLists}
@@ -166,6 +176,12 @@
<small style="opacity: 50%">{endTime / 1000}s</small></summary
>
+ {#if cleanedMedia.length === 0}
+ <ul>
+ <li>No anime to display. <a href={'#'} on:click={cleanCache}>Force refresh</a></li>
+ </ul>
+ {/if}
+
<ul>
{#each cleanedMedia as anime}
<li>
diff --git a/src/lib/List/Due/MangaList.svelte b/src/lib/List/Due/MangaList.svelte
index e7a1321f..379ec228 100644
--- a/src/lib/List/Due/MangaList.svelte
+++ b/src/lib/List/Due/MangaList.svelte
@@ -1,5 +1,5 @@
<script lang="ts">
- import { mediaListCollection, Type, flattenLists, type Media } from '$lib/AniList/media';
+ 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/mangadex';
@@ -12,7 +12,7 @@
export let identity: UserIdentity;
export let displayUnresolved: boolean;
- let mangaLists: Promise<{ entries: { media: Media }[] }[]>;
+ let mangaLists: Promise<Media[]>;
let startTime: number;
let endTime: number;
@@ -31,10 +31,7 @@
clearInterval(keyCacher);
});
- const cleanMedia = async (
- media: { entries: { media: Media }[] }[],
- displayUnresolved: boolean
- ) => {
+ const cleanMedia = async (media: Media[], displayUnresolved: boolean) => {
if (media === undefined) {
return [];
}
@@ -54,8 +51,7 @@
}
}
- const flattenedLists = flattenLists(media);
- const releasingMedia = flattenedLists.filter(
+ const releasingMedia = media.filter(
(media: Media) =>
media.status == 'RELEASING' &&
media.format != 'NOVEL' &&
@@ -117,6 +113,17 @@
);
});
};
+
+ const cleanCache = () => {
+ mangaLists = mediaListCollection(
+ user,
+ identity,
+ Type.Manga,
+ $manga,
+ $lastPruneTimes.manga,
+ true
+ );
+ };
</script>
{#await mangaLists}
@@ -134,6 +141,12 @@
<small style="opacity: 50%">{endTime / 1000}s</small>
</summary>
+ {#if cleanedMedia.length === 0}
+ <ul>
+ <li>No manga to display. <a href={'#'} on:click={cleanCache}>Force refresh</a></li>
+ </ul>
+ {/if}
+
<ul>
{#each cleanedMedia as manga}
<li>
diff --git a/src/lib/List/UpcomingAnimeList.svelte b/src/lib/List/UpcomingAnimeList.svelte
index 8eee9e48..679a38d7 100644
--- a/src/lib/List/UpcomingAnimeList.svelte
+++ b/src/lib/List/UpcomingAnimeList.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
/* eslint svelte/no-at-html-tags: "off" */
- import { mediaListCollection, Type, flattenLists, type Media } from '$lib/AniList/media';
+ 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';
@@ -12,7 +12,7 @@
export let identity: UserIdentity;
export let displayUnresolved: boolean;
- let animeLists: Promise<{ entries: { media: Media }[] }[]>;
+ let animeLists: Promise<Media[]>;
let startTime: number;
let endTime: number;
@@ -21,13 +21,12 @@
animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $lastPruneTimes.anime);
});
- const cleanMedia = (media: { entries: { media: Media }[] }[], displayUnresolved: boolean) => {
+ const cleanMedia = (media: Media[], displayUnresolved: boolean) => {
if (media === undefined) {
return [];
}
- const flattenedLists = flattenLists(media);
- const releasingMedia = flattenedLists.filter(
+ const releasingMedia = media.filter(
(media: Media) => media.status == 'RELEASING' && media.nextAiringEpisode !== null
/* &&
(media['mediaListEntry'] || { progress: 0 })['progress'] >=
@@ -107,6 +106,17 @@
const totalEpisodes = (anime: Media) => {
return anime.episodes === null ? '' : `<span style="opacity: 50%">/${anime.episodes}</span>`;
};
+
+ const cleanCache = () => {
+ animeLists = mediaListCollection(
+ user,
+ identity,
+ Type.Anime,
+ $anime,
+ $lastPruneTimes.anime,
+ true
+ );
+ };
</script>
{#await animeLists}
@@ -121,6 +131,12 @@
<small style="opacity: 50%">{endTime / 1000}s</small></summary
>
+ {#if cleanedMedia.length === 0}
+ <ul>
+ <li>No anime to display. <a href={'#'} on:click={cleanCache}>Force refresh</a></li>
+ </ul>
+ {/if}
+
<ul>
{#each cleanedMedia as anime}
<li>
diff --git a/src/lib/List/WatchingAnimeList.svelte b/src/lib/List/WatchingAnimeList.svelte
index 52e3c505..fc8909c1 100644
--- a/src/lib/List/WatchingAnimeList.svelte
+++ b/src/lib/List/WatchingAnimeList.svelte
@@ -1,7 +1,7 @@
<script lang="ts">
/* eslint svelte/no-at-html-tags: "off" */
- import { mediaListCollection, Type, flattenLists, type Media } from '$lib/AniList/media';
+ 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';
@@ -11,7 +11,7 @@
export let user: AniListAuthorisation;
export let identity: UserIdentity;
- let animeLists: Promise<{ entries: { media: Media }[] }[]>;
+ let animeLists: Promise<Media[]>;
let startTime: number;
let endTime: number;
@@ -20,13 +20,12 @@
animeLists = mediaListCollection(user, identity, Type.Anime, $anime, $lastPruneTimes.anime);
});
- const cleanMedia = (media: { entries: { media: Media }[] }[]) => {
+ const cleanMedia = (media: Media[]) => {
if (media === undefined) {
return [];
}
- const flattenedLists = flattenLists(media);
- const releasingMedia = flattenedLists.filter(
+ const releasingMedia = media.filter(
(media: Media) =>
media.status !== 'RELEASING' &&
media.status !== 'NOT_YET_RELEASED' &&
@@ -81,6 +80,17 @@
);
});
};
+
+ const cleanCache = () => {
+ animeLists = mediaListCollection(
+ user,
+ identity,
+ Type.Anime,
+ $anime,
+ $lastPruneTimes.anime,
+ true
+ );
+ };
</script>
{#await animeLists}
@@ -95,6 +105,12 @@
<small style="opacity: 50%">{endTime / 1000}s</small></summary
>
+ {#if cleanedMedia.length === 0}
+ <ul>
+ <li>No anime to display. <a href={'#'} on:click={cleanCache}>Force refresh</a></li>
+ </ul>
+ {/if}
+
<ul>
{#each cleanedMedia as anime}
<li>