added ability to change simkl status
This commit is contained in:
@ -14,7 +14,7 @@
|
||||
import { writable } from 'svelte/store';
|
||||
import type {SimklAnime} from "./simkl/types/simklTypes";
|
||||
import { get } from 'svelte/store';
|
||||
import {AniListUpdateEntry, SimklSyncEpisodes, SimklSyncRating} from "../wailsjs/go/main/App";
|
||||
import {AniListUpdateEntry, SimklSyncEpisodes, SimklSyncRating, SimklSyncStatus} from "../wailsjs/go/main/App";
|
||||
|
||||
const simklWatch = get(simklWatchList);
|
||||
let isAniListLoggedIn: boolean
|
||||
@ -32,6 +32,25 @@
|
||||
}
|
||||
}
|
||||
|
||||
type statusOption = {
|
||||
id: number,
|
||||
aniList: string,
|
||||
simkl: string,
|
||||
}
|
||||
|
||||
const statusOptions: statusOption[] = [
|
||||
{ id: 0, aniList: "CURRENT", simkl: "watching"},
|
||||
{ id: 1, aniList: "PLANNING", simkl: "plantowatch"},
|
||||
{ id: 2, aniList: "COMPLETED", simkl: "completed"},
|
||||
{ id: 3, aniList: "DROPPED", simkl: "dropped"},
|
||||
{ id: 4, aniList: "PAUSED", simkl: "hold"},
|
||||
{ id: 5, aniList: "REPEATING", simkl: "watching"}
|
||||
]
|
||||
|
||||
let startingAnilistStatusOption: statusOption
|
||||
|
||||
startingAnilistStatusOption = statusOptions.filter(option => aniListAnime.data.MediaList.status === option.aniList)[0]
|
||||
|
||||
let items = [];
|
||||
|
||||
if(isAniListLoggedIn) {
|
||||
@ -141,7 +160,7 @@
|
||||
|
||||
let values = {
|
||||
progress: aniListAnime.data.MediaList.progress,
|
||||
status: aniListAnime.data.MediaList.status,
|
||||
status: startingAnilistStatusOption,
|
||||
startedAt: {
|
||||
year: aniListAnime.data.MediaList.startedAt.year,
|
||||
month: aniListAnime.data.MediaList.startedAt.month,
|
||||
@ -197,7 +216,7 @@
|
||||
await AniListUpdateEntry(
|
||||
aniListAnime.data.MediaList.mediaId,
|
||||
values.progress,
|
||||
values.status,
|
||||
values.status.aniList,
|
||||
values.score,
|
||||
values.repeat,
|
||||
values.notes,
|
||||
@ -227,6 +246,14 @@
|
||||
simklWatch.anime[simklAnimeIndex].user_rating = values.score
|
||||
})
|
||||
}
|
||||
|
||||
if (simklAnime.status !== values.status.simkl) {
|
||||
SimklSyncStatus(simklAnime, values.status.simkl).then(value => {
|
||||
console.log(value)
|
||||
simklAnime.status = values.status.simkl
|
||||
simklWatch.anime[simklAnimeIndex].status = values.status.simkl
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@ -267,13 +294,9 @@
|
||||
dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
|
||||
bind:value={values.status}
|
||||
>
|
||||
|
||||
<option>CURRENT</option>
|
||||
<option>PLANNING</option>
|
||||
<option>COMPLETED</option>
|
||||
<option>DROPPED</option>
|
||||
<option>PAUSED</option>
|
||||
<option>REPEATING</option>
|
||||
{#each statusOptions as option}
|
||||
<option value={option}>{option.aniList}</option>
|
||||
{/each}
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
Reference in New Issue
Block a user