feat: enhance sidebar functionality and UI responsiveness

- Implemented sidebar collapse and expand functionality, allowing users to toggle the sidebar visibility for a more streamlined interface.
- Updated the `uiStore` to manage sidebar state, persisting the collapsed state in local storage for user preference.
- Enhanced the `menu.vue` and `UserMenu.vue` components to adapt their layout based on the sidebar state, improving usability.
- Added corresponding translations for sidebar actions in English, Korean, Russian, and Chinese, ensuring accessibility for diverse users.
- Refined CSS styles to support the new sidebar behavior, enhancing overall UI consistency and responsiveness.

These changes significantly improve the user experience by providing a more flexible and user-friendly navigation system.
This commit is contained in:
wizardchen
2026-03-05 13:30:53 +08:00
committed by lyingbug
parent 00bf0460cc
commit 5d90019fd0
11 changed files with 320 additions and 31 deletions
+17 -1
View File
@@ -19,7 +19,8 @@ export const useUIStore = defineStore('ui', {
manualEditorInitialTitle: '',
manualEditorInitialContent: '',
manualEditorInitialStatus: 'draft' as 'draft' | 'publish',
manualEditorOnSuccess: null as null | ((payload: { kbId: string; knowledgeId: string; status: 'draft' | 'publish' }) => void)
manualEditorOnSuccess: null as null | ((payload: { kbId: string; knowledgeId: string; status: 'draft' | 'publish' }) => void),
sidebarCollapsed: localStorage.getItem('sidebar_collapsed') === 'true'
}),
actions: {
@@ -108,6 +109,21 @@ export const useUIStore = defineStore('ui', {
// 设置当前选中的分类ID
setSelectedTagId(tagId: string) {
this.selectedTagId = tagId
},
toggleSidebar() {
this.sidebarCollapsed = !this.sidebarCollapsed
localStorage.setItem('sidebar_collapsed', String(this.sidebarCollapsed))
},
collapseSidebar() {
this.sidebarCollapsed = true
localStorage.setItem('sidebar_collapsed', 'true')
},
expandSidebar() {
this.sidebarCollapsed = false
localStorage.setItem('sidebar_collapsed', 'false')
}
}
})