aboutsummaryrefslogtreecommitdiffstats
path: root/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
diff options
context:
space:
mode:
Diffstat (limited to 'server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx')
-rw-r--r--server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx8
1 files changed, 8 insertions, 0 deletions
diff --git a/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx b/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
index bc6fdc07173..5a25ac62230 100644
--- a/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
+++ b/server/sonar-web/src/main/js/app/components/available-features/withAvailableFeatures.tsx
@@ -50,3 +50,11 @@ export default function withAvailableFeatures<P>(
}
};
}
+
+export function useAvailableFeatures() {
+ const availableFeatures = React.useContext(AvailableFeaturesContext);
+
+ return {
+ hasFeature: (feature: Feature) => availableFeatures.includes(feature),
+ };
+}