fix: lint

This commit is contained in:
crazywoola 2024-10-24 17:09:54 +08:00
parent 91e5882814
commit 181572e330

View File

@ -1,7 +1,5 @@
'use client'
const MAX_FILE_SIZE = 5 * 1024 * 1024; // 5MB
import type { ChangeEvent, FC } from 'react'
import { createRef, useEffect, useState } from 'react'
import type { Area } from 'react-easy-crop'
@ -12,6 +10,8 @@ import { ImagePlus } from '../icons/src/vender/line/images'
import { useDraggableUploader } from './hooks'
import { ALLOW_FILE_EXTENSIONS } from '@/types/app'
const MAX_FILE_SIZE = 5 * 1024 * 1024
type UploaderProps = {
className?: string
onImageCropped?: (tempUrl: string, croppedAreaPixels: Area, fileName: string) => void
@ -40,9 +40,8 @@ const Uploader: FC<UploaderProps> = ({
const handleLocalFileInput = (e: ChangeEvent<HTMLInputElement>) => {
const file = e.target.files?.[0]
if (file && ALLOW_FILE_EXTENSIONS.includes(file.type.split('/').pop()?.toLowerCase() || '') && file.size <= MAX_FILE_SIZE) {
if (file && ALLOW_FILE_EXTENSIONS.includes(file.type.split('/').pop()?.toLowerCase() || '') && file.size <= MAX_FILE_SIZE)
setInputImage({ file, url: URL.createObjectURL(file) })
}
}
const {