Skip to content

Commit c024fcd

Browse files
authored
Merge pull request #329 from TTORANG/ai-findings-autofix/src-components-common-FileDropzone.tsx
refactor: 불필요한 변수 및 타입 체크 제거
2 parents eb7d447 + f0b8dec commit c024fcd

1 file changed

Lines changed: 2 additions & 6 deletions

File tree

src/components/common/FileDropzone.tsx

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ export default function FileDropzone({
3636
const dragCounter = useRef(0);
3737
const [isDragging, setIsDragging] = useState(false);
3838
const isUploading = currentStep === 'uploading' || currentStep === 'finishing';
39-
const isDisabled = disabled;
40-
const isBlocked = isDisabled || isUploading; // 업로드 중에는 모든 입력 차단
39+
const isBlocked = disabled || isUploading; // 업로드 중에는 모든 입력 차단
4140

4241
useEffect(() => {
4342
if (error) showToast.warning('업로드에 실패했습니다.', error);
@@ -56,7 +55,6 @@ export default function FileDropzone({
5655
const file = fileList.item(0);
5756
if (!file) return;
5857

59-
if (typeof onFileSelected !== 'function') return;
6058
onFileSelected(file);
6159

6260
if (inputRef.current) inputRef.current.value = ''; // 같은 파일 다시 선택 가능하게 (선택창 value 초기화)
@@ -101,15 +99,13 @@ export default function FileDropzone({
10199
const file = e.dataTransfer.files?.item(0);
102100
if (!file) return;
103101

104-
if (typeof onFileSelected !== 'function') return;
105102
onFileSelected(file);
106103
};
107104

108105
/** 업로드 취소 */
109106
const handleCancelUploading = (e: React.MouseEvent<HTMLButtonElement>) => {
110107
e.preventDefault();
111108
e.stopPropagation();
112-
if (typeof onCancelUpload !== 'function') return;
113109
onCancelUpload();
114110
};
115111

@@ -147,7 +143,7 @@ export default function FileDropzone({
147143
onDrop={handleDrop}
148144
className={clsx(
149145
'group relative w-full overflow-hidden rounded-2xl border bg-white px-8 py-14 shadow-sm transition focus:ring-1 focus:ring-gray-200',
150-
isDisabled && !isUploading && 'cursor-not-allowed opacity-60',
146+
disabled && !isUploading && 'cursor-not-allowed opacity-60',
151147
isUploading && 'cursor-default',
152148
!isBlocked && 'cursor-pointer hover:bg-gray-100',
153149
showDragOverlay ? 'border-gray-900 ring-1 ring-gray-200' : 'border-gray-200',

0 commit comments

Comments
 (0)