From 08fcce65176ae374d6374cf2cc468cceee7a1c00 Mon Sep 17 00:00:00 2001 From: personal82555 Date: Mon, 12 Oct 2026 21:01:58 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=88=91=E7=9A=84=E6=94=B6=E8=97=8F?= =?UTF-8?q?=E5=88=86=E7=BB=84=E7=8B=AC=E7=AB=8B=E4=BF=9D=E7=95=99=20?= =?UTF-8?q?=E2=80=94=20=E6=94=B6=E8=97=8F=E7=9A=84=E5=8F=97=E6=8E=A7?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E4=B8=8D=E5=86=8D=E8=A2=AB=E6=8A=BD=E8=BF=9B?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E5=BA=94=E7=94=A8=E7=BB=84,=20favorites?= =?UTF-8?q?=E7=BD=AE=E9=A1=B6=E5=8E=9F=E6=A0=B7=E6=98=BE=E7=A4=BA,=20?= =?UTF-8?q?=E6=8E=88=E6=9D=83=E7=BB=84=E4=BB=85=E4=BB=8E=E5=8E=9F=E5=A7=8B?= =?UTF-8?q?=E5=88=86=E7=B1=BB=E6=8A=BD=E5=8F=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CollapsibleToolMenu.vue | 9 ++++++--- src/layouts/base.layout.vue | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/components/CollapsibleToolMenu.vue b/src/components/CollapsibleToolMenu.vue index cdef098..1d94b15 100644 --- a/src/components/CollapsibleToolMenu.vue +++ b/src/components/CollapsibleToolMenu.vue @@ -6,7 +6,7 @@ import MenuIconItem from './MenuIconItem.vue'; import type { Tool, ToolCategory } from '@/tools/tools.types'; import { PROTECTED_TOOLS } from '@/tools/license/license'; -const props = withDefaults(defineProps<{ toolsByCategory?: ToolCategory[] }>(), { toolsByCategory: () => [] }); +const props = withDefaults(defineProps<{ toolsByCategory?: ToolCategory[]; favoriteCategory?: ToolCategory | null }>(), { toolsByCategory: () => [], favoriteCategory: null }); const { toolsByCategory } = toRefs(props); const route = useRoute(); @@ -49,8 +49,7 @@ function collapseAll() { const PAID_GROUP_NAME = 'ζŽˆζƒεΊ”η”¨'; const menuOptions = computed(() => { - // pull licensed tools out of their original categories (dedupe by path: - // a paid tool may appear in both the favorites category and its own category) + // pull licensed tools out of their original categories (favorites stay intact) const paidTools: Tool[] = []; const paidPaths = new Set(); const remaining = toolsByCategory.value @@ -80,6 +79,10 @@ const menuOptions = computed(() => { }); const options = []; + // favorites first, shown as-is (user shortcuts must stay visible) + if (props.favoriteCategory && props.favoriteCategory.components.length > 0) { + options.push(toOption(props.favoriteCategory.name, props.favoriteCategory.components)); + } if (paidTools.length > 0) { options.push(toOption(PAID_GROUP_NAME, paidTools)); } diff --git a/src/layouts/base.layout.vue b/src/layouts/base.layout.vue index 07a32ab..8bfde27 100644 --- a/src/layouts/base.layout.vue +++ b/src/layouts/base.layout.vue @@ -31,8 +31,11 @@ const { favoriteTools, toolsByCategory } = storeToRefs(toolStore); const NO_SIDEBAR = new Set(['/user-center', '/admin']); const fullBleed = computed(() => NO_SIDEBAR.has(route.path)); +const favoriteCategory = computed(() => + favoriteTools.value.length > 0 ? { name: t('tools.categories.favorite-tools'), components: favoriteTools.value } : null, +); + const tools = computed(() => [ - ...(favoriteTools.value.length > 0 ? [{ name: t('tools.categories.favorite-tools'), components: favoriteTools.value }] : []), ...toolsByCategory.value, ]); @@ -62,7 +65,7 @@ const tools = computed(() => [ - +