Skip to content

Commit

Permalink
fix: prof image 404 fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
Gemini2035 committed Jul 27, 2024
1 parent e86aeb1 commit ca1994e
Showing 1 changed file with 2 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button, Divider, H4, H5 } from '@blueprintjs/core'
import { Popover2 } from '@blueprintjs/popover2'

import clsx from 'clsx'
import { FC, ImgHTMLAttributes, useEffect, useMemo, useState } from 'react'
import { FC, ImgHTMLAttributes, useEffect, useMemo } from 'react'

import { PROFESSIONS } from 'models/operator'

Expand Down Expand Up @@ -138,24 +138,21 @@ const ProfIcon: FC<ProfIconProp> = ({
onProfClick,
...restImgProps
}) => {
const [imgError, setImgError] = useState(false)

return (
<li
className="grow cursor-pointer relative flex justify-center items-center"
title={name}
role="presentation"
onClick={onProfClick}
>
{imgError ? (
{(Object.values(DEFAULTPROFID) as string[]).includes(profId) ? (
<H5 className="!text-xs sm:!text-base truncate">{name}</H5>
) : (
<img
{...restImgProps}
className="invert dark:invert-0"
src={'/assets/prof-icons/' + profId + '.png'}
alt=""
onError={() => setImgError(true)}
title={name}
/>
)}
Expand Down

0 comments on commit ca1994e

Please sign in to comment.