Move business logic out of App Router into module packages, add boundary validation scripts, and keep all routes as thin re-exports without changing URLs or API behavior. Co-authored-by: Cursor <cursoragent@cursor.com>
26 lines
675 B
TypeScript
26 lines
675 B
TypeScript
"use client";
|
|
|
|
import { EmptyState } from "@/components/ds";
|
|
import type { CapabilitiesResponse } from "@/modules/sports-center/types";
|
|
|
|
export function SportsCenterFeatureGate({
|
|
feature,
|
|
capabilities,
|
|
children,
|
|
}: {
|
|
feature: string;
|
|
capabilities?: CapabilitiesResponse;
|
|
children: React.ReactNode;
|
|
}) {
|
|
const enabled = capabilities?.features?.[feature];
|
|
if (capabilities && enabled === false) {
|
|
return (
|
|
<EmptyState
|
|
title="قابلیت فعال نیست"
|
|
description={`این بخش (${feature}) در سرویس مرکز ورزشی فعال نشده است.`}
|
|
/>
|
|
);
|
|
}
|
|
return <>{children}</>;
|
|
}
|