feat: add Show Page Emails tab (#2962)
* feat: add Show Page Emails tab Closes #2926, Closes #2927 * feat: review - disable Emails tab if messaging not enabled * refactor: review - add FeatureFlagKey type --------- Co-authored-by: Thais GUIGON <thaisguigon@macbook-pro.home>
This commit is contained in:
@ -1,17 +1,14 @@
|
||||
import { useRecoilValue } from 'recoil';
|
||||
|
||||
import { currentWorkspaceState } from '@/auth/states/currentWorkspaceState';
|
||||
import { FeatureFlagKey } from '@/workspace/types/FeatureFlagKey';
|
||||
|
||||
export const useIsFeatureEnabled = (featureKey: string): boolean => {
|
||||
export const useIsFeatureEnabled = (featureKey: FeatureFlagKey) => {
|
||||
const currentWorkspace = useRecoilValue(currentWorkspaceState);
|
||||
|
||||
const featureFlag = currentWorkspace?.featureFlags?.find(
|
||||
(flag) => flag.key === featureKey,
|
||||
);
|
||||
|
||||
if (!featureFlag) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return featureFlag.value;
|
||||
return !!featureFlag?.value;
|
||||
};
|
||||
|
||||
@ -0,0 +1,4 @@
|
||||
export type FeatureFlagKey =
|
||||
| 'IS_MESSAGING_ENABLED'
|
||||
| 'IS_NOTE_CREATE_IMAGES_ENABLED'
|
||||
| 'IS_RELATION_FIELD_TYPE_ENABLED';
|
||||
Reference in New Issue
Block a user