Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dka36/EmployeePhotoS3 #558

Open
wants to merge 14 commits into
base: master
Choose a base branch
from
18 changes: 6 additions & 12 deletions frontend/src/components/EmployeeCards/EmployeeCards.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,14 @@
}: EmployeeCardProps) => {
const navigate = useNavigate();
const netId = email.split('@')[0];
const fmtPhone = formatPhone(phoneNumber);
const fmtPhone = '';
if (phoneNumber !== undefined) {
const fmtPhone = formatPhone(phoneNumber);

Check warning on line 38 in frontend/src/components/EmployeeCards/EmployeeCards.tsx

View workflow job for this annotation

GitHub Actions / check

'fmtPhone' is assigned a value but never used
} else {
const fmtPhone = '';

Check warning on line 40 in frontend/src/components/EmployeeCards/EmployeeCards.tsx

View workflow job for this annotation

GitHub Actions / check

'fmtPhone' is assigned a value but never used
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this else statement is needed since you set fmtPhone to '' already on line 36

also, nit: try to keep all the logic for formatPhone within the helper function, ie. do the check for if the phone number is undefined within formatPhone itself, so that if the helper is used in the future, you don't have to repeat this logic

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I'll fix it here. I left it in when debugging some error regarding workingContext sending duplicated request.

}

const formatAvail = (availability: {

Check warning on line 43 in frontend/src/components/EmployeeCards/EmployeeCards.tsx

View workflow job for this annotation

GitHub Actions / check

'formatAvail' is assigned a value but never used
[key: string]: { startTime: string; endTime: string };
}) => {
if (!availability) {
Expand All @@ -52,24 +57,13 @@
};

const isAdmin = isDriver !== undefined;
const isBoth = isDriver && isDriver == true;

Check warning on line 60 in frontend/src/components/EmployeeCards/EmployeeCards.tsx

View workflow job for this annotation

GitHub Actions / check

Expected '===' and instead saw '=='
const roles = (): string => {
if (isBoth) return 'Admin • Driver';
if (isAdmin) return 'Admin';
return 'Driver';
};

const userInfo = {
id,
firstName,
lastName,
netId,
type,
phone: fmtPhone,
photoLink,
startDate,
};

const handleClick = () => {
const path =
isAdmin || isBoth ? `/admin/admins/${id}` : `/admin/drivers/${id}`;
Expand Down
Loading
Loading