aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Tools
diff options
context:
space:
mode:
authorFuwn <[email protected]>2023-12-31 21:09:47 -0800
committerFuwn <[email protected]>2023-12-31 21:09:47 -0800
commit4b454dabd0ede98dcb75cc80cf88c0a06d678923 (patch)
treec41f862e311053184e02a94be092f4af6051142a /src/lib/Tools
parentfix(wrapped): overflow on mobile (diff)
downloaddue.moe-4b454dabd0ede98dcb75cc80cf88c0a06d678923.tar.xz
due.moe-4b454dabd0ede98dcb75cc80cf88c0a06d678923.zip
feat(wrapped): select year
Diffstat (limited to 'src/lib/Tools')
-rw-r--r--src/lib/Tools/Wrapped.svelte33
1 files changed, 23 insertions, 10 deletions
diff --git a/src/lib/Tools/Wrapped.svelte b/src/lib/Tools/Wrapped.svelte
index 312e5a01..87c97ba8 100644
--- a/src/lib/Tools/Wrapped.svelte
+++ b/src/lib/Tools/Wrapped.svelte
@@ -29,7 +29,7 @@
export let user: AniListAuthorisation;
- const currentYear = new Date(Date.now()).getFullYear();
+ let currentYear = new Date(Date.now()).getFullYear();
let currentUserIdentity = { name: '', id: -1 };
let episodes = 0;
let chapters = 0;
@@ -104,6 +104,7 @@
mediaSort = mediaSort;
includeMovies = includeMovies;
includeOVAs = includeOVAs;
+ currentYear = currentYear;
update().then(updateWidth).catch(updateWidth);
}
@@ -481,10 +482,10 @@
{#if currentUserIdentity.id === -2}
Please log in to view this page.
{:else if currentUserIdentity.id !== -1}
- {#await useFullActivityHistory ? fullActivityHistory(user, currentUserIdentity, currentYear) : getActivityHistory(currentUserIdentity)}
+ {#await currentYear !== new Date(Date.now()).getFullYear() || useFullActivityHistory ? fullActivityHistory(user, currentUserIdentity, currentYear) : getActivityHistory(currentUserIdentity)}
{@html nbsp(`Loading${useFullActivityHistory ? ' full-year' : ''} activity history ...`)}
{:then activities}
- {#await wrapped(user, currentUserIdentity)}
+ {#await wrapped(user, currentUserIdentity, currentYear)}
{@html nbsp('Loading user data ...')}
{:then wrapped}
<div id="list-container">
@@ -776,14 +777,18 @@
<summary>Calculation</summary>
<input type="checkbox" bind:checked={useFullActivityHistory} />
- Enable full-year activity<br />
+ Enable full-year activity
<SettingHint>
- If you have many activities, you may rate-limited and you may need multiple
- attempts to fully populate your local activity history database.<br />If you get
- rate-limited, wait one minute, then try again.
<a href={'#'} on:click={pruneFullYear}>Refresh data</a>
</SettingHint><br />
- <p />
+ <select bind:value={currentYear}>
+ {#each Array.from({ length: new Date(Date.now()).getFullYear() - 2012 }) as _, i}
+ <option value={new Date(Date.now()).getFullYear() - i}>
+ {new Date(Date.now()).getFullYear() - i}
+ </option>
+ {/each}
+ </select>
+ Calculate for year<br />
<select bind:value={mediaSort}>
<option value={SortOptions.SCORE}>Score</option>
<option value={SortOptions.MINUTES_WATCHED}>Minutes Watched/Read</option>
@@ -832,13 +837,21 @@
</div>
</div>
{:catch}
- <Error />
+ <Error type="User" />
{/await}
{:catch}
<Error
type={`${useFullActivityHistory ? 'Full-year activity' : 'Activity'} history`}
loginSessionError={!useFullActivityHistory}
- />
+ >
+ {#if useFullActivityHistory}
+ <p>
+ With <b>many</b> activities, it may take multiple attempts to obtain all of your activity history
+ from AniList. If this occurs, wait one minute and try again to continue populating your local
+ activity history database.
+ </p>
+ {/if}
+ </Error>
{/await}
{:else}
{@html nbsp('Loading user identity ...')}