Allow sidebar use panel collapse/expand instead of conditional rendering

This commit is contained in:
pa
2026-02-26 19:30:33 +09:00
committed by Natsumi
parent 8d80ef43c6
commit 503a7978f5
2 changed files with 28 additions and 19 deletions
-1
View File
@@ -102,7 +102,6 @@ export const useAppearanceSettingsStore = defineStore(
return ![ return ![
'friends-locations', 'friends-locations',
'friend-list', 'friend-list',
'charts',
'charts-instance', 'charts-instance',
'charts-mutual' 'charts-mutual'
].includes(currentRouteName); ].includes(currentRouteName);
+13 -3
View File
@@ -29,7 +29,6 @@
</RouterView> </RouterView>
</ResizablePanel> </ResizablePanel>
<template v-if="isSideBarTabShow">
<ResizableHandle <ResizableHandle
with-handle with-handle
:class="[ :class="[
@@ -37,6 +36,7 @@
'z-20 [&>div]:-translate-x-1/2' 'z-20 [&>div]:-translate-x-1/2'
]"></ResizableHandle> ]"></ResizableHandle>
<ResizablePanel <ResizablePanel
ref="asidePanelRef"
:default-size="asideDefaultSize" :default-size="asideDefaultSize"
:min-size="asideMinSize" :min-size="asideMinSize"
:collapsed-size="0" :collapsed-size="0"
@@ -46,7 +46,6 @@
<Sidebar></Sidebar> <Sidebar></Sidebar>
</ResizablePanel> </ResizablePanel>
</template> </template>
</template>
</ResizablePanelGroup> </ResizablePanelGroup>
</SidebarInset> </SidebarInset>
</SidebarProvider> </SidebarProvider>
@@ -83,7 +82,7 @@
</template> </template>
<script setup> <script setup>
import { computed, onUnmounted, watch } from 'vue'; import { computed, nextTick, onUnmounted, ref, watch } from 'vue';
import { storeToRefs } from 'pinia'; import { storeToRefs } from 'pinia';
import { useRouter } from 'vue-router'; import { useRouter } from 'vue-router';
@@ -172,6 +171,17 @@
isSideBarTabShow isSideBarTabShow
} = useMainLayoutResizable(); } = useMainLayoutResizable();
const asidePanelRef = ref(null);
watch(isSideBarTabShow, async (show) => {
await nextTick();
if (show) {
asidePanelRef.value?.expand();
} else {
asidePanelRef.value?.collapse();
}
});
watch( watch(
() => watchState.isLoggedIn, () => watchState.isLoggedIn,
(isLoggedIn) => { (isLoggedIn) => {