mirror of
https://github.com/luckfox-eng29/kvm.git
synced 2026-05-11 09:48:23 +02:00
* Upgrade ESLINT and fix issues * feat: add frontend linting job to GitHub Actions workflow * Move UI linting to separate file * More linting fixes * Remove pull_request trigger from UI linting workflow * Update UI linting workflow * Rename frontend-lint workflow to ui-lint for clarity
17 lines
466 B
TypeScript
17 lines
466 B
TypeScript
import { useContext } from "react";
|
|
|
|
import { FeatureFlagContext } from "@/providers/FeatureFlagContext";
|
|
|
|
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 };
|
|
};
|