's'
This commit is contained in:
137
config/debug-features.ts
Normal file
137
config/debug-features.ts
Normal file
@@ -0,0 +1,137 @@
|
||||
/**
|
||||
* 开发调试:可切换的隐藏功能注册表
|
||||
* 默认值与 nav.config / home.config 中的 hidden 开关保持一致
|
||||
*/
|
||||
import { HOME_MEDIA_PRESS_ENABLED, HOME_RIGHT_FEATURE_CARDS_ENABLED } from "./home.config";
|
||||
import type { NavLink } from "./nav.config";
|
||||
|
||||
export interface DebugFeature {
|
||||
id: string;
|
||||
label: string;
|
||||
description: string;
|
||||
category: string;
|
||||
defaultVisible: boolean;
|
||||
navLabelKey?: NavLink["labelKey"];
|
||||
}
|
||||
|
||||
export const DEBUG_FEATURES: DebugFeature[] = [
|
||||
{
|
||||
id: "nav.cities",
|
||||
label: "城市",
|
||||
description: "顶部导航 🏙️ → /",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "cities",
|
||||
},
|
||||
{
|
||||
id: "nav.guide",
|
||||
label: "游民指南",
|
||||
description: "顶部导航 🧭 → /digital",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "guide",
|
||||
},
|
||||
{
|
||||
id: "nav.dashboard",
|
||||
label: "下一站",
|
||||
description: "顶部导航 📍 → /dashboard",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "dashboard",
|
||||
},
|
||||
{
|
||||
id: "nav.travel",
|
||||
label: "聚会",
|
||||
description: "顶部导航 ✈️ → /meetups",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "travel",
|
||||
},
|
||||
{
|
||||
id: "nav.community",
|
||||
label: "社区",
|
||||
description: "顶部导航 💬 → /dating",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "community",
|
||||
},
|
||||
{
|
||||
id: "nav.tools",
|
||||
label: "工具箱",
|
||||
description: "顶部导航 📊 → /tools",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "tools",
|
||||
},
|
||||
{
|
||||
id: "nav.ai",
|
||||
label: "AI",
|
||||
description: "顶部导航 🤖 → /ai",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "ai",
|
||||
},
|
||||
{
|
||||
id: "nav.gigs",
|
||||
label: "赏金",
|
||||
description: "顶部导航 💰 → /gigs",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "gigs",
|
||||
},
|
||||
{
|
||||
id: "nav.pricing",
|
||||
label: "会员",
|
||||
description: "顶部导航 👑 → /pricing",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "pricing",
|
||||
},
|
||||
{
|
||||
id: "nav.explore",
|
||||
label: "探索",
|
||||
description: "顶部导航 🎒 → /#community",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
navLabelKey: "explore",
|
||||
},
|
||||
{
|
||||
id: "nav.menu",
|
||||
label: "更多",
|
||||
description: "顶部导航网格按钮 · 点击头像亦可打开",
|
||||
category: "顶部导航",
|
||||
defaultVisible: false,
|
||||
},
|
||||
{
|
||||
id: "home.rightFeatureCards",
|
||||
label: "电子书 & 访谈视频",
|
||||
description: "首页右侧网格顶部的两张内容卡片",
|
||||
category: "首页",
|
||||
defaultVisible: HOME_RIGHT_FEATURE_CARDS_ENABLED,
|
||||
},
|
||||
{
|
||||
id: "home.mediaPress",
|
||||
label: "媒体报道",
|
||||
description: "首页 Hero 区底部的媒体名称列表",
|
||||
category: "首页",
|
||||
defaultVisible: HOME_MEDIA_PRESS_ENABLED,
|
||||
},
|
||||
];
|
||||
|
||||
export function getDebugFeatureById(id: string): DebugFeature | undefined {
|
||||
return DEBUG_FEATURES.find((feature) => feature.id === id);
|
||||
}
|
||||
|
||||
export function getDebugFeatureDefaultVisible(id: string): boolean {
|
||||
return getDebugFeatureById(id)?.defaultVisible ?? false;
|
||||
}
|
||||
|
||||
export function getNavLabelDebugFeatureId(
|
||||
labelKey: NavLink["labelKey"]
|
||||
): string | undefined {
|
||||
return DEBUG_FEATURES.find((feature) => feature.navLabelKey === labelKey)?.id;
|
||||
}
|
||||
|
||||
export function getDebugFeatureCategories(): string[] {
|
||||
return [...new Set(DEBUG_FEATURES.map((feature) => feature.category))];
|
||||
}
|
||||
Reference in New Issue
Block a user