From b89d0e7dada186e31be37e62a7a75efc2dbe9c99 Mon Sep 17 00:00:00 2001
From: Fuwn <contact@fuwn.me>
Date: Sat, 26 Aug 2023 22:29:03 -0700
Subject: feat: initial build

---
 src/routes/+page.svelte | 60 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 60 insertions(+)
 create mode 100644 src/routes/+page.svelte

(limited to 'src/routes/+page.svelte')

diff --git a/src/routes/+page.svelte b/src/routes/+page.svelte
new file mode 100644
index 00000000..ccd4b119
--- /dev/null
+++ b/src/routes/+page.svelte
@@ -0,0 +1,60 @@
+<script lang="ts">
+	import { onMount } from 'svelte';
+	import { userIdentity } from '$lib/AniList/identity';
+	import AnimeList from '$lib/List/Due/AnimeList.svelte';
+	import MangaList from '$lib/List/Due/MangaList.svelte';
+	import displayUnresolved from '../stores/displayUnresolved';
+	import closeAnimeByDefault from '../stores/closeAnimeByDefault';
+	import closeMangaByDefault from '../stores/closeMangaByDefault';
+
+	export let data;
+
+	$: displayingUnresolved = $displayUnresolved === 'true';
+	$: mangaClosed = $closeMangaByDefault === 'true';
+	$: animeClosed = $closeAnimeByDefault === 'true';
+
+	let currentUserIdentity = { name: '', id: -1 };
+
+	onMount(async () => {
+		if (data.user !== undefined) {
+			currentUserIdentity = await userIdentity(data.user);
+			currentUserIdentity.name = `(${currentUserIdentity.name})`;
+		}
+	});
+</script>
+
+<a href="/settings">Settings</a>
+
+{#if data.user === undefined}
+	Please log in to view due media.
+{:else}
+	<p />
+
+	<details open={animeClosed}>
+		{#if currentUserIdentity.id != -1}
+			<AnimeList
+				user={data.user}
+				identity={currentUserIdentity}
+				displayUnresolved={displayingUnresolved}
+			/>
+		{:else}
+			<summary>Anime</summary>
+			<ul><li>Loading ...</li></ul>
+		{/if}
+	</details>
+
+	<p />
+
+	<details open={mangaClosed}>
+		{#if currentUserIdentity.id != -1}
+			<MangaList
+				user={data.user}
+				identity={currentUserIdentity}
+				displayUnresolved={displayingUnresolved}
+			/>
+		{:else}
+			<summary>Manga</summary>
+			<ul><li>Loading ...</li></ul>
+		{/if}
+	</details>
+{/if}
-- 
cgit v1.2.3

