Skip to content

feat: create loading state components #67

Closed
@nullcoder

Description

@nullcoder

Description

Create consistent loading states for the application, specifically for encryption/decryption operations.

Requirements

  • Skeleton screens for editor during initial load
  • Spinner for encryption/decryption actions
  • Progress feedback for file processing
  • Shimmer effects for content placeholders
  • Loading states for each major operation
  • Accessible loading announcements
  • Must indicate what operation is happening

Acceptance Criteria

  • Editor skeleton shows during page load
  • Encryption spinner shows "Encrypting files..."
  • Decryption spinner shows "Decrypting gist..."
  • File processing shows progress if > 1 second
  • Loading states prevent user interaction
  • Screen readers announce loading states
  • Smooth animations (no jarring transitions)
  • Loading states match design tokens
  • Clear indication when operation completes

Loading State Types

1. Page Load Skeleton

┌─────────────────────────────────────┐
│ ░░░░░░░░░░░░░░ (title skeleton)     │
│                                     │
│ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░    │
│ ░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░    │
│ ░░░░░░░░░░░░░░░░░░░░░              │
│                                     │
│ [░░░░░░░░] [░░░░░░░░]              │
└─────────────────────────────────────┘

2. Encryption/Decryption Spinner

┌─────────────────────────────────────┐
│                                     │
│         ⟳                           │
│    Encrypting files...              │
│                                     │
│    Please wait while we secure      │
│    your content                     │
│                                     │
└─────────────────────────────────────┘

3. File Processing Progress

┌─────────────────────────────────────┐
│   Processing large file...          │
│   ▓▓▓▓▓▓▓▓░░░░░░░░ 45%            │
│   main.js (2.3 MB)                  │
└─────────────────────────────────────┘

Component Structure

interface LoadingStateProps {
  type: 'skeleton' | 'spinner' | 'progress';
  message?: string;
  progress?: number; // 0-100 for progress type
  fullscreen?: boolean;
}

// Usage examples
<LoadingState type="spinner" message="Encrypting files..." />
<LoadingState type="progress" message="Processing" progress={45} />
<LoadingState type="skeleton" />

Technical Implementation

  • Use CSS animations for smooth effects
  • Implement with React Suspense boundaries where applicable
  • Use shadcn/ui Skeleton component as base
  • Create custom spinner with CSS
  • Use framer-motion for complex animations
  • Ensure animations respect prefers-reduced-motion

Accessibility Requirements

  • Use role="status" and aria-live="polite" for announcements
  • Provide clear text descriptions of what's loading
  • Don't rely only on visual indicators
  • Announce when loading completes
  • Keyboard focus management during loading

Performance Considerations

  • Show loading states only for operations > 100ms
  • Use CSS transforms for animations (GPU accelerated)
  • Avoid layout thrashing during transitions
  • Consider using React.lazy for code splitting indicators

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    featureNew feature implementationpriority: mediumNormal priorityuiUser interface and components

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions