From 7f4545d78d4e49ff0dee79e71b71ad7d5d6bacdc Mon Sep 17 00:00:00 2001
From: ivarlovlie <git@ivarlovlie.no>
Date: Fri, 5 Aug 2022 12:59:23 +0200
Subject: refactor: Change the user menu for a simple logout button

---
 apps/portal/src/app/pages/_layout@loggedin.svelte | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)

(limited to 'apps/portal/src/app/pages/_layout@loggedin.svelte')

diff --git a/apps/portal/src/app/pages/_layout@loggedin.svelte b/apps/portal/src/app/pages/_layout@loggedin.svelte
index ea56f73..44e2e4a 100644
--- a/apps/portal/src/app/pages/_layout@loggedin.svelte
+++ b/apps/portal/src/app/pages/_layout@loggedin.svelte
@@ -1,7 +1,7 @@
 <script>
 	import BlowoutToolbelt from "$shared/components/blowout-toolbelt.svelte";
-	import UserMenu from "$app/components/user-menu.svelte";
-	import {get_session_data} from "$shared/lib/session";
+    import {end_session, get_session_data} from "$shared/lib/session";
+    import {replace} from "svelte-spa-router";
 
 	const session = get_session_data();
 </script>
@@ -30,15 +30,20 @@
         height: auto;
     }
 </style>
-
 <BlowoutToolbelt/>
 <main class="container max-width-xl padding-x-xs padding-x-xxl@xs padding-y-md padding-y-lg@md">
     <div class="z-index-2 position-relative">
         <slot/>
     </div>
 
-    <div class="flex flex-row gap-xs position-fixed right-0 top-0 margin-md z-index-2">
-        <UserMenu name="{session?.profile?.username}"/>
+    <div class="flex flex-row gap-xs position-fixed left-0 top-0 margin-md z-index-2">
+        <span on:click={async () => {
+            if (confirm("Are you sure?")) await end_session(() => {
+                replace("/login");
+            })
+        }} class="btn btn--sm">
+            Logout
+        </span>
     </div>
 
     <figure id="decoration"
-- 
cgit v1.3

