浏览代码

refac: remember sidebar status

Timothy J. Baek 7 月之前
父节点
当前提交
a860e98ab9
共有 1 个文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/lib/components/layout/Sidebar.svelte

+ 5 - 1
src/lib/components/layout/Sidebar.svelte

@@ -115,7 +115,11 @@
 			}
 			}
 		});
 		});
 
 
-		showSidebar.set(window.innerWidth > BREAKPOINT);
+		showSidebar.set(!$mobile ? localStorage.sidebar === 'true' : false);
+		showSidebar.subscribe((value) => {
+			localStorage.sidebar = value;
+		});
+
 		await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
 		await pinnedChats.set(await getChatListByTagName(localStorage.token, 'pinned'));
 		await enablePagination();
 		await enablePagination();