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(() => [ - +