made entire app only work in dark mode

This commit is contained in:
John O'Keefe 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>

View File

@ -1,109 +1,106 @@
<script lang="ts">
import {createTable, Render, Subscribe} from "svelte-headless-table";
import { createTable, Render, Subscribe } from "svelte-headless-table";
// @ts-ignore
import { addSortBy } from "svelte-headless-table/plugins";
import {tableItems} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
import { tableItems } from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
//when adding sort here is code { sort: addSortBy() }
const table = createTable(tableItems, { sort: addSortBy() })
const table = createTable(tableItems, { sort: addSortBy() });
const columns = table.createColumns([
table.column({
header: "Service Id",
accessor: 'id',
accessor: "id",
}),
table.column({
header: "Anime Title",
accessor: "title",
}),
table.column({
header: 'Service',
accessor: 'service',
header: "Service",
accessor: "service",
}),
table.column({
header: 'Episode Progress',
accessor: 'progress',
header: "Episode Progress",
accessor: "progress",
}),
table.column({
header: 'Status',
accessor: 'status',
header: "Status",
accessor: "status",
}),
table.column({
header: 'Started At',
accessor: 'startedAt',
header: "Started At",
accessor: "startedAt",
}),
table.column({
header: 'Completed At',
accessor: 'completedAt',
header: "Completed At",
accessor: "completedAt",
}),
table.column({
header: 'Rating',
accessor: 'score',
header: "Rating",
accessor: "score",
}),
table.column({
header: 'Repeat',
accessor: 'repeat',
header: "Repeat",
accessor: "repeat",
}),
table.column({
header: 'Notes',
accessor: 'notes',
header: "Notes",
accessor: "notes",
}),
])
]);
//add pluginStates when add sort back
const {
headerRows,
rows,
tableAttrs,
tableBodyAttrs,
} = table.createViewModel(columns)
const { headerRows, rows, tableAttrs, tableBodyAttrs } =
table.createViewModel(columns);
</script>
<div class="relative overflow-x-auto rounded-lg mb-5">
<table
class="w-full text-sm text-left rtl:text-right text-gray-500 dark:text-gray-400"
{...$tableAttrs}
class="w-full text-sm text-left rtl:text-right text-gray-400"
{...$tableAttrs}
>
<thead
class="text-xs text-gray-700 uppercase bg-gray-50 dark:bg-gray-700 dark:text-gray-400"
>
{#each $headerRows as headerRow (headerRow.id)}
<Subscribe attrs={headerRow.attrs()} let:attrs>
<tr {...attrs}>
{#each headerRow.cells as cell (cell.id)}
<Subscribe attrs={cell.attrs()} let:attrs props={cell.props()} let:props>
<th
<thead class="text-xs uppercase bg-gray-700 text-gray-400">
{#each $headerRows as headerRow (headerRow.id)}
<Subscribe attrs={headerRow.attrs()} let:attrs>
<tr {...attrs}>
{#each headerRow.cells as cell (cell.id)}
<Subscribe
attrs={cell.attrs()}
let:attrs
props={cell.props()}
let:props
>
<th
{...attrs}
on:click={props.sort.toggle}
class:sorted={props.sort.order !== undefined}
class:sorted={props.sort.order !==
undefined}
class="px-6 py-3"
>
<div>
<Render of={cell.render()}/>
{#if props.sort.order === 'asc'}
⬇️
{:else if props.sort.order === 'desc'}
⬆️
{/if}
</div>
</th>
</Subscribe>
{/each}
</tr>
</Subscribe>
{/each}
>
<div>
<Render of={cell.render()} />
{#if props.sort.order === "asc"}
⬇️
{:else if props.sort.order === "desc"}
⬆️
{/if}
</div>
</th>
</Subscribe>
{/each}
</tr>
</Subscribe>
{/each}
</thead>
<tbody {...$tableBodyAttrs}>
{#each $rows as row (row.id)}
<Subscribe attrs={row.attrs()} let:attrs>
<tr
{...attrs}
class="bg-white border-b dark:bg-gray-800 dark:border-gray-700"
>
<tr {...attrs} class="bg-gray-800 border-gray-700">
{#each row.cells as cell (cell.id)}
<Subscribe attrs={cell.attrs()} let:attrs>
<td {...attrs} class="px-6 py-4">
<Render of={cell.render()}/>
<Render of={cell.render()} />
</td>
</Subscribe>
{/each}

View File

@ -1,76 +1,99 @@
<script lang="ts">
import {Avatar} from "flowbite-svelte";
import type {AniListUser} from "../anilist/types/AniListTypes";
import {aniListLoggedIn, aniListUser, malLoggedIn, simklLoggedIn, logoutOfAniList, logoutOfMAL, logoutOfSimkl} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte"
import { Avatar } from "flowbite-svelte";
import type { AniListUser } from "../anilist/types/AniListTypes";
import {
aniListLoggedIn,
aniListUser,
malLoggedIn,
simklLoggedIn,
logoutOfAniList,
logoutOfMAL,
logoutOfSimkl,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import * as runtime from "../../wailsjs/runtime";
let currentAniListUser: AniListUser
let isAniListLoggedIn: boolean
let isSimklLoggedIn: boolean
let isMALLoggedIn: boolean
let currentAniListUser: AniListUser;
let isAniListLoggedIn: boolean;
let isSimklLoggedIn: boolean;
let isMALLoggedIn: boolean;
aniListUser.subscribe((value) => currentAniListUser = value)
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
malLoggedIn.subscribe((value) => isMALLoggedIn = value)
aniListUser.subscribe((value) => (currentAniListUser = value));
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value));
malLoggedIn.subscribe((value) => (isMALLoggedIn = value));
function dropdownUser(): void {
let dropdown = document.querySelector("#userDropdown")
dropdown.classList.toggle("hidden")
let dropdown = document.querySelector("#userDropdown");
dropdown.classList.toggle("hidden");
}
</script>
<div class="relative">
<button id="userDropdownButton" on:click={dropdownUser}>
{#if isAniListLoggedIn}
<Avatar src="{currentAniListUser.data.Viewer.avatar.medium}" class="cursor-pointer"
dot={{ color: 'green' }}/>
<Avatar
src={currentAniListUser.data.Viewer.avatar.medium}
class="cursor-pointer"
dot={{ color: "green" }}
/>
{:else}
<Avatar class="cursor-pointer" dot={{ color: 'red' }}/>
<Avatar class="cursor-pointer" dot={{ color: "red" }} />
{/if}
</button>
<div id="userDropdown"
class="absolute hidden right-0 2xl:left-1/2 2xl:-translate-x-1/2 z-10 bg-white divide-y divide-gray-100 rounded-lg shadow w-44 dark:bg-gray-700 dark:divide-gray-600">
<div class="px-4 py-3 text-sm text-gray-900 dark:text-white">
<div
id="userDropdown"
class="absolute hidden right-0 2xl:left-1/2 2xl:-translate-x-1/2 z-10 divide-y rounded-lg shadow w-44 bg-gray-700 divide-gray-600"
>
<div class="px-4 py-3 text-sm text-white">
{#if isAniListLoggedIn}
<div>{currentAniListUser.data.Viewer.name}</div>
{:else}
<div>You are not logged into AniList</div>
{/if}
</div>
<ul class="py-2 text-sm text-gray-700 dark:text-gray-200"
aria-labelledby="dropdownUserAvatarButton">
<ul
class="py-2 text-sm text-gray-200"
aria-labelledby="dropdownUserAvatarButton"
>
{#if isAniListLoggedIn}
<li>
<button on:click={logoutOfAniList}
class="block px-4 py-2 w-full hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
<button
on:click={logoutOfAniList}
class="block px-4 py-2 w-full hover:bg-gray-600 hover:text-white"
>
Logout Anilist
</button>
</li>
{/if}
{#if isMALLoggedIn}
<li>
<button on:click={logoutOfMAL}
class="block px-4 py-2 w-full hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
<button
on:click={logoutOfMAL}
class="block px-4 py-2 w-full hover:bg-gray-600 hover:text-white"
>
Logout MAL
</button>
</li>
{/if}
{#if isSimklLoggedIn}
<li>
<button on:click={logoutOfSimkl}
class="block px-4 py-2 w-full hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white">
<button
on:click={logoutOfSimkl}
class="block px-4 py-2 w-full hover:bg-gray-600 hover:text-white"
>
Logout Simkl
</button>
</li>
{/if}
</ul>
<div class="py-2">
<button on:click={() => runtime.Quit()}
class="block px-4 py-2 w-full text-sm text-gray-700 hover:bg-gray-100 dark:hover:bg-gray-600 dark:text-gray-200 dark:hover:text-white">
<button
on:click={() => runtime.Quit()}
class="block px-4 py-2 w-full text-sm hover:bg-gray-600 text-gray-200 over:text-white"
>
Exit Application
</button>
</div>
</div>
</div>
</div>

View File

@ -50,14 +50,14 @@
{#if page === 1}
<li>
<button disabled
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 cursor-default">
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight border border-e-0 rounded-s-lg border-gray-700 text-gray-400 cursor-default">
Previous
</button>
</li>
{:else}
<li>
<button on:click={() => ChangeWatchListPage(page-1)}
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight text-gray-500 bg-white border border-e-0 border-gray-300 rounded-s-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">
class="flex items-center justify-center px-4 h-10 ms-0 leading-tight border border-e-0 rounded-s-lg border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">
Previous
</button>
</li>
@ -66,26 +66,26 @@
{#if i + 1 === page}
<li>
<button on:click={() => ChangeWatchListPage(i+1)}
class="flex items-center justify-center px-4 h-10 leading-tight border border-gray-300 bg-gray-100 dark:border-gray-700 dark:bg-gray-700 dark:text-white">{i + 1}</button>
class="flex items-center justify-center px-4 h-10 leading-tight border bg-gray-100 border-gray-700 bg-gray-700 text-white">{i + 1}</button>
</li>
{:else}
<li>
<button on:click={() => ChangeWatchListPage(i+1)}
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-white border border-gray-300 hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">{i + 1}</button>
class="flex items-center justify-center px-4 h-10 leading-tight border dark border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">{i + 1}</button>
</li>
{/if}
{/each}
{#if page === aniListWatchListLoaded.data.Page.pageInfo.lastPage}
<li>
<button disabled
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 cursor-default">
class="flex items-center justify-center px-4 h-10 leading-tight border rounded-e-lg dark border-gray-700 text-gray-400 cursor-default">
Next
</button>
</li>
{:else}
<li>
<button on:click={() => ChangeWatchListPage(page+1)}
class="flex items-center justify-center px-4 h-10 leading-tight text-gray-500 bg-white border border-gray-300 rounded-e-lg hover:bg-gray-100 hover:text-gray-700 dark:bg-gray-800 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-700 dark:hover:text-white">
class="flex items-center justify-center px-4 h-10 leading-tight border rounded-e-lg dark border-gray-700 text-gray-400 hover:bg-gray-700 hover:text-white">
Next
</button>
</li>
@ -96,7 +96,7 @@
<div class="flex mt-5">
<div class="w-20 mx-auto">
<select bind:value={perPage} on:change={(e) => changeCountPerPage(e)} id="countPerPage"
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 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">
class="border text-sm rounded-lg block w-full p-2.5 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500">
{#each perPageOptions as option}
<option value={option}>
{option}
@ -117,8 +117,8 @@
<div class="max-w-xs mx-auto">
<div class="relative flex items-center max-w-[11rem]">
<button type="button" id="decrement-button" on:click={() => ChangeWatchListPage(page-1)}
class="bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 hover:bg-gray-200 border border-gray-300 rounded-s-lg p-3 h-11 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none">
<svg class="w-3 h-3 text-gray-900 dark:text-white" aria-hidden="true"
class="bg-gray-700 hover:bg-gray-600 border-gray-600 border rounded-s-lg p-3 h-11 focus:ring-gray-700 focus:ring-2 focus:outline-none">
<svg class="w-3 h-3 text-white" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 2">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M1 1h16"/>
@ -126,14 +126,14 @@
</button>
<input type="number" min="1" max="{aniListWatchListLoaded.data.Page.pageInfo.lastPage}"
on:keydown={changePage} id="page-counter"
class="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none bg-gray-50 border-x-0 border-gray-300 h-11 font-medium text-center text-gray-900 text-sm focus:ring-blue-500 focus:border-blue-500 block w-full pb-6 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"
class="[appearance:textfield] [&::-webkit-outer-spin-button]:appearance-none [&::-webkit-inner-spin-button]:appearance-none border-x-0 h-11 font-medium text-center text-sm block w-full pb-6 bg-gray-700 border-gray-600 placeholder-gray-400 text-white focus:ring-blue-500 focus:border-blue-500"
value={page} required/>
<div class="absolute bottom-1 start-1/2 -translate-x-1/2 rtl:translate-x-1/2 flex items-center text-xs text-gray-400 space-x-1 rtl:space-x-reverse">
<span>Page #</span>
</div>
<button type="button" id="increment-button" on:click={() => ChangeWatchListPage(page+1)}
class="bg-gray-100 dark:bg-gray-700 dark:hover:bg-gray-600 dark:border-gray-600 hover:bg-gray-200 border border-gray-300 rounded-e-lg p-3 h-11 focus:ring-gray-100 dark:focus:ring-gray-700 focus:ring-2 focus:outline-none">
<svg class="w-3 h-3 text-gray-900 dark:text-white" aria-hidden="true"
class="hover:bg-gray-600 border-gray-600 border rounded-e-lg p-3 h-11 focus:ring-gray-700 focus:ring-2 focus:outline-none">
<svg class="w-3 h-3 text-white" aria-hidden="true"
xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 18 18">
<path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"
d="M9 1v16M1 9h16"/>

View File

@ -25,11 +25,11 @@
<div id="searchDropdown" class="relative w-64 md:w-48">
<div class="flex">
<label for="anime-search" class="mb-2 text-sm font-medium text-gray-900 sr-only dark:text-white">Find
<label for="anime-search" class="mb-2 text-sm font-medium sr-only text-white">Find
Anime</label>
<div class="relative w-full">
<input type="search" id="anime-search" bind:value={aniSearch}
class="rounded-s-lg block p-2.5 w-full z-20 text-sm text-gray-900 bg-gray-50 rounded-e-lg border-s-gray-50 border-s-2 border border-gray-300 focus:ring-blue-500 focus:border-blue-500 dark:bg-gray-700 dark:border-s-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:border-blue-500"
class="rounded-s-lg block p-2.5 w-full z-20 text-sm rounded-e-lg bg-gray-700 border-s-gray-700 border-gray-600 placeholder-gray-400 text-white focus:border-blue-500"
placeholder="Search for Anime"
on:keypress={(e) => {
if (e.key === "Enter") {
@ -39,7 +39,7 @@
}}
required/>
<button id="aniListSearchButton"
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium text-white bg-blue-700 rounded-e-lg border border-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800"
class="absolute top-0 end-0 h-full p-2.5 text-sm font-medium rounded-e-lg border focus:ring-4 focus:outline-none bg-blue-600 hover:bg-blue-700 focus:ring-blue-800"
on:click={() => {
searchDropdown()
if(aniSearch.length > 0) runAniListSearch()
@ -60,7 +60,7 @@
aria-labelledby="aniListSearchButton">
{#each aniListSearch.data.Page.media as media}
<li class="w-full">
<div class="flex w-full items-start p-1 hover:bg-gray-100 dark:hover:bg-gray-600 dark:hover:text-white rounded-lg">
<div class="flex w-full items-start p-1 hover:bg-gray-600 hover:text-white rounded-lg">
<button on:click={() => {
searchDropdown()
push(`#/anime/${media.id}`)