From 4ae25847a2c13a703babb90443efe536250d8156 Mon Sep 17 00:00:00 2001 From: Fuwn Date: Thu, 4 Jan 2024 17:51:15 -0800 Subject: refactor(tools): better cards --- src/lib/Tools/ActivityHistory/Tool.svelte | 18 ++-- src/lib/Tools/Birthdays.svelte | 3 +- src/lib/Tools/EpisodeDiscussionCollector.svelte | 114 +++++++++++----------- src/lib/Tools/RandomFollower.svelte | 88 ++++++++--------- src/lib/Tools/SequelSpy.svelte | 88 ++++++++--------- src/lib/Tools/Wrapped.svelte | 122 ++++++++++++------------ 6 files changed, 224 insertions(+), 209 deletions(-) (limited to 'src/lib/Tools') diff --git a/src/lib/Tools/ActivityHistory/Tool.svelte b/src/lib/Tools/ActivityHistory/Tool.svelte index fe0b4237..5985e5c8 100644 --- a/src/lib/Tools/ActivityHistory/Tool.svelte +++ b/src/lib/Tools/ActivityHistory/Tool.svelte @@ -83,17 +83,21 @@ {:else} {@const filledActivities = fillMissingDays(activities)} - +
+ -

+

-

+
- {#if generated} -

- {/if} + {#if generated} +

+ {/if} -

+ +
+ +

diff --git a/src/lib/Tools/Birthdays.svelte b/src/lib/Tools/Birthdays.svelte index 10738e91..eda5e90e 100644 --- a/src/lib/Tools/Birthdays.svelte +++ b/src/lib/Tools/Birthdays.svelte @@ -109,7 +109,7 @@
{#each birthdays as birthday} -
+
diff --git a/src/lib/Tools/EpisodeDiscussionCollector.svelte b/src/lib/Tools/EpisodeDiscussionCollector.svelte index 447333a8..2399b125 100644 --- a/src/lib/Tools/EpisodeDiscussionCollector.svelte +++ b/src/lib/Tools/EpisodeDiscussionCollector.svelte @@ -9,62 +9,64 @@ onMount(clearAllParameters); -

- - { - if (e.key === 'Enter') { - searchInputFinal = searchInput; +

+

+ + { + if (e.key === 'Enter') { + searchInputFinal = searchInput; - // eslint-disable-next-line no-undef - umami.track('Collect Episode Discussions'); - } - }} - /> - -

+ // eslint-disable-next-line no-undef + umami.track('Collect Episode Discussions'); + } + }} + /> + +

-{#if searchInputFinal !== ''} - {#await threads(searchInputFinal)} - Loading forum threads ... 50% - {:then threads} -
- {:catch} -

- Threads could not be loaded. You might have been rate limited. -

-

- Try again in a few minutes. If the problem persists, please contact @fuwn on AniList. -

- {/await} -{:else} -

+ {#if searchInputFinal !== ''} + {#await threads(searchInputFinal)} + Loading forum threads ... 50% + {:then threads} +

    + {#each threads + .filter((thread) => thread.title.includes('[Spoilers]') && thread.title.includes('Episode')) + .sort((a, b) => b.createdAt - a.createdAt) as thread} +
  • + + {thread.title.replace('[Spoilers]', '')} + +
  • + {/each} +
+ {:catch} +

+ Threads could not be loaded. You might have been rate limited. +

+

+ Try again in a few minutes. If the problem persists, please contact @fuwn on AniList. +

+ {/await} + {:else} +

- Enter a username to search for to continue. -{/if} + Enter a username to search for to continue. + {/if} +

diff --git a/src/lib/Tools/RandomFollower.svelte b/src/lib/Tools/RandomFollower.svelte index 88c1bd85..7824a424 100644 --- a/src/lib/Tools/RandomFollower.svelte +++ b/src/lib/Tools/RandomFollower.svelte @@ -11,48 +11,50 @@ onMount(clearAllParameters); -

- - { - if (e.key === 'Enter') { - submit = input; - randomSeed = Math.random(); - - // eslint-disable-next-line no-undef - umami.track('Random Follower'); - } - }} - /> - -

- -{#if submit !== ''} - {#await followers(submit)} - Loading followers ... 50% - {:then users} - {@const user = users[Math.floor(randomSeed * users.length)]} - +
+

+ + { + if (e.key === 'Enter') { + submit = input; + randomSeed = Math.random(); + + // eslint-disable-next-line no-undef + umami.track('Random Follower'); + } + }} + /> + +

+ + {#if submit !== ''} + {#await followers(submit)} + Loading followers ... 50% + {:then users} + {@const user = users[Math.floor(randomSeed * users.length)]} + +

+ + + {user.name} + + {:catch} + + {/await} + {:else}

- - {user.name} - - {:catch} - - {/await} -{:else} -

- - Enter a username to search for to continue. -{/if} + Enter a username to search for to continue. + {/if} +

diff --git a/src/lib/Tools/SequelSpy.svelte b/src/lib/Tools/SequelSpy.svelte index c5d9c4a2..ea6f74d8 100644 --- a/src/lib/Tools/SequelSpy.svelte +++ b/src/lib/Tools/SequelSpy.svelte @@ -40,54 +40,56 @@ airingTime(prequel as unknown as Media, null); -

- - -

+
+

+ + +

-{#await currentPrequels} -

Loading prequels ... 50%

-{:then currentPrequels} -
    - {#each currentPrequels as prequel} -
  • { - const response = onMouseEnter(prequel); + {#await currentPrequels} +

    Loading prequels ... 50%

    + {:then currentPrequels} +
      + {#each currentPrequels as prequel} +
    • { + const response = onMouseEnter(prequel); - hovering = response.hovering; - hoveredMedia = response.media; - }} - on:mouseleave={() => { - const response = onMouseLeave(); + hovering = response.hovering; + hoveredMedia = response.media; + }} + on:mouseleave={() => { + const response = onMouseLeave(); - hovering = response.hovering; - hoveredMedia = response.media; - }} - on:mousemove={(e) => { - const response = onMouseMove(e); + hovering = response.hovering; + hoveredMedia = response.media; + }} + on:mousemove={(e) => { + const response = onMouseMove(e); - imageStyle = response.style; - }} - > - - - - | - {prequel.seen}/{prequel.episodes} - {@html prequelAiringTime(prequel)} -
    • - {/each} -
    -{/await} + imageStyle = response.style; + }} + > + + + + | + {prequel.seen}/{prequel.episodes} + {@html prequelAiringTime(prequel)} +
  • + {/each} +
+ {/await} -

+

-The count ratio is the number of episodes you've seen of any direct prequels, and the total number -of episodes of all direct prequels. + The count ratio is the number of episodes you've seen of any direct prequels, and the total number + of episodes of all direct prequels. +

diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte index 83b58cd1..0cd124a2 100644 --- a/src/lib/Tools/Wrapped.svelte +++ b/src/lib/Tools/Wrapped.svelte @@ -493,54 +493,56 @@ {@html nbsp('Loading user data ...')} {:then wrapped}
-
- {#if !disableActivityHistory && activityHistoryPosition === 'TOP' && activities.length > 0 && selectedYear === currentYear} - - {/if} -
- +
+ {#if !disableActivityHistory && activityHistoryPosition === 'TOP' && activities.length > 0 && selectedYear === currentYear} + + {/if} +
+ + + +
+ {#if !disableActivityHistory && activityHistoryPosition === 'BELOW_TOP' && activities.length > 0 && selectedYear === currentYear} + + {/if} + - - + {#if topMedia && topGenresTags && ((topMedia.topGenreMedia && topMedia.genres.length > 0) || (topMedia.topTagMedia && topMedia.tags.length > 0))} + + {/if} + {#if !disableActivityHistory && activityHistoryPosition === 'ORIGINAL' && activities.length > 0 && selectedYear === currentYear} + + {/if} + {#if watermark} + + {/if}
- {#if !disableActivityHistory && activityHistoryPosition === 'BELOW_TOP' && activities.length > 0 && selectedYear === currentYear} - - {/if} - - {#if topMedia && topGenresTags && ((topMedia.topGenreMedia && topMedia.genres.length > 0) || (topMedia.topTagMedia && topMedia.tags.length > 0))} - - {/if} - {#if !disableActivityHistory && activityHistoryPosition === 'ORIGINAL' && activities.length > 0 && selectedYear === currentYear} - - {/if} - {#if watermark} - - {/if}

@@ -549,6 +551,22 @@

+
+
+ + {#if generated} +

+ +

+ Click on the image to download, or right click and select "Save Image As...". +
+ {/if} +
+ + {#if generated} +

+ {/if} +

Options
@@ -596,8 +614,6 @@ Width adjustment
-

-

Calculation @@ -647,18 +663,6 @@
- -

- -

- - {#if generated} -

- -

- Click on the image to download, or right click and select "Save Image As...". -
- {/if}
{:catch} -- cgit v1.2.3