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();