From 438d3d5a98a8c789d54498b2a830377b64ba4cf6 Mon Sep 17 00:00:00 2001 From: rajun Date: Tue, 27 Oct 2026 16:29:00 +0530 Subject: [PATCH] refactor: remove FileOrUrlField --- app/components/FileOrUrlField.tsx | 148 ------------------------------ 1 file changed, 148 deletions(-) delete mode 100644 app/components/FileOrUrlField.tsx diff --git a/app/components/FileOrUrlField.tsx b/app/components/FileOrUrlField.tsx deleted file mode 100644 index 613ca29..0000000 --- a/app/components/FileOrUrlField.tsx +++ /dev/null @@ -1,148 +0,0 @@ -import { Upload, Link, X } from 'lucide-react'; -import { Input } from '~/components/ui/input'; -import { Label } from '~/components/ui/label'; - -export type InputMode = 'url' | 'file'; - -export interface FileOrUrlFieldProps { - label: string; - required?: boolean; - mode: InputMode; - onModeChange: (m: InputMode) => void; - accept: string; - file: File | null; - onFileChange: (f: File | null) => void; - inputRef: React.RefObject; - url: string; - onUrlChange: (u: string) => void; - urlPlaceholder: string; - existingFileName?: string; - onClearExistingFile?: () => void; -} - -export function FileOrUrlField({ - label, required, mode, onModeChange, - accept, file, onFileChange, inputRef, - url, onUrlChange, urlPlaceholder, - existingFileName, onClearExistingFile, -}: FileOrUrlFieldProps) { - return ( -
- {/* Label + toggle */} -
- -
- - -
-
- - {mode === 'file' ? ( -
inputRef.current?.click()} - className={`flex cursor-pointer items-center gap-3 rounded-xl border-2 border-dashed px-4 py-4 transition-all duration-200 ${ - file || existingFileName - ? 'border-orange-500/50 bg-[#161616]' - : 'border-neutral-800 hover:border-neutral-700 bg-[#161616]/40 hover:bg-[#161616]/70' - }`} - > - onFileChange(e.target.files?.[0] ?? null)} - /> - {file ? ( - <> -
-
- -
-
- {file.name} - - {(file.size / 1024 / 1024).toFixed(2)} MB - -
-
- - - ) : existingFileName ? ( - <> -
-
- -
-
- {existingFileName} - - Existing File (Keep) - -
-
- - - ) : ( -
- - - Choose a file ({accept}) - -
- )} -
- ) : ( - onUrlChange(e.target.value)} - /> - )} -
- ); -}