import { useRef, type ChangeEvent } from 'react'; interface Props { uploading: boolean; disabled?: boolean; onUploadPress?: () => void; onFileSelected: (file: File) => void | Promise; } export default function DebugUploadButton({ uploading, disabled = false, onUploadPress, onFileSelected, }: Props) { const inputRef = useRef(null); const inactive = disabled || uploading; const handleChange = async (e: ChangeEvent) => { const input = e.currentTarget; const file = input.files?.[0]; if (!file || inactive) return; try { await onFileSelected(file); } finally { input.value = ''; } }; return ( ); }