From d573b871ae98ee69328231d32672bcba7b944f8c Mon Sep 17 00:00:00 2001 From: John O'Keefe Date: Sun, 11 Aug 2024 20:42:57 -0400 Subject: [PATCH] moved login data to header --- frontend/src/App.svelte | 25 ++----------------------- frontend/src/Header.svelte | 26 ++++++++++++++++++++++---- 2 files changed, 24 insertions(+), 27 deletions(-) diff --git a/frontend/src/App.svelte b/frontend/src/App.svelte index e987dde..b266593 100644 --- a/frontend/src/App.svelte +++ b/frontend/src/App.svelte @@ -9,9 +9,7 @@ aniListUser, aniListPrimary, aniListWatchlist, - loginToAniList, GetAniListSingleItemAndOpenModal, - loginToSimkl } from "./GlobalVariablesAndHelperFunctions.svelte"; import { CheckIfAniListLoggedIn, @@ -21,28 +19,21 @@ GetSimklLoggedInUser, SimklGetUserWatchlist, } from "../wailsjs/go/main/App"; - import {type AniListUser, MediaListSort} from "./anilist/types/AniListTypes"; + import {MediaListSort} from "./anilist/types/AniListTypes"; import type {AniListCurrentUserWatchList} from "./anilist/types/AniListCurrentUserWatchListType" import Header from "./Header.svelte"; - import {Button, Rating} from "flowbite-svelte"; + import {Rating} from "flowbite-svelte"; import {default as Modal} from "./modal/Modal.svelte" import ChangeDataDialogue from "./ChangeDataDialogue.svelte"; import {onMount} from "svelte"; - import type {SimklUser} from "./simkl/types/simklTypes"; let isAniListLoggedIn: boolean - let isSimklLoggedIn: boolean - let currentSimklUser: SimklUser - let currentAniListUser: AniListUser let isAniListPrimary: boolean let aniListWatchListLoaded: AniListCurrentUserWatchList aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value) - simklLoggedIn.subscribe((value) => isSimklLoggedIn = value) - simklUser.subscribe((value) => currentSimklUser = value) - aniListUser.subscribe((value) => currentAniListUser = value) aniListPrimary.subscribe((value) => isAniListPrimary = value) aniListWatchlist.subscribe((value) => aniListWatchListLoaded = value) @@ -85,18 +76,6 @@
- {#if isAniListLoggedIn} -
You are logged into AniList, {currentAniListUser.data.Viewer.name}!
- {:else} - - {/if} - - {#if isSimklLoggedIn} -
You are logged into Simkl, {currentSimklUser.user.name}
- {:else} - - {/if} - {#if isAniListLoggedIn}

Your Watching List

diff --git a/frontend/src/Header.svelte b/frontend/src/Header.svelte index c86a42e..4366d76 100644 --- a/frontend/src/Header.svelte +++ b/frontend/src/Header.svelte @@ -4,14 +4,24 @@ import UserDialogue from "./UserHeaderDialogue.svelte"; import { aniListLoggedIn, - simklLoggedIn - } from "./GlobalVariablesAndHelperFunctions.svelte"; + simklLoggedIn, + loginToSimkl, + loginToAniList, + aniListUser, + simklUser + } from "./GlobalVariablesAndHelperFunctions.svelte" + import type {AniListUser} from "./anilist/types/AniListTypes"; + import type {SimklUser} from "./simkl/types/simklTypes"; let isAniListLoggedIn: boolean let isSimklLoggedIn: boolean + let currentAniListUser: AniListUser + let currentSimklUser: SimklUser aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value) simklLoggedIn.subscribe((value) => isSimklLoggedIn = value) + aniListUser.subscribe((value) => currentAniListUser = value) + simklUser.subscribe((value) => currentSimklUser = value) @@ -24,10 +34,18 @@
- AniList + {#if isAniListLoggedIn} + AniList: {currentAniListUser.data.Viewer.name} + {:else} + + {/if}
- Simkl + {#if isSimklLoggedIn} + Simkl: {currentSimklUser.user.name} + {:else} + + {/if}