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

100% Statements 2/2
50% Branches 3/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                      98x             27x                                                                        
import { LucidePencil } from "lucide-react";
 
import { useFeatureFlag } from "@/hooks/useFeatureFlag";
export type UserInformationProps = {
  fullName: string;
  role: string;
  email: string;
  groupDivision?: string;
  allowEdits?: boolean;
};
 
export const UserInformation = ({
  fullName,
  role,
  email,
  groupDivision,
  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>{role}</p>
        </div>
      )}
 
      <div className="leading-9">
        <h3 className="font-bold">Email</h3>
        <p>{email}</p>
      </div>
 
      {isNewUserRoleDisplay && groupDivision && (
        <div className="leading-9">
          <h3 className="font-bold flex items-center cursor-pointer">
            Group & Division {allowEdits && <LucidePencil className="ml-1 w-5" />}
          </h3>
          <p>{groupDivision}</p>
        </div>
      )}
    </div>
  );
};