Преглед на файлове

feat: add customLink to navigation hook with filtering logic

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
master
fengsilin преди 3 седмици
родител
ревизия
49c6755622
променени са 1 файла, в които са добавени 10 реда и са изтрити 0 реда
  1. +10
    -0
      web/src/hooks/common/useNavigation.js

+ 10
- 0
web/src/hooks/common/useNavigation.js Целия файл

@@ -47,6 +47,13 @@ export const useNavigation = (t, headerNavModules) => {
itemKey: 'pricing',
to: '/pricing',
},
{
text: modules.customLink?.text || '',
itemKey: 'customLink',
to: modules.customLink?.url || '#',
isExternal: modules.customLink?.url?.startsWith('http'),
externalLink: modules.customLink?.url || '#',
},
];

// 根据配置过滤导航链接
@@ -57,6 +64,9 @@ export const useNavigation = (t, headerNavModules) => {
? modules.pricing.enabled
: modules.pricing;
}
if (link.itemKey === 'customLink') {
return modules.customLink?.enabled === true && modules.customLink?.text;
}
return modules[link.itemKey] === true;
});
}, [t, headerNavModules]);


Зареждане…
Отказ
Запис