Update detection of guest and logged in usesr, add tooltip

This commit is contained in:
Korbs 2024-08-10 20:10:17 -04:00
parent 709592a9d7
commit 5b3b85ae8a

View file

@ -26,12 +26,12 @@ import {
PlanetAlt, PlanetAlt,
InputSearch, InputSearch,
Settings, Settings,
LogIn LogIn,
LogOut
} from '@iconoir/vue' } from '@iconoir/vue'
// i18n // i18n
import i18next, { t } from "i18next" import i18next, { t } from "i18next"
import SettingsLayout from '@layouts/Settings.astro'
// Supabase Data // Supabase Data
import { supabase } from "@library/supabase" import { supabase } from "@library/supabase"
@ -39,7 +39,7 @@ const { data: { user } } = await supabase.auth.getUser()
const id = user?.id const id = user?.id
// Is the user logged in? // Is the user logged in?
if (user?.id === "undefined") { if (Astro.cookies.get('sb-access-token') === undefined) {
var Guest = true var Guest = true
} else { } else {
var Guest = false var Guest = false
@ -61,8 +61,12 @@ let { data: subs } = await supabase
<div class="sidebar-top-start"> <div class="sidebar-top-start">
<a href='/'><img src="/images/logo/MinPluto - Logo.png"/></a> <a href='/'><img src="/images/logo/MinPluto - Logo.png"/></a>
<div> <div>
<a href="/login"><LogIn/></a> {Guest ?
<a href="#"><Settings/></a> <a title="Login" href="/login"><LogIn/></a>
:
<a title="Log Out" href="/api/auth/logout"><LogOut/></a>
}
<a title="Settings" href="#"><Settings/></a>
</div> </div>
</div> </div>
<div class="sidebar-top-end"> <div class="sidebar-top-end">