Browse Source

fix: hide mobile sidebar after menu button click

Timothy J. Baek 7 months ago
parent
commit
47a858393b
1 changed files with 17 additions and 1 deletions
  1. 17 1
      src/lib/components/layout/Sidebar/UserMenu.svelte

+ 17 - 1
src/lib/components/layout/Sidebar/UserMenu.svelte

@@ -5,7 +5,7 @@
 	import { flyAndScale } from '$lib/utils/transitions';
 	import { flyAndScale } from '$lib/utils/transitions';
 	import { goto } from '$app/navigation';
 	import { goto } from '$app/navigation';
 	import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
 	import ArchiveBox from '$lib/components/icons/ArchiveBox.svelte';
-	import { showSettings, activeUserCount, USAGE_POOL } from '$lib/stores';
+	import { showSettings, activeUserCount, USAGE_POOL, mobile, showSidebar } from '$lib/stores';
 	import { fade, slide } from 'svelte/transition';
 	import { fade, slide } from 'svelte/transition';
 	import Tooltip from '$lib/components/common/Tooltip.svelte';
 	import Tooltip from '$lib/components/common/Tooltip.svelte';
 
 
@@ -41,6 +41,10 @@
 				on:click={async () => {
 				on:click={async () => {
 					await showSettings.set(true);
 					await showSettings.set(true);
 					show = false;
 					show = false;
+
+					if ($mobile) {
+						showSidebar.set(false);
+					}
 				}}
 				}}
 			>
 			>
 				<div class=" self-center mr-3">
 				<div class=" self-center mr-3">
@@ -72,6 +76,10 @@
 				on:click={() => {
 				on:click={() => {
 					dispatch('show', 'archived-chat');
 					dispatch('show', 'archived-chat');
 					show = false;
 					show = false;
+
+					if ($mobile) {
+						showSidebar.set(false);
+					}
 				}}
 				}}
 			>
 			>
 				<div class=" self-center mr-3">
 				<div class=" self-center mr-3">
@@ -86,6 +94,10 @@
 					on:click={() => {
 					on:click={() => {
 						goto('/playground');
 						goto('/playground');
 						show = false;
 						show = false;
+
+						if ($mobile) {
+							showSidebar.set(false);
+						}
 					}}
 					}}
 				>
 				>
 					<div class=" self-center mr-3">
 					<div class=" self-center mr-3">
@@ -112,6 +124,10 @@
 					on:click={() => {
 					on:click={() => {
 						goto('/admin');
 						goto('/admin');
 						show = false;
 						show = false;
+
+						if ($mobile) {
+							showSidebar.set(false);
+						}
 					}}
 					}}
 				>
 				>
 					<div class=" self-center mr-3">
 					<div class=" self-center mr-3">