diff options
| author | Fuwn <[email protected]> | 2024-10-09 00:41:20 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2024-10-09 00:41:43 -0700 |
| commit | 998b63a35256ac985a5a2714dd1ca451af4dfd8a (patch) | |
| tree | 50796121a9d5ab0330fdc5d7e098bda2860d9726 /src/lib/Tools/SequelCatcher | |
| parent | feat(graphql): add badgeCount field (diff) | |
| download | due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.tar.xz due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.zip | |
chore(prettier): use spaces instead of tabs
Diffstat (limited to 'src/lib/Tools/SequelCatcher')
| -rw-r--r-- | src/lib/Tools/SequelCatcher/List.svelte | 126 | ||||
| -rw-r--r-- | src/lib/Tools/SequelCatcher/Tool.svelte | 132 |
2 files changed, 129 insertions, 129 deletions
diff --git a/src/lib/Tools/SequelCatcher/List.svelte b/src/lib/Tools/SequelCatcher/List.svelte index 8205b8c7..009df219 100644 --- a/src/lib/Tools/SequelCatcher/List.svelte +++ b/src/lib/Tools/SequelCatcher/List.svelte @@ -1,27 +1,27 @@ <script lang="ts"> - import { filterRelations, type Media } from '$lib/Data/AniList/media'; - import MediaTitleDisplay from '$lib/List/MediaTitleDisplay.svelte'; - import { outboundLink } from '$lib/Media/links'; - import settings from '$stores/settings'; + import { filterRelations, type Media } from '$lib/Data/AniList/media'; + import MediaTitleDisplay from '$lib/List/MediaTitleDisplay.svelte'; + import { outboundLink } from '$lib/Media/links'; + import settings from '$stores/settings'; - export let mediaListUnchecked: Media[]; + export let mediaListUnchecked: Media[]; - let includeCurrent = false; - let includeSideStories = false; + let includeCurrent = false; + let includeSideStories = false; - const matchCheck = (media: Media | undefined, swap = false) => - (media && - media.mediaListEntry && - media.mediaListEntry?.status !== 'CURRENT' && - media.mediaListEntry?.status !== 'REPEATING' && - media.mediaListEntry?.status !== 'PAUSED') || - !media - ? swap - ? undefined - : media - : swap - ? media - : undefined; + const matchCheck = (media: Media | undefined, swap = false) => + (media && + media.mediaListEntry && + media.mediaListEntry?.status !== 'CURRENT' && + media.mediaListEntry?.status !== 'REPEATING' && + media.mediaListEntry?.status !== 'PAUSED') || + !media + ? swap + ? undefined + : media + : swap + ? media + : undefined; </script> <input type="checkbox" bind:checked={includeCurrent} /> Include current (watching, rewatching, @@ -33,57 +33,57 @@ specials, etc.) <p /> <ol class="media-list"> - {#each filterRelations( mediaListUnchecked.filter((media) => media.mediaListEntry?.status === 'COMPLETED'), includeSideStories ) as { media, unwatchedRelations }} - {#if unwatchedRelations.filter( (relation) => matchCheck(mediaListUnchecked.find((media) => media.id === relation.node.id)) ).length !== 0 || includeCurrent} - <li> - <a href={outboundLink(media, 'anime', $settings.displayOutboundLinksTo)} target="_blank"> - <MediaTitleDisplay title={media.title} /> - </a> + {#each filterRelations( mediaListUnchecked.filter((media) => media.mediaListEntry?.status === 'COMPLETED'), includeSideStories ) as { media, unwatchedRelations }} + {#if unwatchedRelations.filter( (relation) => matchCheck(mediaListUnchecked.find((media) => media.id === relation.node.id)) ).length !== 0 || includeCurrent} + <li> + <a href={outboundLink(media, 'anime', $settings.displayOutboundLinksTo)} target="_blank"> + <MediaTitleDisplay title={media.title} /> + </a> - <span class="opaque"> - ({media.startDate.year}) - </span> + <span class="opaque"> + ({media.startDate.year}) + </span> - <ol class="unwatched-relations-list"> - {#each unwatchedRelations as relation} - {@const hit = matchCheck( - mediaListUnchecked.find((media) => media.id === relation.node.id), - true - )} + <ol class="unwatched-relations-list"> + {#each unwatchedRelations as relation} + {@const hit = matchCheck( + mediaListUnchecked.find((media) => media.id === relation.node.id), + true + )} - {#if matchCheck(mediaListUnchecked.find((media) => media.id === relation.node.id)) || includeCurrent} - <li> - <a - href={outboundLink(relation.node, 'anime', $settings.displayOutboundLinksTo)} - target="_blank" - > - <MediaTitleDisplay title={relation.node.title} /> - </a> + {#if matchCheck(mediaListUnchecked.find((media) => media.id === relation.node.id)) || includeCurrent} + <li> + <a + href={outboundLink(relation.node, 'anime', $settings.displayOutboundLinksTo)} + target="_blank" + > + <MediaTitleDisplay title={relation.node.title} /> + </a> - {#if hit && hit.mediaListEntry && hit.mediaListEntry.progress > 0} - <span class="opaque">|</span> + {#if hit && hit.mediaListEntry && hit.mediaListEntry.progress > 0} + <span class="opaque">|</span> - {hit.mediaListEntry.progress}/{#if hit.episodes}{hit.episodes}{:else}?{/if} - {/if} + {hit.mediaListEntry.progress}/{#if hit.episodes}{hit.episodes}{:else}?{/if} + {/if} - <span class="opaque"> - ({relation.node.startDate.year}) - </span> - </li> - {/if} - {/each} - </ol> - </li> - {/if} - {/each} + <span class="opaque"> + ({relation.node.startDate.year}) + </span> + </li> + {/if} + {/each} + </ol> + </li> + {/if} + {/each} </ol> <style> - .media-list li { - margin-bottom: 1rem; - } + .media-list li { + margin-bottom: 1rem; + } - .unwatched-relations-list li:not(:last-child) { - margin-bottom: 0 !important; - } + .unwatched-relations-list li:not(:last-child) { + margin-bottom: 0 !important; + } </style> diff --git a/src/lib/Tools/SequelCatcher/Tool.svelte b/src/lib/Tools/SequelCatcher/Tool.svelte index 06d635b3..a954b4d7 100644 --- a/src/lib/Tools/SequelCatcher/Tool.svelte +++ b/src/lib/Tools/SequelCatcher/Tool.svelte @@ -1,80 +1,80 @@ <script lang="ts"> - import List from './List.svelte'; - import type { AniListAuthorisation } from '$lib/Data/AniList/identity'; - import userIdentity from '$stores/identity'; - import { type Media, mediaListCollection, Type } from '$lib/Data/AniList/media'; - import LogInRestricted from '$lib/Error/LogInRestricted.svelte'; - import anime from '$stores/anime'; - import identity from '$stores/identity'; - import { onMount } from 'svelte'; - import lastPruneTimes from '$stores/lastPruneTimes'; - import Message from '$lib/Loading/Message.svelte'; - import Skeleton from '$lib/Loading/Skeleton.svelte'; - import Username from '$lib/Layout/Username.svelte'; + import List from './List.svelte'; + import type { AniListAuthorisation } from '$lib/Data/AniList/identity'; + import userIdentity from '$stores/identity'; + import { type Media, mediaListCollection, Type } from '$lib/Data/AniList/media'; + import LogInRestricted from '$lib/Error/LogInRestricted.svelte'; + import anime from '$stores/anime'; + import identity from '$stores/identity'; + import { onMount } from 'svelte'; + import lastPruneTimes from '$stores/lastPruneTimes'; + import Message from '$lib/Loading/Message.svelte'; + import Skeleton from '$lib/Loading/Skeleton.svelte'; + import Username from '$lib/Layout/Username.svelte'; - export let user: AniListAuthorisation; + export let user: AniListAuthorisation; - let mediaList: Promise<Media[]>; + let mediaList: Promise<Media[]>; - onMount(async () => { - if (user === undefined || $identity.id === -2) return; + onMount(async () => { + if (user === undefined || $identity.id === -2) return; - mediaList = mediaListCollection( - user, - $userIdentity, - Type.Anime, - $anime, - $lastPruneTimes.anime, - { - forcePrune: true, - includeCompleted: true, - all: true, - includeRelations: true - } - ); - }); + mediaList = mediaListCollection( + user, + $userIdentity, + Type.Anime, + $anime, + $lastPruneTimes.anime, + { + forcePrune: true, + includeCompleted: true, + all: true, + includeRelations: true + } + ); + }); </script> {#if user === undefined || $identity.id === -2} - <LogInRestricted /> + <LogInRestricted /> {:else} - <div class="card"> - {#await mediaList} - <Message message="Cross-checking media ..." /> + <div class="card"> + {#await mediaList} + <Message message="Cross-checking media ..." /> - <Skeleton - card={false} - count={8} - pad={false} - height={'0.9rem'} - width={'100%'} - list - grid={false} - /> - {:then mediaListUnchecked} - {#if mediaListUnchecked} - <List {mediaListUnchecked} /> - {:else} - <Message message="Cross-checking media ..." /> + <Skeleton + card={false} + count={8} + pad={false} + height={'0.9rem'} + width={'100%'} + list + grid={false} + /> + {:then mediaListUnchecked} + {#if mediaListUnchecked} + <List {mediaListUnchecked} /> + {:else} + <Message message="Cross-checking media ..." /> - <Skeleton - card={false} - count={8} - pad={false} - height={'0.9rem'} - width={'100%'} - list - grid={false} - /> - {/if} - {:catch} - <Message message="" loader="ripple" slot withReload fullscreen>Error fetching media.</Message> - {/await} + <Skeleton + card={false} + count={8} + pad={false} + height={'0.9rem'} + width={'100%'} + list + grid={false} + /> + {/if} + {:catch} + <Message message="" loader="ripple" slot withReload fullscreen>Error fetching media.</Message> + {/await} - <p /> + <p /> - <blockquote style="margin: 0 0 0 1.5rem;"> - Thanks to <Username username="sevengirl" /> and <Username username="esthereae" /> for the idea! - </blockquote> - </div> + <blockquote style="margin: 0 0 0 1.5rem;"> + Thanks to <Username username="sevengirl" /> and <Username username="esthereae" /> for the idea! + </blockquote> + </div> {/if} |