All files / react-app/src/features/welcome wrapper.tsx

33.33% Statements 1/3
0% Branches 0/4
0% Functions 0/1
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17            1x                    
import { isCmsUser } from "shared-utils";
 
import { useGetUser } from "@/api";
import * as F from "@/features";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
 
export const WelcomeWrapper = () => {
  const { data: user } = useGetUser();
  const isEnabled = useFeatureFlag("CMS_HOMEPAGE_FLAG");
 
  // Check if the user exists and has a CMS role
  return user && isCmsUser(user.user) && isEnabled ? <F.CMSWelcome /> : <F.Welcome />;
 
  // Uncomment to test the CMSWelcome component:
  // return <F.CMSWelcome />;
};