From b126f829e46dd4b96b40d34b6f64a9633672b6ba Mon Sep 17 00:00:00 2001 From: Mikael Brevik Date: Mon, 6 May 2024 11:42:00 +0200 Subject: [PATCH] fix: fix issue with crash when missing image (hide employee) --- src/employees/index.tsx | 4 ++++ src/employees/types.ts | 2 +- src/index/index.tsx | 22 ++++++++++++---------- src/jobs/listing/listing.tsx | 9 +++++---- 4 files changed, 22 insertions(+), 15 deletions(-) diff --git a/src/employees/index.tsx b/src/employees/index.tsx index 1d0ef189c..c3c05fcb2 100644 --- a/src/employees/index.tsx +++ b/src/employees/index.tsx @@ -137,6 +137,10 @@ const blurDataUrl = export const EmployeeTile = ({ employee: { name, telephone, email, imageUrl, officeName }, }: PropsWithChildren<{ employee: EmployeeItem }>) => { + if (!imageUrl) { + return null; + } + return (
{
{randomEmployee ? (
-
- {`Bilde -
+ {randomEmployee.imageUrl && ( +
+ {`Bilde +
+ )}

Dette er {randomEmployee.name}. En av oss som jobber her.

diff --git a/src/jobs/listing/listing.tsx b/src/jobs/listing/listing.tsx index 8f92099d3..52698ff8e 100644 --- a/src/jobs/listing/listing.tsx +++ b/src/jobs/listing/listing.tsx @@ -128,6 +128,10 @@ const Listing: NextPage> = export const ContactTile = ({ contact: { name, email, telephone, imageUrl }, }: PropsWithChildren<{ contact: EmployeeItem }>) => { + if (!imageUrl) { + return null; + } + return (
@@ -148,10 +152,7 @@ export const ContactTile = ({ 📬 {email} {telephone && ( - + 📞 {formatTelephone(telephone)} )}