Skip to content

Commit

Permalink
feat(dashboard): add ld flag for email, digest, delay
Browse files Browse the repository at this point in the history
  • Loading branch information
ChmaraX committed Dec 3, 2024
1 parent b76624f commit 11f4109
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ import { Badge } from '../primitives/badge';
import { cn } from '@/utils/ui';
import { StepTypeEnum } from '@/utils/enums';
import { STEP_TYPE_TO_COLOR } from '@/utils/color';
import { useFeatureFlag } from '@/hooks/use-feature-flag';
import { FeatureFlagsKeysEnum } from '@novu/shared';

const MenuGroup = ({ children }: { children: ReactNode }) => {
return <div className="flex flex-col">{children}</div>;
Expand Down Expand Up @@ -41,7 +43,7 @@ const MenuItem = ({

return (
<span
onClick={onClick}
onClick={!disabled ? onClick : undefined}
className={cn(
'shadow-xs text-foreground-600 hover:bg-accent flex cursor-pointer items-center gap-2 rounded-lg p-1.5',
{
Expand Down Expand Up @@ -73,6 +75,7 @@ export const AddStepMenu = ({
onMenuItemClick: (stepType: StepTypeEnum) => void;
}) => {
const [isPopoverOpen, setIsPopoverOpen] = useState(false);
const isDelayDigestEmailEnabled = useFeatureFlag(FeatureFlagsKeysEnum.IS_ND_DELAY_DIGEST_EMAIL_ENABLED);

const handleMenuItemClick = (stepType: StepTypeEnum) => {
onMenuItemClick(stepType);
Expand Down Expand Up @@ -123,7 +126,7 @@ export const AddStepMenu = ({
<MenuItem stepType={StepTypeEnum.DIGEST}>Digest</MenuItem>
<MenuItem
stepType={StepTypeEnum.DELAY}
disabled={true}
disabled={!isDelayDigestEmailEnabled}
onClick={() => handleMenuItemClick(StepTypeEnum.DELAY)}
>
Delay
Expand Down
1 change: 1 addition & 0 deletions packages/shared/src/types/feature-flags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,5 @@ export enum FeatureFlagsKeysEnum {
IS_CONTROLS_AUTOCOMPLETE_ENABLED = 'IS_CONTROLS_AUTOCOMPLETE_ENABLED',
IS_USAGE_ALERTS_ENABLED = 'IS_USAGE_ALERTS_ENABLED',
IS_NEW_DASHBOARD_ENABLED = 'IS_NEW_DASHBOARD_ENABLED',
IS_ND_DELAY_DIGEST_EMAIL_ENABLED = 'IS_ND_DELAY_DIGEST_EMAIL_ENABLED',
}

0 comments on commit 11f4109

Please sign in to comment.