All files / react-app/src/components/Profile/RoleStatusCard index.tsx

100% Statements 6/6
100% Branches 4/4
100% Functions 1/1
100% Lines 5/5

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 18 19 20 21 22 23 24 25 26 27 28                              97x 82x 82x   82x   81x            
import { UserRole } from "shared-types/events/legacy-user";
 
import { StateAccess } from "@/api";
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
 
import { RoleStatusCardLegacy } from "./RoleStatusCardLegacy";
import { RoleStatusCardNew } from "./RoleStatusCardNew";
 
export type RoleStatusProps = {
  isNewUserRoleDisplay?: boolean;
  role: UserRole;
  onClick?: () => void;
  access: Omit<StateAccess, "id" | "eventType" | "email" | "doneByName" | "doneByEmail">;
};
 
export const RoleStatusCard = (props: RoleStatusProps) => {
  const { access } = props;
  const isNewUserRoleDisplay = useFeatureFlag("SHOW_USER_ROLE_UPDATE");
 
  if (!access) return null;
 
  if (isNewUserRoleDisplay) {
    return <RoleStatusCardNew {...props} />;
  }
 
  return <RoleStatusCardLegacy {...props} />;
};