mirror of
https://github.com/prowler-cloud/prowler.git
synced 2026-11-09 04:38:49 +00:00
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
26 lines
732 B
TypeScript
26 lines
732 B
TypeScript
"use client";
|
|
|
|
import { redirect } from "next/navigation";
|
|
import type { ReactNode } from "react";
|
|
|
|
import { FeatureFlagGate } from "@/components/shared/feature-flag-gate";
|
|
import type { FeatureFlag } from "@/lib/feature-flags";
|
|
|
|
const ToOverview = (): never => redirect("/");
|
|
|
|
interface FeatureFlagRouteProps {
|
|
flag: FeatureFlag;
|
|
children: ReactNode;
|
|
}
|
|
|
|
// A route behind a flag: off sends the user to the overview, pending renders
|
|
// nothing. Same client evaluation as the menu entry, so the link and the
|
|
// route never disagree.
|
|
export function FeatureFlagRoute({ flag, children }: FeatureFlagRouteProps) {
|
|
return (
|
|
<FeatureFlagGate flag={flag} fallback={<ToOverview />}>
|
|
{children}
|
|
</FeatureFlagGate>
|
|
);
|
|
}
|