Skip to content

Latest commit

 

History

History
358 lines (299 loc) · 10.8 KB

File metadata and controls

358 lines (299 loc) · 10.8 KB

New Beautiful Upload Interface - Visual Guide

🎨 Component Layout

┌─────────────────────────────────────────────────────────┐
│                                                         │
│  ✅ Success Message (Auto-hides after 3s)              │
│  "Upload Successful! Your documents have been         │
│   processed and indexed successfully."                 │
│                                                         │
└─────────────────────────────────────────────────────────┘

┌─────────────────────────────────────────────────────────┐
│  📤 Upload Documents                                    │
│  Upload your documents to create a knowledge base       │
│                                                         │
│  ┌──────────────────────────────────────────────────┐  │
│  │  Drag and drop your files here                   │  │
│  │  or click to browse                              │  │
│  │                                                  │  │
│  │  [ PDF ]  [ TXT ]  [ MD ]                        │  │
│  │  Max 50MB per file                               │  │
│  └──────────────────────────────────────────────────┘  │
│                                                         │
│  📄 3 files selected                                    │
│  ┌─ report.pdf (2.5 MB) ............... ✅           │
│  ├─ notes.txt (0.3 MB) ................ ✅           │
│  └─ guide.md (1.1 MB) ................ ✅           │
│                                                         │
│  ┌────────────────────────────────┐                     │
│  │ Uploading...           85%      │  Progress bar      │
│  └────────────────────────────────┘                     │
│                                                         │
│  ┌──────────────────────────────────────────────────┐  │
│  │  📤 Upload & Index Documents                     │  │
│  └──────────────────────────────────────────────────┘  │
│                                                         │
│  💡 Tip: You can upload multiple files at once.        │
│     They will be processed together into a             │
│     single knowledge base.                             │
└─────────────────────────────────────────────────────────┘

🎯 Color Scheme

Element Color Use Case
Header Background Blue Gradient (600→700) Branding & emphasis
Header Text White Maximum contrast
Drag Area - Idle Gray (50) with border Neutral state
Drag Area - Active Blue (50) with blue border Active feedback
File List White with gray hover Clean, readable
Success Message Green (50) with green border Positive feedback
Error Message Red (50) with red border Error feedback
Progress Bar Blue Gradient (600→700) Tracking
Button - Normal Blue Gradient (600→700) Call to action
Button - Disabled Gray (400) Disabled state

✨ Animations & Transitions

1. Drag-and-Drop Animation

  • On Drag Over: Box scales up slightly (scale-105) + blue background
  • On Drop: File list appears with smooth slide-in
  • Duration: 200ms

2. File List Animation

  • Files appear with fade-in animation
  • Each file has a checkmark (✅) for validation status
  • Remove button (×) appears on hover

3. Progress Bar Animation

  • Smooth width transition from 0% to 100%
  • Percentage text updates in real-time
  • Duration: 300ms per increment

4. Success Message Animation

  • Fade-in: 300ms
  • Display: 3 seconds
  • Fade-out: 300ms (auto)
  • Can be manually closed

5. Error Message Animation

  • Slide-in from right: 300ms
  • Display: 6 seconds
  • Slide-out to right: 300ms (auto)
  • Pulse icon animation (gentle breathing)

6. Button Animation

  • Hover: Gradient deepens + shadow increases
  • Click: Slight scale-down feedback
  • Loading: Spinner rotation (infinite)

🔔 User Feedback States

Before Upload

[ Empty drag zone ]
"Drag and drop your files here"
"or click to select files"
[ Disabled upload button ]

During Selection

[ Drag zone with focus ]
📄 Selected Files:
  - report.pdf (2.5 MB) ✅
  - notes.txt (0.3 MB) ✅
  - guide.md (1.1 MB) ❌ File too large
[ Enabled upload button ]

During Upload

[ Upload button with spinner ]
"📤 Processing..."
[ Progress bar: 0% → 100% ]

On Success

✅ Upload Successful!
"Your documents have been processed and indexed successfully."
[ Auto-disappears after 3 seconds ]

On Error

❌ Error
"Invalid file type: document.exe. Supported: PDF, TXT, MD"
[ Auto-disappears after 6 seconds ]
[ Manual close button ]

📱 Responsive Design

Desktop (>1024px)

  • Full width upload card (max-w-4xl)
  • 3-column layout for features
  • Side-by-side file list and buttons

Tablet (768px-1024px)

  • 90% width with padding
  • 2-column layout for features
  • Stacked buttons

Mobile (<768px)

  • Full width with gutters
  • Single-column layout
  • Touch-friendly buttons (larger tap area)
  • Scrollable file list

🎪 Icon Library (from lucide-react)

Icon Use Color
Upload Primary action Blue/White
FileText File representation Blue
CheckCircle Success/valid state Green
AlertCircle Error/warning Red
X Close/remove Gray
Loader Loading spinner Blue

💬 Error Messages (Before & After)

Before

❌ Failed to upload documents

After

❌ Error
Invalid file type: document.exe. Supported: PDF, TXT, MD

OR

❌ Error
File report.pdf is too large (max 50MB)

OR

❌ Error
File notes.txt is empty

OR

❌ Error
No response from server. Please check if the backend is 
running on http://127.0.0.1:8000

🚀 Performance Visual Feedback

  1. Lazy Loading

    • Models load on first request
    • Smooth loading animation
  2. Progress Indication

    • 0-90%: Simulated progress for smooth UX
    • 90-100%: Actual server progress
    • Gives users confidence upload is happening
  3. Success Celebration

    • Green success message
    • Confetti-ready (could be added later)
    • Auto-dismisses so not intrusive

🎨 Styling Details

Card Shadow

shadow-lg    /* Elevated appearance */

Border Radius

rounded-xl   /* 12px - modern feel */

Text Hierarchy

Header: text-3xl font-bold           (24px, bold)
Subheader: text-sm text-blue-100    (14px, light blue)
Label: font-semibold                 (600 weight)
Body: text-sm                        (14px regular)
Small text: text-xs text-gray-500    (12px, muted)

Spacing

Header padding: px-6 py-8           (generous)
Content padding: p-8                 (breathing room)
File list: space-y-2                 (2px between items)
Drag area: p-12                      (spacious)

📊 Component Hierarchy

DocumentUpload
├── Success Message (conditional)
│   ├── CheckCircle icon
│   ├── Title
│   └── Description
├── Main Card
│   ├── Header Section
│   │   ├── Upload icon
│   │   ├── Title
│   │   └── Subtitle
│   └── Content Section
│       ├── Drag & Drop Zone
│       ├── Hidden file input
│       ├── File List (conditional)
│       ├── Progress Bar (conditional)
│       ├── Upload Button
│       └── Info Tip
└── Error Alert (global, from store)

🔄 State Management

// DocumentUpload Component State
{
  dragActive: boolean,           // Is dragging over drop zone
  files: File[],                 // Selected files
  uploadProgress: number,        // 0-100
  uploadSuccess: boolean,        // Show success message
  validationErrors: object       // Per-file error messages
}

// App Store (global)
{
  isLoading: boolean,            // Upload in progress
  error: string,                 // Current error message
  indexId: string,               // Session ID after upload
  setLoading: fn,
  setError: fn,
  setIndexId: fn
}

✅ Accessibility Features

  • Semantic HTML (proper form elements)
  • ARIA labels for icons
  • Keyboard navigation support
  • High contrast text (WCAG AA compliant)
  • Focus indicators on buttons
  • Error messages linked to inputs
  • File input keyboard accessible

🎁 Bonus Features Ready to Add

  1. Drag-and-drop folder support
  2. Thumbnail preview for images
  3. File type filtering
  4. Batch operation progress
  5. Upload history
  6. Pause/Resume functionality
  7. Connection status indicator
  8. Upload speed indicator (MB/s)
  9. Estimated time remaining
  10. Document preview after upload

🧪 Testing Scenarios

Scenario 1: Happy Path

1. User drags 3 PDF files
2. Sees file list with checkmarks
3. Clicks "Upload & Index"
4. Progress bar fills
5. Success message appears
6. Auto-disappears after 3s
✅ User can now query the documents

Scenario 2: Invalid File

1. User tries to upload .exe file
2. Sees error: "Invalid file type"
3. File shows ❌ with error message
4. Upload button disabled
5. User removes invalid file
6. Upload button re-enables
✅ Upload succeeds with valid files

Scenario 3: Network Error

1. Backend server offline
2. User clicks upload
3. After 120s timeout, sees error
4. Message: "Cannot reach http://127.0.0.1:8000"
5. User starts backend server
6. Error auto-hides after 6s
7. User can retry upload
✅ Clear guidance on what's wrong

Scenario 4: Large File

1. User tries to upload 100MB file
2. Sees error: "File too large (max 50MB)"
3. File shows ❌ with size info
4. User sees actual file size (95 MB)
5. Can replace with smaller file
✅ Clear feedback on constraints

Enjoy your beautiful new upload interface! 🎉