- all 16 min-[950px] instances (the only file using the custom breakpoint) become standard sm:, so inline search survives the whole tablet range and the hamburger appears only once search leaves at true mobile width; avatar present throughout either way - the top-bar search wrapper was also missing its base hidden, which rendered search twice below the breakpoint; fixed in the same pass
135 lines
5.4 KiB
Svelte
135 lines
5.4 KiB
Svelte
<script lang="ts">
|
|
import Search from "./Search.svelte";
|
|
import {
|
|
aniListLoggedIn,
|
|
loginToAniList,
|
|
loginToMAL,
|
|
loginToSimkl,
|
|
malLoggedIn,
|
|
simklLoggedIn,
|
|
serviceLoggingIn,
|
|
} from "../helperModules/GlobalVariablesAndHelperFunctions.svelte";
|
|
import AvatarMenu from "./AvatarMenu.svelte";
|
|
import logo from "../assets/images/AniTrackLogo.svg";
|
|
import { link } from "svelte-spa-router";
|
|
|
|
let isAniListLoggedIn!: boolean;
|
|
let isSimklLoggedIn!: boolean;
|
|
let isMALLoggedIn!: boolean;
|
|
let loggingIn: string[] = [];
|
|
|
|
aniListLoggedIn.subscribe((value) => (isAniListLoggedIn = value));
|
|
simklLoggedIn.subscribe((value) => (isSimklLoggedIn = value));
|
|
malLoggedIn.subscribe((value) => (isMALLoggedIn = value));
|
|
serviceLoggingIn.subscribe((value) => (loggingIn = value));
|
|
</script>
|
|
|
|
<nav class="border-gray-200 bg-gray-900">
|
|
<div
|
|
class="max-w-screen-xl flex flex-wrap items-center justify-between mx-auto p-4"
|
|
>
|
|
<div class="flex items-center space-x-3 rtl:space-x-reverse">
|
|
<a href="/" use:link
|
|
><img src={logo} class="h-8" alt="AniTrack Logo" /></a
|
|
>
|
|
</div>
|
|
<div
|
|
class="flex items-center sm:order-2 space-x-3 sm:space-x-0 rtl:space-x-reverse"
|
|
>
|
|
<div class="hidden sm:block sm:mr-4">
|
|
<Search />
|
|
</div>
|
|
<AvatarMenu />
|
|
<button
|
|
on:click={() => {
|
|
const menu = document.querySelector("#navbar-user");
|
|
if (!menu) return;
|
|
menu.classList.toggle("hidden");
|
|
}}
|
|
type="button"
|
|
class="inline-flex items-center p-2 w-10 h-10 justify-center text-sm rounded-lg sm:hidden focus:outline-none focus:ring-2 text-gray-400 hover:bg-gray-700 focus:ring-gray-600"
|
|
aria-controls="navbar-user"
|
|
aria-expanded="false"
|
|
>
|
|
<span class="sr-only">Open main menu</span>
|
|
<svg
|
|
class="w-5 h-5"
|
|
aria-hidden="true"
|
|
xmlns="http://www.w3.org/2000/svg"
|
|
fill="none"
|
|
viewBox="0 0 17 14"
|
|
>
|
|
<path
|
|
stroke="currentColor"
|
|
stroke-linecap="round"
|
|
stroke-linejoin="round"
|
|
stroke-width="2"
|
|
d="M1 1h15M1 7h15M1 13h15"
|
|
/>
|
|
</svg>
|
|
</button>
|
|
</div>
|
|
<div
|
|
class="hidden items-center justify-between w-full pb-4 sm:pb-0 sm:flex sm:w-auto sm:order-1 border border-gray-700 sm:border-0 bg-gray-800 sm:bg-transparent rounded-lg"
|
|
id="navbar-user"
|
|
>
|
|
<ul
|
|
class="flex flex-col font-medium pb-6 sm:p-0 mt-4 sm:space-x-8 rtl:space-x-reverse sm:flex-row sm:mt-0"
|
|
>
|
|
<li>
|
|
{#if !isAniListLoggedIn}
|
|
<button
|
|
disabled={loggingIn.includes("anilist")}
|
|
on:click={loginToAniList}
|
|
>
|
|
{#if loggingIn.includes("anilist")}
|
|
<span
|
|
class="inline-block w-4 h-4 mr-2 border-2 border-gray-300 border-t-transparent rounded-full animate-spin align-middle"
|
|
></span
|
|
>Checking AniList
|
|
{:else}
|
|
AniList Login
|
|
{/if}
|
|
</button>
|
|
{/if}
|
|
{#if !isMALLoggedIn}
|
|
<button
|
|
disabled={loggingIn.includes("mal")}
|
|
on:click={loginToMAL}
|
|
>
|
|
{#if loggingIn.includes("mal")}
|
|
<span
|
|
class="inline-block w-4 h-4 mr-2 border-2 border-gray-300 border-t-transparent rounded-full animate-spin align-middle"
|
|
></span
|
|
>Checking MAL
|
|
{:else}
|
|
MyAnimeList Login
|
|
{/if}
|
|
</button>
|
|
{/if}
|
|
</li>
|
|
<li>
|
|
{#if !isSimklLoggedIn}
|
|
<button
|
|
disabled={loggingIn.includes("simkl")}
|
|
on:click={loginToSimkl}
|
|
>
|
|
{#if loggingIn.includes("simkl")}
|
|
<span
|
|
class="inline-block w-4 h-4 mr-2 border-2 border-gray-300 border-t-transparent rounded-full animate-spin align-middle"
|
|
></span
|
|
>Checking Simkl
|
|
{:else}
|
|
Simkl Login
|
|
{/if}
|
|
</button>
|
|
{/if}
|
|
</li>
|
|
</ul>
|
|
<div class="flex justify-center sm:hidden">
|
|
<Search />
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</nav>
|