From 6a1933178985e23825d8453449ca99bb0e5cfcb6 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 13 Jan 2024 18:56:25 -0800
Subject: refactor(home): move layout to home

---
 src/lib/LastActivity.svelte | 73 ---------------------------------------------
 1 file changed, 73 deletions(-)
 delete mode 100644 src/lib/LastActivity.svelte

(limited to 'src/lib/LastActivity.svelte')

diff --git a/src/lib/LastActivity.svelte b/src/lib/LastActivity.svelte
deleted file mode 100644
index b4e8afa4..00000000
--- a/src/lib/LastActivity.svelte
+++ /dev/null
@@ -1,73 +0,0 @@
-<script lang="ts">
-	import userIdentity from '$stores/userIdentity';
-	import { onMount } from 'svelte';
-	import {
-		userIdentity as getUserIdentity,
-		type AniListAuthorisation
-	} from '$lib/AniList/identity';
-	import { lastActivityDate } from './AniList/activity';
-	import settings from '$stores/settings';
-
-	export let user: AniListAuthorisation;
-
-	let currentUserIdentity = {
-		name: '',
-		id: -1,
-		avatar: 'https://s4.anilist.co/file/anilistcdn/user/avatar/large/default.png'
-	};
-	let lastActivityWasToday = true;
-
-	onMount(async () => {
-		if (user !== undefined) {
-			if ($userIdentity === '') {
-				userIdentity.set(JSON.stringify(await getUserIdentity(user)));
-			}
-
-			currentUserIdentity = JSON.parse($userIdentity);
-			currentUserIdentity.name = currentUserIdentity.name;
-			lastActivityWasToday =
-				(await lastActivityDate(currentUserIdentity, 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>
-{/if}
-- 
cgit v1.2.3

