From 2e4db9e519900f49cd03c8658baf81d4841a8eee Mon Sep 17 00:00:00 2001 From: unknown Date: Fri, 15 Nov 2024 11:10:56 +0100 Subject: [PATCH] Added Default Image for broken images --- app/(guest)/jobs/components/job-grid-tile.js | 15 +++++++++++---- app/job-seeker/dashboard/components/more-jobs.js | 7 +++++-- .../companies/components/companies-overview.js | 5 +++++ app/recruiter/dashboard/components/jobs-posted.js | 5 +++++ .../dashboard/components/more-jobs-posted.js | 5 +++++ app/recruiter/hire/components/hires-overview.js | 5 +++++ 6 files changed, 36 insertions(+), 6 deletions(-) diff --git a/app/(guest)/jobs/components/job-grid-tile.js b/app/(guest)/jobs/components/job-grid-tile.js index ddd7123..ae3efe5 100644 --- a/app/(guest)/jobs/components/job-grid-tile.js +++ b/app/(guest)/jobs/components/job-grid-tile.js @@ -2,6 +2,7 @@ import Link from 'next/link' import { formatNumber, formatUnitText } from '@/configs/jobs/format' import { useRouter } from 'next/navigation' +import { useState } from 'react' export default function JobGridTile({ item, @@ -14,6 +15,10 @@ export default function JobGridTile({ notruncate, }) { const router = useRouter() + const [imgSrc, setImgSrc] = useState( + item?.hiringOrganization?.logo || + '/images/guest-layout/hero/filled_briefcase.svg', + ) return (
+ setImgSrc( + '/images/guest-layout/hero/filled_briefcase.svg', + ) + } />
{ + e.target.onerror = null + e.target.src = + '/images/guest-layout/hero/filled_briefcase.svg' + }} alt="" className="w-[33px] h-[33px] rounded-full object-cover" /> diff --git a/app/recruiter/companies/components/companies-overview.js b/app/recruiter/companies/components/companies-overview.js index 8bc9ca7..bcee274 100644 --- a/app/recruiter/companies/components/companies-overview.js +++ b/app/recruiter/companies/components/companies-overview.js @@ -144,6 +144,11 @@ export default function CompaniesOverview() { item?.logo || '/images/guest-layout/hero/filled_briefcase.svg' } + onError={e => { + e.target.onerror = null + e.target.src = + '/images/guest-layout/hero/filled_briefcase.svg' + }} alt="" className={`w-[33px] min-w-[33px] min-h-[33px] h-[33px] rounded-full object-cover`} /> diff --git a/app/recruiter/dashboard/components/jobs-posted.js b/app/recruiter/dashboard/components/jobs-posted.js index 50c40ce..15f5828 100644 --- a/app/recruiter/dashboard/components/jobs-posted.js +++ b/app/recruiter/dashboard/components/jobs-posted.js @@ -48,6 +48,11 @@ export default function JobsPosted() { item?.hiringOrganization?.logo || '/images/guest-layout/hero/filled_briefcase.svg' } + onError={e => { + e.target.onerror = null + e.target.src = + '/images/guest-layout/hero/filled_briefcase.svg' + }} alt="" className={`w-8 min-w-8 min-h-8 h-8 rounded-full object-cover`} /> diff --git a/app/recruiter/dashboard/components/more-jobs-posted.js b/app/recruiter/dashboard/components/more-jobs-posted.js index fa8da53..0aa9d10 100644 --- a/app/recruiter/dashboard/components/more-jobs-posted.js +++ b/app/recruiter/dashboard/components/more-jobs-posted.js @@ -29,6 +29,11 @@ export default function MoreJobsPosted({ data }) { item?.hiringOrganization?.logo || '/images/guest-layout/hero/filled_briefcase.svg' } + onError={e => { + e.target.onerror = null + e.target.src = + '/images/guest-layout/hero/filled_briefcase.svg' + }} alt="" className="w-[33px] h-[33px] rounded-full object-cover" /> diff --git a/app/recruiter/hire/components/hires-overview.js b/app/recruiter/hire/components/hires-overview.js index 3ddae29..53d9589 100644 --- a/app/recruiter/hire/components/hires-overview.js +++ b/app/recruiter/hire/components/hires-overview.js @@ -193,6 +193,11 @@ export default function HiresOverview() { ?.logo || '/images/guest-layout/hero/filled_briefcase.svg' } + onError={e => { + e.target.onerror = null + e.target.src = + '/images/guest-layout/hero/filled_briefcase.svg' + }} alt="" className={`w-10 min-w-10 min-h-10 h-10 rounded-full object-cover`} />