From 7c050d1adcda520e4c26d631bea08491ad74f596 Mon Sep 17 00:00:00 2001 From: Copilot <198982749+Copilot@users.noreply.github.com> Date: Tue, 4 Nov 2025 23:59:45 +0800 Subject: [PATCH] feat: add customizable sidebar module ordering (#3307) * Initial plan * Add sidebar customization feature with drag-and-drop support Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * Add dist/ to .gitignore to exclude build artifacts Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * Fix memory leak and improve code quality per code review Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * Fix i18n key format: use dot notation instead of colon notation Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> * Fix drag-and-drop to empty list issue Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: Soulter <37870767+Soulter@users.noreply.github.com> --- dashboard/.gitignore | 3 +- .../components/shared/SidebarCustomizer.vue | 290 ++++++++++++++++++ .../src/i18n/locales/en-US/core/actions.json | 3 +- .../i18n/locales/en-US/features/settings.json | 10 + .../src/i18n/locales/zh-CN/core/actions.json | 3 +- .../i18n/locales/zh-CN/features/settings.json | 10 + .../full/vertical-sidebar/VerticalSidebar.vue | 26 +- dashboard/src/utils/sidebarCustomization.js | 99 ++++++ dashboard/src/views/Settings.vue | 7 + 9 files changed, 447 insertions(+), 4 deletions(-) create mode 100644 dashboard/src/components/shared/SidebarCustomizer.vue create mode 100644 dashboard/src/utils/sidebarCustomization.js diff --git a/dashboard/.gitignore b/dashboard/.gitignore index 12ac64720..6e03962af 100644 --- a/dashboard/.gitignore +++ b/dashboard/.gitignore @@ -1,2 +1,3 @@ node_modules/ -.DS_Store \ No newline at end of file +.DS_Store +dist/ \ No newline at end of file diff --git a/dashboard/src/components/shared/SidebarCustomizer.vue b/dashboard/src/components/shared/SidebarCustomizer.vue new file mode 100644 index 000000000..625320d0d --- /dev/null +++ b/dashboard/src/components/shared/SidebarCustomizer.vue @@ -0,0 +1,290 @@ + + + + {{ t('features.settings.sidebar.customize.title') }} + + + + + + {{ t('features.settings.sidebar.customize.title') }} + + + + + {{ t('features.settings.sidebar.customize.subtitle') }} + + + + {{ t('features.settings.sidebar.customize.mainItems') }} + + + + + + {{ t(item.title) }} + + + + + + + + + {{ t('features.settings.sidebar.customize.moreItems') }} + + + + + + {{ t(item.title) }} + + + + + + + + + + + + {{ t('features.settings.sidebar.customize.reset') }} + + + + {{ t('core.actions.save') }} + + + + + + + + + + diff --git a/dashboard/src/i18n/locales/en-US/core/actions.json b/dashboard/src/i18n/locales/en-US/core/actions.json index 5f4ef91bb..a1ba76e08 100644 --- a/dashboard/src/i18n/locales/en-US/core/actions.json +++ b/dashboard/src/i18n/locales/en-US/core/actions.json @@ -18,5 +18,6 @@ "refresh": "Refresh", "submit": "Submit", "reset": "Reset", - "clear": "Clear" + "clear": "Clear", + "save": "Save" } \ No newline at end of file diff --git a/dashboard/src/i18n/locales/en-US/features/settings.json b/dashboard/src/i18n/locales/en-US/features/settings.json index e8ae3cbf2..0a494ca3e 100644 --- a/dashboard/src/i18n/locales/en-US/features/settings.json +++ b/dashboard/src/i18n/locales/en-US/features/settings.json @@ -19,5 +19,15 @@ "subtitle": "If you encounter data compatibility issues, you can manually start the database migration assistant", "button": "Start Migration Assistant" } + }, + "sidebar": { + "title": "Sidebar", + "customize": { + "title": "Customize Sidebar", + "subtitle": "Drag to reorder modules, or move modules in/out of the \"More Features\" group. Settings are saved locally in your browser.", + "reset": "Reset to Default", + "mainItems": "Main Modules", + "moreItems": "More Features" + } } } \ No newline at end of file diff --git a/dashboard/src/i18n/locales/zh-CN/core/actions.json b/dashboard/src/i18n/locales/zh-CN/core/actions.json index 7829eb276..69b29598b 100644 --- a/dashboard/src/i18n/locales/zh-CN/core/actions.json +++ b/dashboard/src/i18n/locales/zh-CN/core/actions.json @@ -18,5 +18,6 @@ "refresh": "刷新", "submit": "提交", "reset": "重置", - "clear": "清空" + "clear": "清空", + "save": "保存" } \ No newline at end of file diff --git a/dashboard/src/i18n/locales/zh-CN/features/settings.json b/dashboard/src/i18n/locales/zh-CN/features/settings.json index f8ea8520b..bb6700f60 100644 --- a/dashboard/src/i18n/locales/zh-CN/features/settings.json +++ b/dashboard/src/i18n/locales/zh-CN/features/settings.json @@ -19,5 +19,15 @@ "subtitle": "如果您遇到数据兼容性问题,可以手动启动数据库迁移助手", "button": "启动迁移助手" } + }, + "sidebar": { + "title": "侧边栏", + "customize": { + "title": "自定义侧边栏", + "subtitle": "拖拽以调整模块顺序,或者将模块移入/移出\"更多功能\"分组。设置仅保存在浏览器本地。", + "reset": "恢复默认", + "mainItems": "主要模块", + "moreItems": "更多功能" + } } } \ No newline at end of file diff --git a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue index d21321fc3..f752f6c0f 100644 --- a/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue +++ b/dashboard/src/layouts/full/vertical-sidebar/VerticalSidebar.vue @@ -1,15 +1,39 @@
{{ t('features.settings.sidebar.customize.subtitle') }}