feat(ui): Add feature flag system (#208)

This commit is contained in:
Adam Shiervani
2025-02-28 12:49:55 +01:00
committed by GitHub
parent 543ef2114e
commit 482c64ad02
11 changed files with 329 additions and 207 deletions

View File

@@ -0,0 +1,15 @@
import { useContext } from "react";
import { FeatureFlagContext } from "../providers/FeatureFlagProvider";
export const useFeatureFlag = (minAppVersion: string) => {
const context = useContext(FeatureFlagContext);
if (!context) {
throw new Error("useFeatureFlag must be used within a FeatureFlagProvider");
}
const { isFeatureEnabled, appVersion } = context;
const isEnabled = isFeatureEnabled(minAppVersion);
return { isEnabled, appVersion };
};