diff options
| author | Fuwn <[email protected]> | 2026-03-01 16:13:28 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-03-01 16:13:45 -0800 |
| commit | 8510a4b87bd493d4451072c2e6b4fec6596d29c3 (patch) | |
| tree | 1a627753dd136d46ac3d7c098d72a43c8e73d66f /src/lib/Tools/Wrapped | |
| parent | chore(biome): enable svelte formatting (diff) | |
| download | due.moe-8510a4b87bd493d4451072c2e6b4fec6596d29c3.tar.xz due.moe-8510a4b87bd493d4451072c2e6b4fec6596d29c3.zip | |
chore(biome): enable svelte linting
Diffstat (limited to 'src/lib/Tools/Wrapped')
| -rw-r--r-- | src/lib/Tools/Wrapped/Tool.svelte | 59 |
1 files changed, 30 insertions, 29 deletions
diff --git a/src/lib/Tools/Wrapped/Tool.svelte b/src/lib/Tools/Wrapped/Tool.svelte index 3f13b483..7ce50ac3 100644 --- a/src/lib/Tools/Wrapped/Tool.svelte +++ b/src/lib/Tools/Wrapped/Tool.svelte @@ -14,7 +14,7 @@ import { Type, mediaListCollection, type Media } from '$lib/Data/AniList/media'; import anime from '$stores/anime'; import lastPruneTimes from '$stores/lastPruneTimes'; import manga from '$stores/manga'; -import Error from '$lib/Error/RateLimited.svelte'; +import RateLimitedError from '$lib/Error/RateLimited.svelte'; import { domToBlob } from 'modern-screenshot'; import { browser } from '$app/environment'; import { page } from '$app/stores'; @@ -87,6 +87,7 @@ let lastUseFullActivityHistory = useFullActivityHistory; let lastDisableLoopingActivityCounter = disableLoopingActivityCounter; let lastStartDateFilter: Date | null = startDateFilter; let lastEndDateFilter: Date | null = endDateFilter; +const touch = (...values: unknown[]) => values; $: { if (browser && mounted) { @@ -136,32 +137,32 @@ $: { } $: { - includeMusic = includeMusic; - includeSpecials = includeSpecials; - includeRepeats = includeRepeats; - disableActivityHistory = disableActivityHistory; - highestRatedMediaPercentage = highestRatedMediaPercentage; - highestRatedGenreTagPercentage = highestRatedGenreTagPercentage; - topGenresTags = topGenresTags; - genreTagsSort = genreTagsSort; - mediaSort = mediaSort; - includeMovies = includeMovies; - includeOVAs = includeOVAs; - selectedYear = selectedYear; - includeOngoingMediaFromPreviousYears = includeOngoingMediaFromPreviousYears; - excludeUnratedUnwatched = excludeUnratedUnwatched; + touch( + includeMusic, + includeSpecials, + includeRepeats, + disableActivityHistory, + highestRatedMediaPercentage, + highestRatedGenreTagPercentage, + topGenresTags, + genreTagsSort, + mediaSort, + includeMovies, + includeOVAs, + selectedYear, + includeOngoingMediaFromPreviousYears, + excludeUnratedUnwatched + ); if (shouldFetchData) update().then(updateWidth).catch(updateWidth); } $: { - animeList = animeList; - mangaList = mangaList; - highestRatedCount = highestRatedCount; + touch(animeList, mangaList, highestRatedCount); new Promise((resolve) => setTimeout(resolve, 1)).then(updateWidth); } $: { - genreTagCount = genreTagCount; + touch(genreTagCount); if (animeList && mangaList) topMedia = tops( @@ -174,7 +175,7 @@ $: { new Promise((resolve) => setTimeout(resolve, 1)).then(updateWidth); } $: { - excludedKeywords = excludedKeywords; + touch(excludedKeywords); if (excludedKeywords.length > 0 && animeList !== undefined && mangaList !== undefined) { animeList = originalAnimeList; @@ -216,7 +217,7 @@ $: mangaMostTitle = (() => { } })(); -const updateWidth = () => { +function updateWidth() { if (!browser) return; const wrappedContainer = document.querySelector('#wrapped') as HTMLElement; @@ -263,7 +264,7 @@ const updateWidth = () => { reset(); reset(); -}; +} onMount(async () => { clearAllParameters([ @@ -407,7 +408,7 @@ const dummyActivities: ActivityHistoryEntry[] = []; const dummyAnimeList: Media[] = [createDummyMedia('ANIME')]; const dummyMangaList: Media[] = [createDummyMedia('MANGA')]; -const update = async () => { +async function update() { if ($userIdentity.id === -1) return; let rawAnimeList = await mediaListCollection( @@ -601,7 +602,7 @@ const update = async () => { } for (const media of calculatedMangaList) chapters += media.mediaListEntry?.progress || 0; -}; +} /* eslint-disable @typescript-eslint/no-explicit-any */ // const year = (statistic: { startYears: any }) => @@ -684,7 +685,7 @@ const submitExcludedKeywords = () => { .filter((k) => k.length > 0); }; -const excludeKeywords = (media: Media[]) => { +function excludeKeywords(media: Media[]) { if (excludedKeywords.length <= 0) return media; return media.filter((m) => { @@ -696,7 +697,7 @@ const excludeKeywords = (media: Media[]) => { return true; }); -}; +} const pruneFullYear = async () => { await database.activities.bulkDelete((await database.activities.toArray()).map((m) => m.page)); @@ -814,10 +815,10 @@ const pruneFullYear = async () => { </div> </div> {:catch} - <Error type="User" card list={false} /> + <RateLimitedError type="User" card list={false} /> {/await} {:catch} - <Error + <RateLimitedError card type={`${useFullActivityHistory ? 'Full-year activity' : 'Activity'} history`} loginSessionError={!useFullActivityHistory} @@ -830,7 +831,7 @@ const pruneFullYear = async () => { your local activity history database. </p> {/if} - </Error> + </RateLimitedError> {/await} {/key} {:else} |