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

100% Statements 2/2
83.33% Branches 5/6
100% Functions 1/1
100% Lines 2/2

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 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61                                105x               29x                                                                        
import { UserRole } from "shared-types/events/legacy-user";
import { userRoleMap } from "shared-utils";
 
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
 
import { EditableGroupAndDivision } from "./EditableGroupAndDivision";
 
export type UserInformationProps = {
  fullName: string;
  role: UserRole;
  email: string;
  group?: string;
  division?: string;
  allowEdits?: boolean;
};
 
export const UserInformation = ({
  fullName,
  role,
  email,
  group,
  division,
  allowEdits,
}: UserInformationProps) => {
  const isNewUserRoleDisplay = useFeatureFlag("SHOW_USER_ROLE_UPDATE");
 
  return (
    <div className="flex flex-col gap-6 md:basis-1/2">
      <h2 className="text-2xl font-bold">
        {isNewUserRoleDisplay ? "My Information" : "Profile Information"}
      </h2>
 
      <div className="leading-9">
        <h3 className="font-bold">Full Name</h3>
        <p>{fullName}</p>
      </div>
 
      {!isNewUserRoleDisplay && (
        <div className="leading-9">
          <h3 className="font-bold">Role</h3>
          <p>{userRoleMap[role]}</p>
        </div>
      )}
 
      <div className="leading-9">
        <h3 className="font-bold">Email</h3>
        <p>{email}</p>
      </div>
 
      {role !== "statesubmitter" && role !== "helpdesk" && role !== "statesystemadmin" && (
        <EditableGroupAndDivision
          group={group}
          division={division}
          email={email}
          allowEdits={allowEdits}
        />
      )}
    </div>
  );
};