'use client' import { useState, useCallback } from 'react' import { useTranslations } from 'next-intl' import { Card, CardContent, CardDescription, CardHeader, CardTitle } from '@/components/ui/card' import { Progress } from '@/components/ui/progress' import { Upload, FileText, AlertCircle, HelpCircle } from 'lucide-react' interface SkattekontoFileUploadStepProps { onFileSelect: (file: File) => void isLoading: boolean error: string | null errorTitle?: string | null } const ACCEPTED_EXTENSIONS = ['.csv', '.txt', '.skv'] export default function SkattekontoFileUploadStep({ onFileSelect, isLoading, error, errorTitle, }: SkattekontoFileUploadStepProps) { const t = useTranslations('import') const [isDragging, setIsDragging] = useState(false) const acceptFile = useCallback( (file: File | undefined) => { if (!file) return const name = file.name.toLowerCase() if (ACCEPTED_EXTENSIONS.some((ext) => name.endsWith(ext))) { onFileSelect(file) } }, [onFileSelect], ) const handleDrop = useCallback( (e: React.DragEvent) => { e.preventDefault() setIsDragging(false) acceptFile(e.dataTransfer.files[0]) }, [acceptFile], ) return (
{t('skattekonto_analyzing')}
{t('skattekonto_drop_here')}
{t('skattekonto_tap_select')}
{t('skattekonto_file_types')}
{errorTitle || t('skattekonto_error_title')}
{error}
Skatteverket
{t('skattekonto_howto_steps')}
{t('skattekonto_howto_note')}