diff options
| author | Fuwn <[email protected]> | 2026-03-01 16:20:51 -0800 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-03-01 16:21:02 -0800 |
| commit | eae5d24d9e79e59a19d4721caaeaa0ca650ecb33 (patch) | |
| tree | 1b685bb248e051dfa26d2bfdebe6689402dd93c5 /src/lib/Home | |
| parent | chore(tooling): remove legacy eslint and prettier (diff) | |
| download | due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.tar.xz due.moe-eae5d24d9e79e59a19d4721caaeaa0ca650ecb33.zip | |
chore(biome): drop formatter style overrides
Diffstat (limited to 'src/lib/Home')
| -rw-r--r-- | src/lib/Home/HeadTitle.svelte | 5 | ||||
| -rw-r--r-- | src/lib/Home/LastActivity.svelte | 81 | ||||
| -rw-r--r-- | src/lib/Home/Root.svelte | 4 |
3 files changed, 46 insertions, 44 deletions
diff --git a/src/lib/Home/HeadTitle.svelte b/src/lib/Home/HeadTitle.svelte index dbda7afe..9ac1ea71 100644 --- a/src/lib/Home/HeadTitle.svelte +++ b/src/lib/Home/HeadTitle.svelte @@ -1,6 +1,7 @@ <script lang="ts"> -let { route = undefined, path = '/' }: { route?: string; path?: string } = $props(); -const title = $derived((route ? `${route} • ` : '') + 'due.moe'); +let { route = undefined, path = "/" }: { route?: string; path?: string } = + $props(); +const title = $derived((route ? `${route} • ` : "") + "due.moe"); </script> <svelte:head> diff --git a/src/lib/Home/LastActivity.svelte b/src/lib/Home/LastActivity.svelte index 5c9ee4c2..39b35198 100644 --- a/src/lib/Home/LastActivity.svelte +++ b/src/lib/Home/LastActivity.svelte @@ -1,52 +1,53 @@ <script lang="ts"> -import userIdentity from '$stores/identity'; -import { onMount } from 'svelte'; -import type { AniListAuthorisation } from '$lib/Data/AniList/identity'; -import { lastActivityDate } from '../Data/AniList/activity'; -import settings from '$stores/settings'; +import userIdentity from "$stores/identity"; +import { onMount } from "svelte"; +import type { AniListAuthorisation } from "$lib/Data/AniList/identity"; +import { lastActivityDate } from "../Data/AniList/activity"; +import settings from "$stores/settings"; let { user }: { user: AniListAuthorisation } = $props(); let lastActivityWasToday = $state(true); onMount(async () => { - if (!$settings.displayDisableLastActivityWarning && user !== undefined) { - lastActivityWasToday = - (await lastActivityDate($userIdentity, user)).date.toDateString() >= - new Date().toDateString(); - - if (!lastActivityWasToday) { - if ($settings.displayLimitListHeight) { - document.querySelectorAll('.list').forEach((list) => { - (list as HTMLElement).style.maxHeight = `calc((100vh - ${ - document.querySelector('#list-container')?.getBoundingClientRect().top - }px) - 5rem)`; - }); - } - } - } + if (!$settings.displayDisableLastActivityWarning && user !== undefined) { + lastActivityWasToday = + (await lastActivityDate($userIdentity, user)).date.toDateString() >= + new Date().toDateString(); + + if (!lastActivityWasToday) { + if ($settings.displayLimitListHeight) { + document.querySelectorAll(".list").forEach((list) => { + (list as HTMLElement).style.maxHeight = `calc((100vh - ${ + document.querySelector("#list-container")?.getBoundingClientRect() + .top + }px) - 5rem)`; + }); + } + } + } }); const timeLeftToday = () => { - const now = new Date(); - const currentHour = now.getHours(); - const currentMinute = now.getMinutes(); - const hoursLeft = 24 - currentHour; - let minutesLeft = 0; - let timeLeft = ''; - - if (hoursLeft > 0) { - minutesLeft = hoursLeft * 60 - currentMinute; - } else { - minutesLeft = 24 * 60 - (currentHour * 60 + currentMinute); - } - - if (minutesLeft > 60) { - timeLeft = `${Math.round(minutesLeft / 60)} hours`; - } else { - timeLeft = `${minutesLeft} minutes`; - } - - return timeLeft; + const now = new Date(); + const currentHour = now.getHours(); + const currentMinute = now.getMinutes(); + const hoursLeft = 24 - currentHour; + let minutesLeft = 0; + let timeLeft = ""; + + if (hoursLeft > 0) { + minutesLeft = hoursLeft * 60 - currentMinute; + } else { + minutesLeft = 24 * 60 - (currentHour * 60 + currentMinute); + } + + if (minutesLeft > 60) { + timeLeft = `${Math.round(minutesLeft / 60)} hours`; + } else { + timeLeft = `${minutesLeft} minutes`; + } + + return timeLeft; }; </script> diff --git a/src/lib/Home/Root.svelte b/src/lib/Home/Root.svelte index b3c2279e..d0cf8898 100644 --- a/src/lib/Home/Root.svelte +++ b/src/lib/Home/Root.svelte @@ -1,6 +1,6 @@ <script lang="ts"> -import settings from '$stores/settings'; -import { fly } from 'svelte/transition'; +import settings from "$stores/settings"; +import { fly } from "svelte/transition"; export let data: { url: string }; export let way: number; |