made entire app only work in dark mode

This commit is contained in:
2024-10-01 16:57:42 -04:00
parent 753ecd968e
commit e229311190
5 changed files with 587 additions and 425 deletions

View File

@ -7,112 +7,140 @@
simklAnime,
simklLoggedIn,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import {push} from "svelte-spa-router";
import {Button} from "flowbite-svelte";
import type {AniListGetSingleAnime} from "../anilist/types/AniListCurrentUserWatchListType";
import { push } from "svelte-spa-router";
import { Button } from "flowbite-svelte";
import type { AniListGetSingleAnime } from "../anilist/types/AniListCurrentUserWatchListType";
import Rating from "./Rating.svelte";
import convertAniListDateToString from "../helperFunctions/convertAniListDateToString";
import AnimeTable from "./AnimeTable.svelte";
import type {MALAnime, MalListStatus, MALUploadStatus} from "../mal/types/MALTypes";
import type {SimklAnime} from "../simkl/types/simklTypes";
import {writable} from "svelte/store";
import type {StatusOption, StatusOptions} from "../helperTypes/StatusTypes";
import type {AniListUpdateVariables} from "../anilist/types/AniListTypes";
import type {
MALAnime,
MalListStatus,
MALUploadStatus,
} from "../mal/types/MALTypes";
import type { SimklAnime } from "../simkl/types/simklTypes";
import { writable } from "svelte/store";
import type {
StatusOption,
StatusOptions,
} from "../helperTypes/StatusTypes";
import type { AniListUpdateVariables } from "../anilist/types/AniListTypes";
import convertDateStringToAniList from "../helperFunctions/convertDateStringToAniList";
import {
AniListDeleteEntry,
AniListUpdateEntry, DeleteMyAnimeListEntry,
AniListUpdateEntry,
DeleteMyAnimeListEntry,
MyAnimeListUpdate,
SimklSyncEpisodes,
SimklSyncRating, SimklSyncRemove,
SimklSyncStatus
SimklSyncRating,
SimklSyncRemove,
SimklSyncStatus,
} from "../../wailsjs/go/main/App";
import {AddAnimeServiceToTable} from "../helperModules/AddAnimeServiceToTable.svelte";
import {CheckIfAniListLoggedInAndLoadWatchList} from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
let isAniListLoggedIn: boolean
let isMalLoggedIn: boolean
let isSimklLoggedIn: boolean
let currentAniListAnime: AniListGetSingleAnime
let currentMalAnime: MALAnime
let currentSimklAnime: SimklAnime
let submitting = writable(false)
let isSubmitting: boolean
let submitSuccess = writable(false)
let isAniListLoggedIn: boolean;
let isMalLoggedIn: boolean;
let isSimklLoggedIn: boolean;
let currentAniListAnime: AniListGetSingleAnime;
let currentMalAnime: MALAnime;
let currentSimklAnime: SimklAnime;
let submitting = writable(false);
let isSubmitting: boolean;
let submitSuccess = writable(false);
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
malLoggedIn.subscribe((value) => isMalLoggedIn = value)
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
aniListAnime.subscribe((value) => currentAniListAnime = value)
malAnime.subscribe((value) => currentMalAnime = value)
simklAnime.subscribe((value) => currentSimklAnime = value)
submitting.subscribe((value) => isSubmitting = value)
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
malLoggedIn.subscribe((value) => (isMalLoggedIn = value));
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value));
aniListAnime.subscribe((value) => (currentAniListAnime = value));
malAnime.subscribe((value) => (currentMalAnime = value));
simklAnime.subscribe((value) => (currentSimklAnime = value));
submitting.subscribe((value) => (isSubmitting = value));
const title = currentAniListAnime.data.MediaList.media.title.english !== "" ?
currentAniListAnime.data.MediaList.media.title.english :
currentAniListAnime.data.MediaList.media.title.romaji
const title =
currentAniListAnime.data.MediaList.media.title.english !== ""
? currentAniListAnime.data.MediaList.media.title.english
: currentAniListAnime.data.MediaList.media.title.romaji;
const statusOptions: StatusOptions = [
{id: 0, aniList: "CURRENT", mal: "watching", simkl: "watching"},
{id: 1, aniList: "PLANNING", mal: "plan_to_watch", simkl: "plantowatch"},
{id: 2, aniList: "COMPLETED", mal: "completed", simkl: "completed"},
{id: 3, aniList: "DROPPED", mal: "dropped", simkl: "dropped"},
{id: 4, aniList: "PAUSED", mal: "on_hold", simkl: "hold"},
{id: 5, aniList: "REPEATING", mal: "rewatching", simkl: "watching"}
]
let startingAnilistStatusOption: StatusOption = statusOptions.filter(option => currentAniListAnime.data.MediaList.status === option.aniList)[0]
const startedAtDate = convertAniListDateToString(currentAniListAnime.data.MediaList.startedAt)
const completedAtDate = convertAniListDateToString(currentAniListAnime.data.MediaList.completedAt)
{ id: 0, aniList: "CURRENT", mal: "watching", simkl: "watching" },
{
id: 1,
aniList: "PLANNING",
mal: "plan_to_watch",
simkl: "plantowatch",
},
{ id: 2, aniList: "COMPLETED", mal: "completed", simkl: "completed" },
{ id: 3, aniList: "DROPPED", mal: "dropped", simkl: "dropped" },
{ id: 4, aniList: "PAUSED", mal: "on_hold", simkl: "hold" },
{ id: 5, aniList: "REPEATING", mal: "rewatching", simkl: "watching" },
];
let startingAnilistStatusOption: StatusOption = statusOptions.filter(
(option) =>
currentAniListAnime.data.MediaList.status === option.aniList,
)[0];
const startedAtDate = convertAniListDateToString(
currentAniListAnime.data.MediaList.startedAt,
);
const completedAtDate = convertAniListDateToString(
currentAniListAnime.data.MediaList.completedAt,
);
if (isAniListLoggedIn) AddAnimeServiceToTable({
id: currentAniListAnime.data.MediaList.mediaId,
title,
service: "AniList",
progress: currentAniListAnime.data.MediaList.progress,
status: currentAniListAnime.data.MediaList.status,
startedAt: convertAniListDateToString(currentAniListAnime.data.MediaList.startedAt),
completedAt: convertAniListDateToString(currentAniListAnime.data.MediaList.completedAt),
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes
})
if (isAniListLoggedIn)
AddAnimeServiceToTable({
id: currentAniListAnime.data.MediaList.mediaId,
title,
service: "AniList",
progress: currentAniListAnime.data.MediaList.progress,
status: currentAniListAnime.data.MediaList.status,
startedAt: convertAniListDateToString(
currentAniListAnime.data.MediaList.startedAt,
),
completedAt: convertAniListDateToString(
currentAniListAnime.data.MediaList.completedAt,
),
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes,
});
if (isMalLoggedIn)
AddAnimeServiceToTable({
id: currentMalAnime.id,
title: currentMalAnime.title,
service: "MyAnimeList",
progress: currentMalAnime.my_list_status.num_episodes_watched,
status: currentMalAnime.my_list_status.status,
startedAt: currentMalAnime.my_list_status.start_date,
completedAt: currentMalAnime.my_list_status.finish_date,
score: currentMalAnime.my_list_status.score,
repeat: currentMalAnime.my_list_status.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments,
});
if (isMalLoggedIn) AddAnimeServiceToTable({
id: currentMalAnime.id,
title: currentMalAnime.title,
service: "MyAnimeList",
progress: currentMalAnime.my_list_status.num_episodes_watched,
status: currentMalAnime.my_list_status.status,
startedAt: currentMalAnime.my_list_status.start_date,
completedAt: currentMalAnime.my_list_status.finish_date,
score: currentMalAnime.my_list_status.score,
repeat: currentMalAnime.my_list_status.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments
})
if (isSimklLoggedIn && Object.keys(currentSimklAnime).length > 0) AddAnimeServiceToTable({
id: currentSimklAnime.show.ids.simkl,
title: currentSimklAnime.show.title,
service: "Simkl",
progress: currentSimklAnime.watched_episodes_count,
status: currentSimklAnime.status,
startedAt: "",
completedAt: "",
score: currentSimklAnime.user_rating,
repeat: 0,
notes: ""
})
if (isSimklLoggedIn && Object.keys(currentSimklAnime).length > 0)
AddAnimeServiceToTable({
id: currentSimklAnime.show.ids.simkl,
title: currentSimklAnime.show.title,
service: "Simkl",
progress: currentSimklAnime.watched_episodes_count,
status: currentSimklAnime.status,
startedAt: "",
completedAt: "",
score: currentSimklAnime.user_rating,
repeat: 0,
notes: "",
});
const handleSubmit = async (e: any) => {
submitting.set(true)
submitting.set(true);
let submitData: {
rating: number,
episodes: number,
status: StatusOption,
startedAt: string,
completedAt: string,
repeat: number,
notes: string,
rating: number;
episodes: number;
status: StatusOption;
startedAt: string;
completedAt: string;
repeat: number;
notes: string;
} = {
rating: 0,
episodes: 0,
@ -126,30 +154,33 @@
completedAt: "",
repeat: 0,
notes: "",
}
const formData = new FormData(e.target)
};
const formData = new FormData(e.target);
for (let field of formData) {
const [key, value] = field
const [key, value] = field;
if (key === "rating") {
submitData.rating = (Number(value) * 2)
continue
submitData.rating = Number(value) * 2;
continue;
}
if (key === "episodes") {
submitData.episodes = Number(value)
continue
submitData.episodes = Number(value);
continue;
}
if (key === "repeat") {
submitData.repeat = Number(value)
continue
submitData.repeat = Number(value);
continue;
}
if (key === "status") {
submitData.status = startingAnilistStatusOption
continue
submitData.status = startingAnilistStatusOption;
continue;
}
submitData[key] = value
submitData[key] = value;
}
if (isAniListLoggedIn && currentAniListAnime.data.MediaList.mediaId !== 0) {
if (
isAniListLoggedIn &&
currentAniListAnime.data.MediaList.mediaId !== 0
) {
let body: AniListUpdateVariables = {
mediaId: currentAniListAnime.data.MediaList.mediaId,
progress: submitData.episodes,
@ -158,29 +189,35 @@
repeat: submitData.repeat,
notes: submitData.notes,
startedAt: convertDateStringToAniList(submitData.startedAt),
completedAt: convertDateStringToAniList(submitData.completedAt)
}
await AniListUpdateEntry(body).then((value: AniListGetSingleAnime) => {
// in future when you inevitably add tags to typescript, until Anilist fixes the api bug
// where tags break the SaveMediaListEntry return, you'll want to use this delete line
// delete value.data.MediaList.media.tags
aniListAnime.update(newValue => {
newValue = value
return newValue
})
AddAnimeServiceToTable({
id: currentAniListAnime.data.MediaList.mediaId,
title,
service: "AniList",
progress: currentAniListAnime.data.MediaList.progress,
status: currentAniListAnime.data.MediaList.status,
startedAt: convertAniListDateToString(currentAniListAnime.data.MediaList.startedAt),
completedAt: convertAniListDateToString(currentAniListAnime.data.MediaList.completedAt),
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes,
})
})
completedAt: convertDateStringToAniList(submitData.completedAt),
};
await AniListUpdateEntry(body).then(
(value: AniListGetSingleAnime) => {
// in future when you inevitably add tags to typescript, until Anilist fixes the api bug
// where tags break the SaveMediaListEntry return, you'll want to use this delete line
// delete value.data.MediaList.media.tags
aniListAnime.update((newValue) => {
newValue = value;
return newValue;
});
AddAnimeServiceToTable({
id: currentAniListAnime.data.MediaList.mediaId,
title,
service: "AniList",
progress: currentAniListAnime.data.MediaList.progress,
status: currentAniListAnime.data.MediaList.status,
startedAt: convertAniListDateToString(
currentAniListAnime.data.MediaList.startedAt,
),
completedAt: convertAniListDateToString(
currentAniListAnime.data.MediaList.completedAt,
),
score: currentAniListAnime.data.MediaList.score,
repeat: currentAniListAnime.data.MediaList.repeat,
notes: currentAniListAnime.data.MediaList.notes,
});
},
);
}
if (malLoggedIn && currentMalAnime.id !== 0) {
@ -190,37 +227,49 @@
score: submitData.rating,
num_watched_episodes: submitData.episodes,
num_times_rewatched: submitData.repeat,
comments: submitData.notes
}
comments: submitData.notes,
};
await MyAnimeListUpdate(currentMalAnime, body).then((malAnimeReturn: MalListStatus) => {
malAnime.update(value => {
value.my_list_status.status = malAnimeReturn.status
value.my_list_status.is_rewatching = malAnimeReturn.is_rewatching
value.my_list_status.score = malAnimeReturn.score
value.my_list_status.num_episodes_watched = malAnimeReturn.num_episodes_watched
value.my_list_status.num_times_rewatched = malAnimeReturn.num_times_rewatched
value.my_list_status.comments = malAnimeReturn.comments
return value
})
AddAnimeServiceToTable({
id: currentMalAnime.id,
title: currentMalAnime.title,
service: "MyAnimeList",
progress: currentMalAnime.my_list_status.num_episodes_watched,
status: currentMalAnime.my_list_status.status,
startedAt: currentMalAnime.my_list_status.start_date,
completedAt: currentMalAnime.my_list_status.finish_date,
score: currentMalAnime.my_list_status.score,
repeat: currentMalAnime.my_list_status.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments,
})
})
await MyAnimeListUpdate(currentMalAnime, body).then(
(malAnimeReturn: MalListStatus) => {
malAnime.update((value) => {
value.my_list_status.status = malAnimeReturn.status;
value.my_list_status.is_rewatching =
malAnimeReturn.is_rewatching;
value.my_list_status.score = malAnimeReturn.score;
value.my_list_status.num_episodes_watched =
malAnimeReturn.num_episodes_watched;
value.my_list_status.num_times_rewatched =
malAnimeReturn.num_times_rewatched;
value.my_list_status.comments = malAnimeReturn.comments;
return value;
});
AddAnimeServiceToTable({
id: currentMalAnime.id,
title: currentMalAnime.title,
service: "MyAnimeList",
progress:
currentMalAnime.my_list_status.num_episodes_watched,
status: currentMalAnime.my_list_status.status,
startedAt: currentMalAnime.my_list_status.start_date,
completedAt: currentMalAnime.my_list_status.finish_date,
score: currentMalAnime.my_list_status.score,
repeat: currentMalAnime.my_list_status
.num_times_rewatched,
notes: currentMalAnime.my_list_status.comments,
});
},
);
}
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
if (currentSimklAnime.watched_episodes_count !== submitData.episodes) {
await SimklSyncEpisodes(currentSimklAnime, submitData.episodes).then((value: SimklAnime) => {
if (
currentSimklAnime.watched_episodes_count !== submitData.episodes
) {
await SimklSyncEpisodes(
currentSimklAnime,
submitData.episodes,
).then((value: SimklAnime) => {
AddAnimeServiceToTable({
id: value.show.ids.simkl,
title: value.show.title,
@ -231,17 +280,20 @@
completedAt: "",
score: value.user_rating,
repeat: 0,
notes: ""
})
simklAnime.update(newValue => {
newValue = value
return newValue
})
})
notes: "",
});
simklAnime.update((newValue) => {
newValue = value;
return newValue;
});
});
}
if (currentSimklAnime.user_rating !== submitData.rating) {
await SimklSyncRating(currentSimklAnime, submitData.rating).then(value => {
await SimklSyncRating(
currentSimklAnime,
submitData.rating,
).then((value) => {
AddAnimeServiceToTable({
id: value.show.ids.simkl,
title: value.show.title,
@ -252,17 +304,20 @@
completedAt: "",
score: value.user_rating,
repeat: 0,
notes: ""
})
simklAnime.update(newValue => {
newValue = value
return newValue
})
})
notes: "",
});
simklAnime.update((newValue) => {
newValue = value;
return newValue;
});
});
}
if (currentSimklAnime.status !== submitData.status.simkl) {
await SimklSyncStatus(currentSimklAnime, submitData.status.simkl).then(value => {
await SimklSyncStatus(
currentSimklAnime,
submitData.status.simkl,
).then((value) => {
AddAnimeServiceToTable({
id: value.show.ids.simkl,
title: value.show.title,
@ -273,25 +328,28 @@
completedAt: "",
score: value.user_rating,
repeat: 0,
notes: ""
})
simklAnime.update(newValue => {
newValue = value
return newValue
})
})
notes: "",
});
simklAnime.update((newValue) => {
newValue = value;
return newValue;
});
});
}
}
submitting.set(false)
submitSuccess.set(true)
setTimeout(() => submitSuccess.set(false), 2000)
}
submitting.set(false);
submitSuccess.set(true);
setTimeout(() => submitSuccess.set(false), 2000);
};
const deleteEntries = async () => {
submitting.set(true)
if (isAniListLoggedIn && currentAniListAnime.data.MediaList.mediaId !== 0) {
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id)
submitting.set(true);
if (
isAniListLoggedIn &&
currentAniListAnime.data.MediaList.mediaId !== 0
) {
await AniListDeleteEntry(currentAniListAnime.data.MediaList.id);
AddAnimeServiceToTable({
id: currentAniListAnime.data.MediaList.mediaId,
title,
@ -303,10 +361,10 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
if (malLoggedIn && currentMalAnime.id !== 0) {
await DeleteMyAnimeListEntry(currentMalAnime.id)
await DeleteMyAnimeListEntry(currentMalAnime.id);
AddAnimeServiceToTable({
id: currentMalAnime.id,
title: currentMalAnime.title,
@ -318,10 +376,10 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
if (simklLoggedIn && currentSimklAnime.show.ids.simkl !== 0) {
await SimklSyncRemove(currentSimklAnime)
await SimklSyncRemove(currentSimklAnime);
AddAnimeServiceToTable({
id: currentSimklAnime.show.ids.simkl,
title: currentSimklAnime.show.title,
@ -333,52 +391,68 @@
score: 0,
repeat: 0,
notes: "",
})
});
}
submitting.set(false)
submitSuccess.set(true)
setTimeout(() => submitSuccess.set(false), 2000)
}
submitting.set(false);
submitSuccess.set(true);
setTimeout(() => submitSuccess.set(false), 2000);
};
</script>
<form on:submit|preventDefault={handleSubmit} class="container py-10">
<form on:submit|preventDefault={handleSubmit} class="container py-10">
<div class="grid grid-cols-1 md:grid-cols-10 grid-flow-col gap-4">
<div class="md:col-span-2 space-y-3">
<img class="rounded-lg" src={currentAniListAnime.data.MediaList.media.coverImage.large}
alt="{title} Cover Image">
<Rating bind:score={currentAniListAnime.data.MediaList.score}/>
<img
class="rounded-lg"
src={currentAniListAnime.data.MediaList.media.coverImage.large}
alt="{title} Cover Image"
/>
<Rating bind:score={currentAniListAnime.data.MediaList.score} />
</div>
<div class="md:col-span-8 ">
<div class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-24 lg:gap-x-56">
<div class="md:col-span-8">
<div
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-24 lg:gap-x-56"
>
<div>
<label for="episodes"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Episode
Progress</label>
<label
for="episodes"
class="text-left block mb-2 text-sm font-medium text-white"
>Episode Progress</label
>
<input
type="number"
name="episodes"
min="0"
max="{currentAniListAnime.data.MediaList.media.episodes}"
id="episodes"
class="bg-gray-50 border {currentAniListAnime.data.MediaList.progress < 0 || currentAniListAnime.data.MediaList.progress > currentAniListAnime.data.MediaList.media.episodes ?
'border-red-300 dark:border-red-500 border-[2px] text-rose-500 dark:text-rose-300 focus:ring-red-500 focus:border-red-500 dark:focus:ring-red-500 dark:focus:border-red-500' :
'border-gray-300 dark:border-gray-500 text-gray-900 dark:text-white focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-500 dark:focus:border-blue-500'
} text-sm rounded-lg block w-24 p-2.5 dark:bg-gray-600 dark:placeholder-gray-400"
bind:value={currentAniListAnime.data.MediaList.progress}
required>
<div>of {currentAniListAnime.data.MediaList.media.episodes}</div>
type="number"
name="episodes"
min="0"
max={currentAniListAnime.data.MediaList.media.episodes}
id="episodes"
class="border {currentAniListAnime.data.MediaList
.progress < 0 ||
currentAniListAnime.data.MediaList.progress >
currentAniListAnime.data.MediaList.media.episodes
? 'border-red-500 border-[2px] text-rose-300 focus:ring-red-500 focus:border-red-500'
: 'border-gray-500 text-white focus:ring-blue-500 focus:border-blue-500'} text-sm rounded-lg block w-24 p-2.5 bg-gray-600 placeholder-gray-400"
bind:value={currentAniListAnime.data.MediaList.progress}
required
/>
<div>
of {currentAniListAnime.data.MediaList.media.episodes}
</div>
</div>
<div>
<label for="status"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Status</label>
<select id="status" name="status"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500
focus:border-blue-500 block p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400
dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
bind:value={startingAnilistStatusOption}
<label
for="status"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white"
>Status</label
>
<select
id="status"
name="status"
class="border text-sm rounded-lg
block p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400
text-white focus:ring-blue-500 focus:border-blue-500"
bind:value={startingAnilistStatusOption}
>
{#each statusOptions as option}
<option value={option}>{option.aniList}</option>
@ -386,150 +460,218 @@
</select>
</div>
</div>
<div class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36">
<div
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36"
>
<div>
<label for="startedAt"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Date
Started</label>
<label
for="startedAt"
class="text-left block mb-2 text-sm font-medium text-white"
>Date Started</label
>
<div class="relative max-w-sm">
<div class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none">
<svg class="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"/>
<div
class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none"
>
<svg
class="w-4 h-4 text-gray-400"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"
/>
</svg>
</div>
<input
id="startedAt"
type="date"
name="startedAt"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500
focus:border-blue-500 dark:focus:ring-blue-500 dark:focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600
dark:placeholder-gray-400 dark:text-white"
value={startedAtDate}
placeholder="Date Started"
>
id="startedAt"
type="date"
name="startedAt"
class="border text-sm rounded-lg
focus:ring-blue-500 focus:border-blue-500 block w-full ps-10 p-2.5 bg-gray-700 border-gray-600
placeholder-gray-400 text-white"
value={startedAtDate}
placeholder="Date Started"
/>
</div>
</div>
<div>
<label for="completedAt"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Date
Completed</label>
<label
for="completedAt"
class="text-left block mb-2 text-sm font-medium text-white"
>Date Completed</label
>
<div class="relative max-w-sm">
<div class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none">
<svg class="w-4 h-4 text-gray-500 dark:text-gray-400" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="currentColor" viewBox="0 0 20 20">
<path d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"/>
<div
class="absolute inset-y-0 start-0 flex items-center ps-3.5 pointer-events-none"
>
<svg
class="w-4 h-4 text-gray-400"
aria-hidden="true"
xmlns="http://www.w3.org/2000/svg"
fill="currentColor"
viewBox="0 0 20 20"
>
<path
d="M20 4a2 2 0 0 0-2-2h-2V1a1 1 0 0 0-2 0v1h-3V1a1 1 0 0 0-2 0v1H6V1a1 1 0 0 0-2 0v1H2a2 2 0 0 0-2 2v2h20V4ZM0 18a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V8H0v10Zm5-8h10a1 1 0 0 1 0 2H5a1 1 0 0 1 0-2Z"
/>
</svg>
</div>
<input
id="completedAt"
type="date"
name="completedAt"
class="bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500
focus:border-blue-500 block w-full ps-10 p-2.5 dark:bg-gray-700 dark:border-gray-600
dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
value={completedAtDate}
placeholder="Date Completed"
>
id="completedAt"
type="date"
name="completedAt"
class="border text-sm rounded-lg
block w-full ps-10 p-2.5 bg-gray-700 border-gray-600
placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
value={completedAtDate}
placeholder="Date Completed"
/>
</div>
</div>
<div>
<label for="repeat"
class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Rewatched</label>
<label
for="repeat"
class="text-left block mb-2 text-sm font-medium text-white"
>Rewatched</label
>
<input
type="number"
name="repeat"
min="0"
id="repeat"
class="bg-gray-50 border {currentAniListAnime.data.MediaList.repeat < 0 ?
'border-red-300 dark:border-red-500 border-[2px] text-rose-500 dark:text-rose-300 focus:ring-red-500 focus:border-red-500 dark:focus:ring-red-500 dark:focus:border-red-500' :
'border-gray-300 dark:border-gray-500 text-gray-900 dark:text-white focus:ring-blue-500 focus:border-blue-500 dark:focus:ring-blue-500 dark:focus:border-blue-500'
} text-sm rounded-lg block w-24 p-2.5 dark:bg-gray-600 dark:placeholder-gray-400 dark:text-white"
bind:value={currentAniListAnime.data.MediaList.repeat}
required>
type="number"
name="repeat"
min="0"
id="repeat"
class="border {currentAniListAnime.data.MediaList
.repeat < 0
? 'border-red-500 border-[2px] text-rose-300 focus:ring-red-500 focus:border-red-500'
: 'border-gray-500 text-white focus:ring-blue-500 focus:border-blue-500'} text-sm rounded-lg block w-24 p-2.5 bg-gray-600 placeholder-gray-400 text-white"
bind:value={currentAniListAnime.data.MediaList.repeat}
required
/>
</div>
</div>
<div class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center">
<div
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center"
>
<div class="w-full">
<label for="notes" class="text-left block mb-2 text-sm font-medium text-gray-900 dark:text-white">Your
notes</label>
<textarea id="notes" rows="3" name="notes"
class="block p-2.5 w-full text-sm text-gray-900 bg-gray-50 rounded-lg border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
placeholder="Write your thoughts here..."
bind:value={currentAniListAnime.data.MediaList.notes}></textarea>
<label
for="notes"
class="text-left block mb-2 text-sm font-medium text-white"
>Your notes</label
>
<textarea
id="notes"
rows="3"
name="notes"
class="block p-2.5 w-full text-sm rounded-lg border bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
placeholder="Write your thoughts here..."
bind:value={currentAniListAnime.data.MediaList.notes}
></textarea>
</div>
</div>
</div>
</div>
<div id="external-data">
<div id="anilist-data"
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36 group">
<h2 class="text-left mb-1 text-base font-semibold text-gray-900 dark:text-white">AniList</h2>
<div
id="anilist-data"
class="flex flex-col md:flex-row md:pl-10 md:pr-10 pt-5 pb-5 justify-center md:gap-x-16 lg:gap-x-36 group"
>
<h2 class="text-left mb-1 text-base font-semibold text-white">
AniList
</h2>
</div>
</div>
<AnimeTable/>
<AnimeTable />
<div class="bg-white flex rounded-lg shadow max-w-4-4 dark:bg-gray-800">
<div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-start">
<Button disabled={isSubmitting}
id="delete-button"
class="text-white bg-red-700 {$submitSuccess ?
'dark:bg-green-600 hover:bg-green-800 dark:hover:bg-green-700 focus:ring-4 focus:ring-green-300 dark:focus:ring-green-800' :
'dark:bg-red-600 hover:bg-red-800 dark:hover:bg-red-700 focus:ring-4 focus:ring-red-300 dark:focus:ring-red-800'
} font-medium
<div class="flex rounded-lg shadow max-w-4-4 bg-gray-800">
<div
class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-start"
>
<Button
disabled={isSubmitting}
id="delete-button"
class="text-white bg-red-700 {$submitSuccess
? 'bg-green-600 hover:bg-green-700 focus:ring-4 focus:ring-green-300 dark:focus:ring-green-800'
: 'bg-red-600 hover:bg-red-700 focus:ring-4 focus:ring-red-300 dark:focus:ring-red-800'} font-medium
rounded-lg text-sm px-5 py-2.5 me-2 mb-2 focus:outline-none"
on:click={deleteEntries}>
<svg id="submit-loader" aria-hidden="true" role="status"
class="{isSubmitting ? 'inline': 'hidden'} w-4 h-4 me-3 text-white animate-spin"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"/>
on:click={deleteEntries}
>
<svg
id="submit-loader"
aria-hidden="true"
role="status"
class="{isSubmitting
? 'inline'
: 'hidden'} w-4 h-4 me-3 text-white animate-spin"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"
/>
</svg>
Delete Entries
</Button>
</div>
<div class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-end">
<Button disabled={isSubmitting}
id="sync-button"
class="text-white bg-blue-700 {$submitSuccess ?
'dark:bg-green-600 hover:bg-green-800 dark:hover:bg-green-700 focus:ring-4 focus:ring-green-300 dark:focus:ring-green-800' :
'dark:bg-blue-600 hover:bg-blue-800 dark:hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800'
} font-medium
<div
class="w-full mx-auto max-w-screen-xl p-4 md:flex md:items-center md:justify-end"
>
<Button
disabled={isSubmitting}
id="sync-button"
class="text-white bg-blue-700 {$submitSuccess
? 'bg-green-600 hover:bg-green-700 focus:ring-4 focus:ring-green-300 dark:focus:ring-green-800'
: 'bg-blue-600 hover:bg-blue-700 focus:ring-4 focus:ring-blue-300 dark:focus:ring-blue-800'} font-medium
rounded-lg text-sm px-5 py-2.5 me-2 mb-2 focus:outline-none"
type="submit">
<svg id="submit-loader" aria-hidden="true" role="status"
class="{isSubmitting ? 'inline': 'hidden'} w-4 h-4 me-3 text-white animate-spin"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"/>
type="submit"
>
<svg
id="submit-loader"
aria-hidden="true"
role="status"
class="{isSubmitting
? 'inline'
: 'hidden'} w-4 h-4 me-3 text-white animate-spin"
viewBox="0 0 100 101"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="#E5E7EB"
/>
<path
d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentColor"
/>
</svg>
Sync Changes
</Button>
<Button
class="text-gray-900 bg-white border border-gray-300 focus:outline-none hover:bg-gray-100 focus:ring-4
focus:ring-gray-100 font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 dark:bg-gray-800 dark:text-white
dark:border-gray-600 dark:hover:bg-gray-700 dark:hover:border-gray-600 dark:focus:ring-gray-700"
on:click={async () => {
await CheckIfAniListLoggedInAndLoadWatchList()
return push('/')
}}>
class="border focus:outline-none focus:ring-4
font-medium rounded-lg text-sm px-5 py-2.5 me-2 mb-2 bg-gray-800 text-white
border-gray-600 hover:bg-gray-700 hover:border-gray-600 focus:ring-gray-700"
on:click={async () => {
await CheckIfAniListLoggedInAndLoadWatchList();
return push("/");
}}
>
Go Home
</Button>
</div>
</div>
<div>
<h3 class="text-2xl">
Summary
</h3>
<h3 class="text-2xl">Summary</h3>
<p>{@html currentAniListAnime.data.MediaList.media.description}</p>
</div>
</form>
</form>