import React from "react"; import { cn } from "@/lib/utils.ts"; import { useTranslation } from "react-i18next"; import { Download, FileDown, FolderDown, Loader2, CheckCircle, AlertCircle, } from "lucide-react"; interface DragIndicatorProps { isVisible: boolean; isDragging: boolean; isDownloading: boolean; progress: number; fileName?: string; fileCount?: number; error?: string | null; className?: string; } export function DragIndicator({ isVisible, isDragging, isDownloading, progress, fileName, fileCount = 1, error, className, }: DragIndicatorProps) { const { t } = useTranslation(); if (!isVisible) return null; const getIcon = () => { if (error) { return ; } if (isDragging) { return ; } if (isDownloading) { return ; } if (fileCount > 1) { return ; } return ; }; const getStatusText = () => { if (error) { return t("dragIndicator.error", { error }); } if (isDragging) { return t("dragIndicator.dragging", { fileName: fileName || "" }); } if (isDownloading) { return t("dragIndicator.preparing", { fileName: fileName || "" }); } if (fileCount > 1) { return t("dragIndicator.readyMultiple", { count: fileCount }); } return t("dragIndicator.readySingle", { fileName: fileName || "" }); }; return (
{getIcon()}
{fileCount > 1 ? t("dragIndicator.batchDrag") : t("dragIndicator.dragToDesktop")}
{getStatusText()}
{(isDownloading || isDragging) && !error && (
)} {(isDownloading || isDragging) && !error && (
{progress.toFixed(0)}%
)} {isDragging && !error && (
{t("dragIndicator.canDragAnywhere")}
)}
{isDragging && !error && (
)}
); }