diff --git a/frontend/src/helperComponents/Anime.svelte b/frontend/src/helperComponents/Anime.svelte
index fa0b091..4010694 100644
--- a/frontend/src/helperComponents/Anime.svelte
+++ b/frontend/src/helperComponents/Anime.svelte
@@ -11,22 +11,22 @@
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import { push } from "svelte-spa-router";
import WebsiteLink from "./WebsiteLink.svelte";
- import type { AniListGetSingleAnime } from "../anilist/types/AniListCurrentUserWatchListType";
+ import type {
+ AniListGetSingleAnime,
+ AniListUpdateVariables,
+ MALAnime,
+ MalListStatus,
+ MALUploadStatus,
+ SimklAnime,
+ } from "../../bindings/AniTrack/models";
import Rating from "./Rating.svelte";
import {
convertAniListDateToString,
convertAniListDateToDate,
} from "../helperFunctions/convertAniListDateIn";
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 { convertDateToAniList } from "../helperFunctions/convertDateToAniList";
import {App} from "../../bindings/AniTrack";
import { AddAnimeServiceToTable } from "../helperModules/AddAnimeServiceToTable.svelte";
@@ -35,12 +35,12 @@
import { Badge, Tooltip } from "flowbite-svelte";
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
- let isAniListLoggedIn: boolean;
- let isMalLoggedIn: boolean;
- let isSimklLoggedIn: boolean;
- let currentAniListAnime: AniListGetSingleAnime;
- let currentMalAnime: MALAnime;
- let currentSimklAnime: SimklAnime;
+ 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);
@@ -103,11 +103,15 @@
let finishDate = "";
if (currentMalAnime.my_list_status.start_date !== "") {
const startArray = re.exec(currentMalAnime.my_list_status.start_date);
- startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
+ if (startArray) {
+ startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
+ }
}
if (currentMalAnime.my_list_status.finish_date !== "") {
const finishArray = re.exec(currentMalAnime.my_list_status.finish_date);
- finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
+ if (finishArray) {
+ finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
+ }
}
AddAnimeServiceToTable({
id: `m-${currentMalAnime.id}`,
@@ -180,7 +184,11 @@
submitData.status = startingAnilistStatusOption;
continue;
}
- submitData[key] = value;
+ // The only remaining form field is "notes" (string); anything else
+ // is ignored rather than assigned into a mistyped slot.
+ if (key === "notes" && typeof value === "string") {
+ submitData.notes = value;
+ }
}
try {
@@ -271,13 +279,17 @@
const startArray = re.exec(
currentMalAnime.my_list_status.start_date,
);
- startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
+ if (startArray) {
+ startDate = `${startArray[2]}-${startArray[3]}-${startArray[1]}`;
+ }
}
if (currentMalAnime.my_list_status.finish_date !== "") {
const finishArray = re.exec(
currentMalAnime.my_list_status.finish_date,
);
- finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
+ if (finishArray) {
+ finishDate = `${finishArray[2]}-${finishArray[3]}-${finishArray[1]}`;
+ }
}
AddAnimeServiceToTable({
id: `m-${currentMalAnime.id}`,
@@ -503,7 +515,7 @@
{title}
-
+
-
- {#if $apiError.canRetry}
-
- Retry Connection
-
- {/if}
- Dismiss
-
+ {#snippet footer()}
+
+ {#if $apiError.canRetry}
+
+ Retry Connection
+
+ {/if}
+ Dismiss
+
+ {/snippet}
{/if}
diff --git a/frontend/src/helperComponents/Header.svelte b/frontend/src/helperComponents/Header.svelte
index 21dac39..c1aa211 100644
--- a/frontend/src/helperComponents/Header.svelte
+++ b/frontend/src/helperComponents/Header.svelte
@@ -13,9 +13,9 @@
import logo from "../assets/images/AniTrackLogo.svg";
import { link } from "svelte-spa-router";
- let isAniListLoggedIn: boolean;
- let isSimklLoggedIn: boolean;
- let isMALLoggedIn: boolean;
+ let isAniListLoggedIn!: boolean;
+ let isSimklLoggedIn!: boolean;
+ let isMALLoggedIn!: boolean;
let loggingIn: string[] = [];
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
@@ -42,7 +42,8 @@
{
- let menu = document.querySelector("#navbar-user");
+ const menu = document.querySelector("#navbar-user");
+ if (!menu) return;
menu.classList.toggle("hidden");
}}
type="button"
diff --git a/frontend/src/helperComponents/Pagination.svelte b/frontend/src/helperComponents/Pagination.svelte
index e63e05c..8112989 100644
--- a/frontend/src/helperComponents/Pagination.svelte
+++ b/frontend/src/helperComponents/Pagination.svelte
@@ -7,13 +7,13 @@
watchListPage,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
- import type { AniListCurrentUserWatchList } from "../anilist/types/AniListCurrentUserWatchListType";
+ import type { AniListCurrentUserWatchList } from "../../bindings/AniTrack/models";
import {App} from "../../bindings/AniTrack";
let aniListWatchListLoaded: AniListCurrentUserWatchList;
let page: number;
let perPage: number;
- let sort: string;
+ let sort!: string;
watchListPage.subscribe((value) => (page = value));
animePerPage.subscribe((value) => (perPage = value));
@@ -151,6 +151,7 @@
ChangeWatchListPage(page - 1)}
class={page <= 1
@@ -191,6 +192,7 @@
ChangeWatchListPage(page + 1)}
class={page >= aniListWatchListLoaded.data.Page.pageInfo.lastPage
diff --git a/frontend/src/helperComponents/Sort.svelte b/frontend/src/helperComponents/Sort.svelte
index 4111f15..ff147bb 100644
--- a/frontend/src/helperComponents/Sort.svelte
+++ b/frontend/src/helperComponents/Sort.svelte
@@ -50,7 +50,7 @@
{ value: MediaListSort.MediaPopularityDesc, name: "Media Popularity Desc" },
];
- let sort: string;
+ let sort!: string;
aniListSort.subscribe((value) => (sort = value));
console.log(sort);
diff --git a/frontend/src/helperComponents/WatchList.svelte b/frontend/src/helperComponents/WatchList.svelte
index 781ba35..bb02d12 100644
--- a/frontend/src/helperComponents/WatchList.svelte
+++ b/frontend/src/helperComponents/WatchList.svelte
@@ -6,14 +6,14 @@
loading,
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
import { push } from "svelte-spa-router";
- import type { AniListCurrentUserWatchList } from "../anilist/types/AniListCurrentUserWatchListType";
+ import type { AniListCurrentUserWatchList } from "../../bindings/AniTrack/models";
import { Rating } from "flowbite-svelte";
import loader from "../helperFunctions/loader";
import { CheckIfAniListLoggedInAndLoadWatchList } from "../helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte";
import Sort from "../helperComponents/Sort.svelte";
import RefreshWatchListButton from "./RefreshWatchListButton.svelte";
- let isAniListLoggedIn: boolean;
+ let isAniListLoggedIn!: boolean;
let aniListWatchListLoaded: AniListCurrentUserWatchList;
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
diff --git a/frontend/src/helperComponents/WebsiteLink.svelte b/frontend/src/helperComponents/WebsiteLink.svelte
index 3237cac..81d40a7 100644
--- a/frontend/src/helperComponents/WebsiteLink.svelte
+++ b/frontend/src/helperComponents/WebsiteLink.svelte
@@ -12,7 +12,7 @@
isAniList = id.includes("a-");
isMAL = id.includes("m-");
isSimkl = id.includes("s-");
- if (isAniList || isMAL || isSimkl) newId = id.match(re)[1];
+ if (isAniList || isMAL || isSimkl) newId = id.match(re)![1];
else newId = id;
}
diff --git a/frontend/src/helperDefaults/AniListGetSingleAnime.ts b/frontend/src/helperDefaults/AniListGetSingleAnime.ts
index 5fd955d..970c9c3 100644
--- a/frontend/src/helperDefaults/AniListGetSingleAnime.ts
+++ b/frontend/src/helperDefaults/AniListGetSingleAnime.ts
@@ -1,4 +1,4 @@
-import type {AniListGetSingleAnime} from "../anilist/types/AniListCurrentUserWatchListType";
+import type {AniListGetSingleAnime} from "../../bindings/AniTrack/models";
export const AniListGetSingleAnimeDefaultData: AniListGetSingleAnime = {
data: {
@@ -10,23 +10,57 @@ export const AniListGetSingleAnimeDefaultData: AniListGetSingleAnime = {
id: 0,
idMal: 0,
title: {
+ userPreferred: "",
romaji: "",
english: "",
native: "",
},
description: "",
coverImage: {
+ ExtraLarge: "",
large: "",
+ Medium: "",
+ Color: "",
},
+ BannerImage: "",
+ Format: "",
season: "",
seasonYear: 0,
status: "",
episodes: 0,
+ Duration: 0,
+ CountryOfOrigin: "",
+ Source: "",
+ Synonyms: null,
+ AverageScore: 0,
+ MeanScore: 0,
+ Popularity: 0,
+ Trending: 0,
+ Favourites: 0,
+ relations: {
+ nodes: null,
+ },
+ startDate: {
+ year: 0,
+ month: 0,
+ day: 0,
+ },
+ endDate: {
+ year: 0,
+ month: 0,
+ day: 0,
+ },
nextAiringEpisode: {
airingAt: 0,
timeUntilAiring: 0,
episode: 0,
- }
+ },
+ airingSchedule: {
+ nodes: null,
+ },
+ genres: [],
+ tags: [],
+ isAdult: false,
},
status: "",
startedAt: {
diff --git a/frontend/src/helperFunctions/convertAniListDateIn.ts b/frontend/src/helperFunctions/convertAniListDateIn.ts
index 87be12c..f6786a0 100644
--- a/frontend/src/helperFunctions/convertAniListDateIn.ts
+++ b/frontend/src/helperFunctions/convertAniListDateIn.ts
@@ -13,7 +13,7 @@ const convertAniListDateToString = (date: {
) {
return "";
}
- const newISODate = new Date(date.year, date.month - 1, date.day);
+ const newISODate = new Date(date.year, date.month! - 1, date.day);
const newMoment = moment(newISODate);
return newMoment.format("MM-DD-YYYY");
};
@@ -31,7 +31,7 @@ const convertAniListDateToDate = (date: {
) {
return null;
}
- return new Date(date.year, date.month - 1, date.day);
+ return new Date(date.year, date.month! - 1, date.day);
};
export { convertAniListDateToString, convertAniListDateToDate };
diff --git a/frontend/src/helperFunctions/convertDateToAniList.ts b/frontend/src/helperFunctions/convertDateToAniList.ts
index 73ccdb4..7a28ac0 100644
--- a/frontend/src/helperFunctions/convertDateToAniList.ts
+++ b/frontend/src/helperFunctions/convertDateToAniList.ts
@@ -14,6 +14,13 @@ const convertDateStringToAniList = (date: string): AnilistDate => {
}
const re = /^([0-9]{4})-([0-9]{2})-([0-9]{2})/;
const newDate = re.exec(date);
+ if (newDate === null) {
+ return {
+ year: 0,
+ month: 0,
+ day: 0,
+ };
+ }
return {
year: Number(newDate[1]),
month: Number(newDate[2]),
diff --git a/frontend/src/helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte b/frontend/src/helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte
index 282eb07..db590d3 100644
--- a/frontend/src/helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte
+++ b/frontend/src/helperModules/CheckIfAniListLoggedInAndLoadWatchList.svelte
@@ -16,7 +16,7 @@
let isAniListPrimary: boolean;
let page: number;
let perPage: number;
- let sort: string;
+ let sort!: string;
aniListPrimary.subscribe((value) => (isAniListPrimary = value));
watchListPage.subscribe((value) => (page = value));
diff --git a/frontend/src/helperModules/CheckIfMyAnimeListLoggedIn.svelte b/frontend/src/helperModules/CheckIfMyAnimeListLoggedIn.svelte
index 822a925..6747578 100644
--- a/frontend/src/helperModules/CheckIfMyAnimeListLoggedIn.svelte
+++ b/frontend/src/helperModules/CheckIfMyAnimeListLoggedIn.svelte
@@ -1,7 +1,7 @@