diff options
| author | Fuwn <[email protected]> | 2023-09-22 23:48:39 -0700 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2023-09-22 23:48:39 -0700 |
| commit | 2caef2c1723801e6145331003e7b430e9772b65a (patch) | |
| tree | dfaa9a361c503bbb5a6de8a18ecb3d083d3d8d37 /src | |
| parent | feat(layout): tools in navbar (diff) | |
| download | due.moe-2caef2c1723801e6145331003e7b430e9772b65a.tar.xz due.moe-2caef2c1723801e6145331003e7b430e9772b65a.zip | |
feat(tools): move activity history
Diffstat (limited to 'src')
| -rw-r--r-- | src/lib/ActivityHistory.svelte (renamed from src/routes/history/+page.svelte) | 58 | ||||
| -rw-r--r-- | src/routes/tools/+page.svelte | 6 |
2 files changed, 33 insertions, 31 deletions
diff --git a/src/routes/history/+page.svelte b/src/lib/ActivityHistory.svelte index 2bb0f129..43dcb70d 100644 --- a/src/routes/history/+page.svelte +++ b/src/lib/ActivityHistory.svelte @@ -1,19 +1,19 @@ <script lang="ts"> import { activityHistory, type ActivityHistoryEntry } from '$lib/AniList/activity.js'; import { onMount } from 'svelte'; - import userIdentity from '../../stores/userIdentity.js'; + import userIdentity from '../stores/userIdentity.js'; import { userIdentity as getUserIdentity } from '$lib/AniList/identity'; - export let data; + export let user; let activityHistoryData: Promise<ActivityHistoryEntry[]>; let currentUserIdentity = { name: '', id: -1 }; const timezoneOffset = new Date().getTimezoneOffset() * 60 * 1000; onMount(async () => { - if (data.user !== undefined) { + if (user !== undefined) { if ($userIdentity === '') { - userIdentity.set(JSON.stringify(await getUserIdentity(data.user))); + userIdentity.set(JSON.stringify(await getUserIdentity(user))); } currentUserIdentity = JSON.parse($userIdentity); @@ -63,32 +63,28 @@ // }; </script> -<details open> - <summary>Activity History</summary> - +<blockquote> Days in risk of developing an activity history hole. (days with one activity) - - <p /> - - {#if data.user === undefined} - Please log in to view this page. - {:else} - {#await activityHistoryData} +</blockquote> + +{#if user === undefined} + Please log in to view this page. +{:else} + {#await activityHistoryData} + Loading ... + {:then activities} + {#if activities === undefined} Loading ... - {:then activities} - {#if activities === undefined} - Loading ... - {:else} - <ul> - {#each fillMissingDays(activities) as activity} - {#if activity.amount === 0} - <li> - {new Date(activity.date * 1000 + timezoneOffset).toDateString()} - </li> - {/if} - {/each} - </ul> - {/if} - {/await} - {/if} -</details> + {:else} + <ul> + {#each fillMissingDays(activities) as activity} + {#if activity.amount === 0} + <li> + {new Date(activity.date * 1000 + timezoneOffset).toDateString()} + </li> + {/if} + {/each} + </ul> + {/if} + {/await} +{/if} diff --git a/src/routes/tools/+page.svelte b/src/routes/tools/+page.svelte index 53ace72b..1bf7a4a3 100644 --- a/src/routes/tools/+page.svelte +++ b/src/routes/tools/+page.svelte @@ -1,6 +1,9 @@ <script lang="ts"> + import ActivityHistory from '$lib/ActivityHistory.svelte'; import { todaysCharacterBirthdays } from '$lib/AniList/character'; + export let data; + let tool: number; </script> @@ -8,11 +11,14 @@ <select bind:value={tool}> <option value={0}>Tools</option> <option value={1}>Today's Character Birthdays</option> + <option value={2}>Activity History Hole Risks</option> </select> </p> {#if tool === 0} Select a tool to continue. +{:else if tool === 2} + <ActivityHistory user={data.user} /> {:else if tool === 1} <ul> {#await todaysCharacterBirthdays()} |