fix: 我的收藏分组独立保留 — 收藏的受控工具不再被抽进授权应用组, favorites置顶原样显示, 授权组仅从原始分类抽取

This commit is contained in:
personal82555 committed 2026-10-12 21:01:58 +08:00
1 parent 214a4486d3
commit 08fcce6517
2 files changed
+11 -5

No files matched your search

+6 -3
View File
@@ -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<string>();
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));
}