diff options
Diffstat (limited to 'src/lib/List/Anime/CleanAnimeList.svelte')
| -rw-r--r-- | src/lib/List/Anime/CleanAnimeList.svelte | 106 |
1 files changed, 54 insertions, 52 deletions
diff --git a/src/lib/List/Anime/CleanAnimeList.svelte b/src/lib/List/Anime/CleanAnimeList.svelte index 567dd2da..a17ad67c 100644 --- a/src/lib/List/Anime/CleanAnimeList.svelte +++ b/src/lib/List/Anime/CleanAnimeList.svelte @@ -17,7 +17,6 @@ export let lastUpdatedMedia: number; export let completed = false; export let previousAnimeList: Media[]; - export let disableIncrement = false; export let pendingUpdate: number | null; </script> @@ -36,61 +35,64 @@ <ul> {#each media as anime} {@const progress = (anime.mediaListEntry || { progress: 0 }).progress} - <li> - <a - href={$settings.linkToLiveChart - ? `https://www.livechart.me/search?q=${ - anime.title.native || anime.title.english || anime.title.romaji - }` - : `https://anilist.co/anime/${anime.id}`} - target="_blank" - > - <span - style={lastUpdatedMedia === anime.id && anime.episodes !== progress - ? 'color: lightcoral' - : ''} - > - <MediaTitle title={anime.title} /> - </span> - </a> - {#if $settings.displaySocialButton} - [<a href={`https://anilist.co/anime/${anime.id}/social`} target="_blank">S</a>] - {/if} - <span style="opacity: 50%;">|</span> - {#if title !== 'Upcoming Episodes'} - <!-- {anime.mediaListEntry?.progress || 0}{@html totalEpisodes(anime)} --> - {pendingUpdate === anime.id ? progress + 1 : progress}{@html totalEpisodes(anime)} + + {#if title === 'Upcoming Episodes' || progress !== (anime.nextAiringEpisode?.episode || 9999) - 1} + <li> <a - href={'#'} - style={disableIncrement ? 'pointer-events: none; opacity: 50%;' : ''} - on:click={() => { - if (!disableIncrement) { - lastUpdatedMedia = anime.id; - pendingUpdate = anime.id; + href={$settings.linkToLiveChart + ? `https://www.livechart.me/search?q=${ + anime.title.native || anime.title.english || anime.title.romaji + }` + : `https://anilist.co/anime/${anime.id}`} + target="_blank" + > + <span + style={lastUpdatedMedia === anime.id && anime.episodes !== progress + ? 'color: lightcoral' + : ''} + > + <MediaTitle title={anime.title} /> + </span> + </a> + {#if $settings.displaySocialButton} + [<a href={`https://anilist.co/anime/${anime.id}/social`} target="_blank">S</a>] + {/if} + <span style="opacity: 50%;">|</span> + {#if title !== 'Upcoming Episodes'} + <!-- {anime.mediaListEntry?.progress || 0}{@html totalEpisodes(anime)} --> + {pendingUpdate === anime.id ? progress + 1 : progress}{@html totalEpisodes(anime)} + <a + href={'#'} + style={pendingUpdate === anime.id ? 'pointer-events: none; opacity: 50%;' : ''} + on:click={() => { + if (pendingUpdate !== anime.id) { + lastUpdatedMedia = anime.id; + pendingUpdate = anime.id; - updateMedia(anime.id, anime.mediaListEntry?.progress, () => { - const mediaListEntry = media.find((m) => m.id === anime.id)?.mediaListEntry; + updateMedia(anime.id, anime.mediaListEntry?.progress, () => { + const mediaListEntry = media.find((m) => m.id === anime.id)?.mediaListEntry; - if (mediaListEntry) { - mediaListEntry.progress = progress + 1; - } + if (mediaListEntry) { + mediaListEntry.progress = progress + 1; + } - previousAnimeList = media; - animeLists = cleanCache(user, identity); - pendingUpdate = null; - }); - } - }}>+</a - > - {#if !completed} - [{anime.nextAiringEpisode?.episode === -1 - ? '?' - : (anime.nextAiringEpisode?.episode || 1) - 1}] - {@html airingTime(anime)} + previousAnimeList = media; + animeLists = cleanCache(user, identity); + pendingUpdate = null; + }); + } + }}>+</a + > + {#if !completed} + [{anime.nextAiringEpisode?.episode === -1 + ? '?' + : (anime.nextAiringEpisode?.episode || 1) - 1}] + {@html airingTime(anime)} + {/if} + {:else} + {@html airingTime(anime, true)} {/if} - {:else} - {@html airingTime(anime, true)} - {/if} - </li> + </li> + {/if} {/each} </ul> |