fix: fix build errors

This commit is contained in:
jinhojang6 2024-10-01 23:27:03 +09:00
parent 082843a0e8
commit c68dba4414
2 changed files with 10 additions and 10 deletions

View File

@ -18,7 +18,6 @@ const OperatorGrid: React.FC<OperatorGridProps> = ({ data, isLoading }) => {
const observerRef = useRef<IntersectionObserver | null>(null)
const lastElementRef = useRef<HTMLDivElement | null>(null)
// Infinite scroll logic
const handleObserver = useCallback(
(entries: IntersectionObserverEntry[]) => {
const target = entries[0]
@ -67,7 +66,7 @@ const OperatorGrid: React.FC<OperatorGridProps> = ({ data, isLoading }) => {
<img
key={index}
src={operator.image}
data-src={operator.gif}
data-src={operator?.gif}
alt={`Operator ${index + 1}`}
loading="lazy"
className="lazyload"
@ -78,14 +77,14 @@ const OperatorGrid: React.FC<OperatorGridProps> = ({ data, isLoading }) => {
} else {
return (
<Link
href={`/operators/${operator.id}`}
href={`/operators/${operator?.id}`}
key={'explore-operator-' + index}
>
<GridItem>
<img
key={index}
src={operator.image}
data-src={operator.gif}
src={operator?.image}
data-src={operator?.gif}
alt={`Operator ${index + 1}`}
loading="lazy"
className="lazyload"

View File

@ -7,7 +7,8 @@ interface Props {
}
function updateImageUrl(inputUrl: string): string {
const urlParts = inputUrl.split('/')
if (!inputUrl) return ''
const urlParts = inputUrl?.split('/')
if (urlParts.length > 4 && urlParts[4] === '400') {
urlParts[4] = '1024'
@ -37,7 +38,7 @@ const DownloadDropdown = ({ operator }: Props) => {
</ChevronIconWrapper>
</DropdownButton>
<DropdownContent isOpen={isOpen}>
<DropdownItem href={operator.gif} download>
<DropdownItem href={operator?.gif} download>
<Left>
<Icon>
<Image
@ -51,7 +52,7 @@ const DownloadDropdown = ({ operator }: Props) => {
</Left>
<FileType>.gif</FileType>
</DropdownItem>
<DropdownItem href={updateImageUrl(operator.gif)} download>
<DropdownItem href={updateImageUrl(operator?.gif)} download>
<Left>
<Icon>
<Image
@ -65,7 +66,7 @@ const DownloadDropdown = ({ operator }: Props) => {
</Left>
<FileType>.gif</FileType>
</DropdownItem>
<DropdownItem href={operator.image} download>
<DropdownItem href={operator?.image} download>
<Left>
<Icon>
<Image
@ -79,7 +80,7 @@ const DownloadDropdown = ({ operator }: Props) => {
</Left>
<FileType>.jpeg</FileType>
</DropdownItem>
<DropdownItem href={updateImageUrl(operator.image)} download>
<DropdownItem href={updateImageUrl(operator?.image)} download>
<Left>
<Icon>
<Image