aboutsummaryrefslogtreecommitdiff
path: root/src/lib/Home/LastActivity.svelte
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-09 00:41:20 -0700
committerFuwn <[email protected]>2024-10-09 00:41:43 -0700
commit998b63a35256ac985a5a2714dd1ca451af4dfd8a (patch)
tree50796121a9d5ab0330fdc5d7e098bda2860d9726 /src/lib/Home/LastActivity.svelte
parentfeat(graphql): add badgeCount field (diff)
downloaddue.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.tar.xz
due.moe-998b63a35256ac985a5a2714dd1ca451af4dfd8a.zip
chore(prettier): use spaces instead of tabs
Diffstat (limited to 'src/lib/Home/LastActivity.svelte')
-rw-r--r--src/lib/Home/LastActivity.svelte108
1 files changed, 54 insertions, 54 deletions
diff --git a/src/lib/Home/LastActivity.svelte b/src/lib/Home/LastActivity.svelte
index 9d4bdf6e..000c7f7b 100644
--- a/src/lib/Home/LastActivity.svelte
+++ b/src/lib/Home/LastActivity.svelte
@@ -1,59 +1,59 @@
<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';
-
- export let user: AniListAuthorisation;
-
- let lastActivityWasToday = true;
-
- onMount(async () => {
- if (user !== undefined && !$settings.displayDisableLastActivityWarning) {
- 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;
- };
+ 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';
+
+ export let user: AniListAuthorisation;
+
+ let lastActivityWasToday = true;
+
+ onMount(async () => {
+ if (user !== undefined && !$settings.displayDisableLastActivityWarning) {
+ 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;
+ };
</script>
{#if !lastActivityWasToday}
- <blockquote>
- You don't have any new activity statuses from the past day! Create one within {timeLeftToday()}
- to keep your streak!
- </blockquote>
+ <blockquote>
+ You don't have any new activity statuses from the past day! Create one within {timeLeftToday()}
+ to keep your streak!
+ </blockquote>
{/if}