From 10b9df668bc77f85e9ffb6f9e66c1b6c7fd3046f Mon Sep 17 00:00:00 2001 From: personal82555 Date: Mon, 12 Oct 2026 00:17:11 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E5=B7=A6=E4=BE=A7=E8=8F=9C=E5=8D=95?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=E3=80=8C=E6=8E=88=E6=9D=83=E5=BA=94=E7=94=A8?= =?UTF-8?q?=E3=80=8D=E5=88=86=E7=BB=84=EF=BC=8C=E6=94=B6=E7=BA=B3=E5=85=A8?= =?UTF-8?q?=E9=83=A8=E5=8F=97=E6=8E=A7=E5=B7=A5=E5=85=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/components/CollapsibleToolMenu.vue | 33 ++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 4 deletions(-) diff --git a/src/components/CollapsibleToolMenu.vue b/src/components/CollapsibleToolMenu.vue index c80592e..5e38d05 100644 --- a/src/components/CollapsibleToolMenu.vue +++ b/src/components/CollapsibleToolMenu.vue @@ -4,6 +4,7 @@ import { useThemeVars } from 'naive-ui'; import { RouterLink, useRoute } from 'vue-router'; 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 { toolsByCategory } = toRefs(props); @@ -45,8 +46,25 @@ function collapseAll() { collapsedCategories.value = m; } -const menuOptions = computed(() => - toolsByCategory.value.map(({ name, components }) => ({ +const PAID_GROUP_NAME = 'ζŽˆζƒεΊ”η”¨'; + +const menuOptions = computed(() => { + // pull licensed tools out of their original categories + const paidTools: Tool[] = []; + const remaining = toolsByCategory.value + .map(({ name, components }) => ({ + name, + components: components.filter((tool) => { + if (tool.path in PROTECTED_TOOLS) { + paidTools.push(tool); + return false; + } + return true; + }), + })) + .filter(({ components }) => components.length > 0); + + const toOption = (name: string, components: Tool[]) => ({ name, isCollapsed: collapsedCategories.value[name], tools: components.map(tool => ({ @@ -54,8 +72,15 @@ const menuOptions = computed(() => icon: makeIcon(tool), key: tool.path, })), - })), -); + }); + + const options = []; + if (paidTools.length > 0) { + options.push(toOption(PAID_GROUP_NAME, paidTools)); + } + options.push(...remaining.map(({ name, components }) => toOption(name, components))); + return options; +}); const themeVars = useThemeVars();