import { useState } from 'react' import { X, FolderPlus, AlertCircle } from 'lucide-react' import clsx from 'clsx' interface AddSourceFolderDialogProps { isOpen: boolean onClose: () => void onAdd: (path: string, recursive: boolean) => Promise } export function AddSourceFolderDialog({ isOpen, onClose, onAdd }: AddSourceFolderDialogProps) { const [folderPath, setFolderPath] = useState('') const [recursive, setRecursive] = useState(true) const [isLoading, setIsLoading] = useState(false) const [error, setError] = useState(null) const handleSubmit = async (e: React.FormEvent) => { e.preventDefault() if (!folderPath.trim()) { setError('Please enter a folder path') return } setIsLoading(true) setError(null) try { await onAdd(folderPath.trim(), recursive) setFolderPath('') setRecursive(true) onClose() } catch (err: any) { setError(err.message || 'Failed to add source folder') } finally { setIsLoading(false) } } const handleClose = () => { if (!isLoading) { setFolderPath('') setError(null) onClose() } } if (!isOpen) return null return (
{/* Backdrop */}
{/* Dialog */}
{/* Header */}

Add Source Folder

{/* Form */}
{/* Path Input */}
setFolderPath(e.target.value)} placeholder="/host/Pictures/your-folder" disabled={isLoading} className={clsx( 'w-full rounded border bg-bg px-3 py-2 text-sm text-text placeholder-text-faint', 'focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary', 'disabled:opacity-50', error ? 'border-reject' : 'border-border' )} />

Use container paths. Your Pictures folder is available at:

/host/Pictures/

Example: /host/Pictures/MulitaTest

{/* Recursive Checkbox */}
setRecursive(e.target.checked)} disabled={isLoading} className="h-4 w-4 rounded border-border bg-bg text-primary focus:ring-2 focus:ring-primary focus:ring-offset-0" />
{/* Error Message */} {error && (
{error}
)} {/* Actions */}
) }