Skip to content

Commit ca1994e

Browse files
author
gemini2035
committed
fix: prof image 404 fixed
1 parent e86aeb1 commit ca1994e

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

src/components/editor/operator/sheet/sheetOperator/ProfClassificationWithFilters.tsx

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Button, Divider, H4, H5 } from '@blueprintjs/core'
22
import { Popover2 } from '@blueprintjs/popover2'
33

44
import clsx from 'clsx'
5-
import { FC, ImgHTMLAttributes, useEffect, useMemo, useState } from 'react'
5+
import { FC, ImgHTMLAttributes, useEffect, useMemo } from 'react'
66

77
import { PROFESSIONS } from 'models/operator'
88

@@ -138,24 +138,21 @@ const ProfIcon: FC<ProfIconProp> = ({
138138
onProfClick,
139139
...restImgProps
140140
}) => {
141-
const [imgError, setImgError] = useState(false)
142-
143141
return (
144142
<li
145143
className="grow cursor-pointer relative flex justify-center items-center"
146144
title={name}
147145
role="presentation"
148146
onClick={onProfClick}
149147
>
150-
{imgError ? (
148+
{(Object.values(DEFAULTPROFID) as string[]).includes(profId) ? (
151149
<H5 className="!text-xs sm:!text-base truncate">{name}</H5>
152150
) : (
153151
<img
154152
{...restImgProps}
155153
className="invert dark:invert-0"
156154
src={'/assets/prof-icons/' + profId + '.png'}
157155
alt=""
158-
onError={() => setImgError(true)}
159156
title={name}
160157
/>
161158
)}

0 commit comments

Comments
 (0)