"use client"; import Link from "next/link"; import type { ReactNode } from "react"; import { useRemoteConfig } from "~/lib/use-remote-config"; import type { NomadroRemoteConfig } from "~/lib/remote-config"; type ModuleKey = keyof NomadroRemoteConfig["modules"]; /** * 远程配置模块闸门:首屏直接渲染内容,不挡用户;仅确认关闭后才换友好占位。 */ export function ModuleGate({ moduleKey, children, }: { moduleKey: ModuleKey; children: ReactNode; }) { const { config, ready } = useRemoteConfig(); const mod = config.modules[moduleKey]; // 未就绪时默认放行(用包内默认可开),避免闪「加载配置」 const enabled = !ready || mod?.enabled !== false; if (!enabled) { return (

暂时无法打开

该内容暂未开放,稍后再来看看吧。

返回首页
); } return <>{children}; }