feat: update DocumentUploadTab to use a dropdown for file and folder selection, enhancing user experience; also update upload limits and file size messages in multiple languages

This commit is contained in:
Anish Sarkar 2026-04-03 12:33:47 +05:30
parent 3833084dad
commit 388811194e
6 changed files with 80 additions and 70 deletions

View file

@ -413,18 +413,24 @@ export function DocumentUploadTab({
}
return (
<Button
variant="secondary"
size="sm"
className={`text-xs ${sizeClass} ${widthClass}`}
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
fileInputRef.current?.click();
}}
>
{t("browse_files")}
</Button>
<DropdownMenu>
<DropdownMenuTrigger asChild onClick={(e) => e.stopPropagation()}>
<Button variant="secondary" size="sm" className={`text-xs gap-1 ${sizeClass} ${widthClass}`}>
Browse
<ChevronDown className="h-3 w-3 opacity-60" />
</Button>
</DropdownMenuTrigger>
<DropdownMenuContent align="center" onClick={(e) => e.stopPropagation()}>
<DropdownMenuItem onClick={() => fileInputRef.current?.click()}>
<FileIcon className="h-4 w-4 mr-2" />
{t("browse_files")}
</DropdownMenuItem>
<DropdownMenuItem onClick={() => folderInputRef.current?.click()}>
<FolderOpen className="h-4 w-4 mr-2" />
{t("browse_folder")}
</DropdownMenuItem>
</DropdownMenuContent>
</DropdownMenu>
);
};
@ -476,7 +482,7 @@ export function DocumentUploadTab({
<Upload className="h-10 w-10 text-muted-foreground" />
<div className="text-center space-y-1.5">
<p className="text-base font-medium">
{isElectron ? "Select files or folder" : "Tap to select files"}
{isElectron ? "Select files or folder" : "Tap to select files or folder"}
</p>
<p className="text-sm text-muted-foreground inline-flex items-center flex-wrap justify-center">
<span>{t("file_size_limit")}</span>
@ -484,40 +490,9 @@ export function DocumentUploadTab({
<span>{t("upload_limits", { maxFiles: MAX_FILES, maxSizeMB: MAX_TOTAL_SIZE_MB })}</span>
</p>
</div>
{isElectron && (
<div className="w-full mt-1" onClick={(e) => e.stopPropagation()}>
{renderBrowseButton({ fullWidth: true })}
</div>
)}
{!isElectron && (
<div className="mt-2 flex gap-2">
<Button
variant="secondary"
size="sm"
className="text-xs"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
fileInputRef.current?.click();
}}
>
{t("browse_files")}
</Button>
<Button
variant="outline"
size="sm"
className="text-xs"
onClick={(e) => {
e.stopPropagation();
e.preventDefault();
folderInputRef.current?.click();
}}
>
<FolderOpen className="h-4 w-4 mr-1.5" />
{t("browse_folder")}
</Button>
</div>
)}
<div className="w-full mt-1" onClick={(e) => e.stopPropagation()}>
{renderBrowseButton({ fullWidth: true })}
</div>
</div>
)}
</div>
@ -570,8 +545,8 @@ export function DocumentUploadTab({
)}
</div>
{/* FOLDER SELECTED */}
{selectedFolder && (
{/* FOLDER SELECTED (Electron only — web flattens folder contents into file list) */}
{isElectron && selectedFolder && (
<div className="rounded-lg border border-border p-3 space-y-2">
<div className="flex items-center gap-2">
<FolderOpen className="h-4 w-4 text-primary shrink-0" />

View file

@ -376,11 +376,11 @@
"upload_documents": {
"title": "Upload Documents",
"subtitle": "Upload your files to make them searchable and accessible through AI-powered conversations.",
"file_size_limit": "Maximum file size: {maxMB}MB per file",
"upload_limits": "Upload files or entire folders",
"file_size_limit": "Maximum file size: 50MB per file",
"upload_limits": "Upload limit: {maxFiles} files, {maxSizeMB}MB total",
"drop_files": "Drop files or folders here",
"drag_drop": "Drag & drop files or folders here",
"or_browse": "or click to browse files and folders",
"or_browse": "or click to browse",
"browse_files": "Browse Files",
"browse_folder": "Browse Folder",
"selected_files": "Selected Files ({count})",
@ -397,7 +397,14 @@
"file_types_desc": "These file types are supported based on your current ETL service configuration.",
"file_too_large": "File Too Large",
"file_too_large_desc": "\"{name}\" exceeds the {maxMB}MB per-file limit.",
"no_supported_files_in_folder": "No supported file types found in the selected folder."
"no_supported_files_in_folder": "No supported file types found in the selected folder.",
"remaining_capacity": "{files} files, {sizeMB}MB remaining",
"file_limit_reached": "File limit reached",
"file_limit_reached_desc": "Maximum of {max} files allowed",
"max_files_exceeded": "Too many files",
"max_files_exceeded_desc": "You can upload a maximum of {max} files at once",
"max_size_exceeded": "Total size exceeded",
"max_size_exceeded_desc": "Total upload size cannot exceed {max}MB"
},
"add_webpage": {
"title": "Add Webpages for Crawling",

View file

@ -376,11 +376,11 @@
"upload_documents": {
"title": "Subir documentos",
"subtitle": "Sube tus archivos para hacerlos buscables y accesibles a través de conversaciones con IA.",
"file_size_limit": "Tamaño máximo de archivo: {maxMB} MB por archivo",
"upload_limits": "Sube archivos o carpetas enteras",
"file_size_limit": "Tamaño máximo de archivo: 50 MB por archivo",
"upload_limits": "Límite de subida: {maxFiles} archivos, {maxSizeMB} MB en total",
"drop_files": "Suelta archivos o carpetas aquí",
"drag_drop": "Arrastra y suelta archivos o carpetas aquí",
"or_browse": "o haz clic para explorar archivos y carpetas",
"or_browse": "o haz clic para explorar",
"browse_files": "Explorar archivos",
"browse_folder": "Explorar carpeta",
"selected_files": "Archivos seleccionados ({count})",
@ -397,7 +397,14 @@
"file_types_desc": "Estos tipos de archivo son soportados según la configuración actual de tu servicio ETL.",
"file_too_large": "Archivo demasiado grande",
"file_too_large_desc": "\"{name}\" excede el límite de {maxMB} MB por archivo.",
"no_supported_files_in_folder": "No se encontraron tipos de archivo compatibles en la carpeta seleccionada."
"no_supported_files_in_folder": "No se encontraron tipos de archivo compatibles en la carpeta seleccionada.",
"remaining_capacity": "{files} archivos, {sizeMB}MB restante",
"file_limit_reached": "Límite de archivos alcanzado",
"file_limit_reached_desc": "Máximo de {max} archivos permitidos",
"max_files_exceeded": "Demasiados archivos",
"max_files_exceeded_desc": "Puedes subir un máximo de {max} archivos a la vez",
"max_size_exceeded": "Tamaño total excedido",
"max_size_exceeded_desc": "El tamaño total de subida no puede exceder {max}MB"
},
"add_webpage": {
"title": "Agregar páginas web para rastreo",

View file

@ -376,11 +376,11 @@
"upload_documents": {
"title": "दस्तावेज़ अपलोड करें",
"subtitle": "AI-संचालित बातचीत के माध्यम से अपनी फ़ाइलों को खोजने योग्य और सुलभ बनाने के लिए अपलोड करें।",
"file_size_limit": "अधिकतम फ़ाइल आकार: प्रति फ़ाइल {maxMB}MB",
"upload_limits": "फ़ाइलें या पूरे फ़ोल्डर अपलोड करें",
"file_size_limit": "अधिकतम फ़ाइल आकार: प्रति फ़ाइल 50MB",
"upload_limits": "अपलोड सीमा: {maxFiles} फ़ाइलें, कुल {maxSizeMB}MB",
"drop_files": "फ़ाइलें या फ़ोल्डर यहां छोड़ें",
"drag_drop": "फ़ाइलें या फ़ोल्डर यहां खींचें और छोड़ें",
"or_browse": "या फ़ाइलें और फ़ोल्डर ब्राउज़ करने के लिए क्लिक करें",
"or_browse": "या ब्राउज़ करने के लिए क्लिक करें",
"browse_files": "फ़ाइलें ब्राउज़ करें",
"browse_folder": "फ़ोल्डर ब्राउज़ करें",
"selected_files": "चयनित फ़ाइलें ({count})",
@ -397,7 +397,14 @@
"file_types_desc": "ये फ़ाइल प्रकार आपकी वर्तमान ETL सेवा कॉन्फ़िगरेशन के आधार पर समर्थित हैं।",
"file_too_large": "फ़ाइल बहुत बड़ी है",
"file_too_large_desc": "\"{name}\" प्रति फ़ाइल {maxMB}MB की सीमा से अधिक है।",
"no_supported_files_in_folder": "चयनित फ़ोल्डर में कोई समर्थित फ़ाइल प्रकार नहीं मिला।"
"no_supported_files_in_folder": "चयनित फ़ोल्डर में कोई समर्थित फ़ाइल प्रकार नहीं मिला।",
"remaining_capacity": "{files} फ़ाइलें, {sizeMB}MB शेष",
"file_limit_reached": "फ़ाइल सीमा पूरी हो गई",
"file_limit_reached_desc": "अधिकतम {max} फ़ाइलें अनुमत हैं",
"max_files_exceeded": "बहुत सारी फ़ाइलें",
"max_files_exceeded_desc": "आप एक बार में अधिकतम {max} फ़ाइलें अपलोड कर सकते हैं",
"max_size_exceeded": "कुल आकार सीमा पार",
"max_size_exceeded_desc": "कुल अपलोड आकार {max}MB से अधिक नहीं हो सकता"
},
"add_webpage": {
"title": "क्रॉलिंग के लिए वेबपेज जोड़ें",

View file

@ -376,11 +376,11 @@
"upload_documents": {
"title": "Enviar documentos",
"subtitle": "Envie seus arquivos para torná-los pesquisáveis e acessíveis através de conversas com IA.",
"file_size_limit": "Tamanho máximo do arquivo: {maxMB} MB por arquivo",
"upload_limits": "Envie arquivos ou pastas inteiras",
"file_size_limit": "Tamanho máximo do arquivo: 50 MB por arquivo",
"upload_limits": "Limite de envio: {maxFiles} arquivos, {maxSizeMB} MB no total",
"drop_files": "Solte arquivos ou pastas aqui",
"drag_drop": "Arraste e solte arquivos ou pastas aqui",
"or_browse": "ou clique para navegar arquivos e pastas",
"or_browse": "ou clique para navegar",
"browse_files": "Navegar arquivos",
"browse_folder": "Navegar pasta",
"selected_files": "Arquivos selecionados ({count})",
@ -397,7 +397,14 @@
"file_types_desc": "Estes tipos de arquivo são suportados com base na configuração atual do seu serviço ETL.",
"file_too_large": "Arquivo muito grande",
"file_too_large_desc": "\"{name}\" excede o limite de {maxMB} MB por arquivo.",
"no_supported_files_in_folder": "Nenhum tipo de arquivo suportado encontrado na pasta selecionada."
"no_supported_files_in_folder": "Nenhum tipo de arquivo suportado encontrado na pasta selecionada.",
"remaining_capacity": "{files} arquivos, {sizeMB}MB restante",
"file_limit_reached": "Limite de arquivos atingido",
"file_limit_reached_desc": "Máximo de {max} arquivos permitidos",
"max_files_exceeded": "Muitos arquivos",
"max_files_exceeded_desc": "Você pode enviar no máximo {max} arquivos de uma vez",
"max_size_exceeded": "Tamanho total excedido",
"max_size_exceeded_desc": "O tamanho total do envio não pode exceder {max}MB"
},
"add_webpage": {
"title": "Adicionar páginas web para rastreamento",

View file

@ -360,11 +360,11 @@
"upload_documents": {
"title": "上传文档",
"subtitle": "上传您的文件,使其可通过 AI 对话进行搜索和访问。",
"file_size_limit": "最大文件大小:每个文件 {maxMB}MB",
"upload_limits": "上传文件或整个文件夹",
"file_size_limit": "最大文件大小:每个文件 50MB",
"upload_limits": "上传限制:最多 {maxFiles} 个文件,总大小不超过 {maxSizeMB}MB",
"drop_files": "将文件或文件夹拖放到此处",
"drag_drop": "将文件或文件夹拖放到此处",
"or_browse": "或点击浏览文件和文件夹",
"drag_drop": "拖放文件或文件夹到这里",
"or_browse": "或点击浏览",
"browse_files": "浏览文件",
"browse_folder": "浏览文件夹",
"selected_files": "已选择的文件 ({count})",
@ -381,7 +381,14 @@
"file_types_desc": "根据您当前的 ETL 服务配置支持这些文件类型。",
"file_too_large": "文件过大",
"file_too_large_desc": "\"{name}\" 超过了每个文件 {maxMB}MB 的限制。",
"no_supported_files_in_folder": "所选文件夹中没有找到支持的文件类型。"
"no_supported_files_in_folder": "所选文件夹中没有找到支持的文件类型。",
"remaining_capacity": "剩余 {files} 个文件,{sizeMB}MB",
"file_limit_reached": "已达文件数量上限",
"file_limit_reached_desc": "最多允许 {max} 个文件",
"max_files_exceeded": "文件数量过多",
"max_files_exceeded_desc": "一次最多上传 {max} 个文件",
"max_size_exceeded": "总大小超出限制",
"max_size_exceeded_desc": "总上传大小不能超过 {max}MB"
},
"add_webpage": {
"title": "添加网页爬取",