Skip to content

Latest commit

 

History

History
147 lines (103 loc) · 4.03 KB

File metadata and controls

147 lines (103 loc) · 4.03 KB

Pull Request Summary

Design: Empty, Error, and Loading States

Overview

This PR implements comprehensive UI state patterns for the Credence Frontend application, including empty states, error states, and loading skeletons for all core views.

What's Included

🎨 Components (3 new)

  • EmptyState.tsx - Configurable empty state component with 5 illustration variants
  • ErrorState.tsx - Error state component with 4 error types (network, backend, validation, generic)
  • LoadingSkeleton.tsx - Loading skeleton with 5 variants (text, card, form, table, dashboard)

📚 Documentation (4 files)

  • UI_STATES_GUIDE.md - Complete guide with design principles, microcopy guidelines, and usage patterns
  • FIGMA_DESIGN_SPECS.md - Visual specifications, color palette, layout measurements, and design tokens
  • IMPLEMENTATION_EXAMPLES.md - Practical code examples, hooks, testing, and accessibility guidelines
  • README.md - Documentation index and quick start guide

🎬 Animations

  • Added shimmer animation to index.css for loading skeletons

Features

Empty States

  • ✅ No bond yet
  • ✅ No trust score yet
  • ✅ No disputes
  • ✅ No attestations
  • ✅ No activity

Error States

  • ✅ Network failures
  • ✅ Backend errors
  • ✅ Invalid addresses
  • ✅ Generic errors

Loading Skeletons

  • ✅ Form loading
  • ✅ Card/Dashboard loading
  • ✅ Table loading
  • ✅ Text/Content loading

Design Principles

  1. User-First: Clear language explaining why state is empty/error
  2. Actionable: Provide clear next steps when possible
  3. Consistent: Same patterns across all views
  4. Accessible: ARIA attributes and keyboard navigation
  5. Performant: Smooth animations and transitions

Implementation Pattern

function MyComponent() {
  const { data, isLoading, error } = useQuery()

  if (isLoading) return <LoadingSkeleton variant="card" />
  if (error) return <ErrorState type="network" />
  if (!data) return <EmptyState title="..." description="..." />

  return <Content data={data} />
}

Microcopy Guidelines

  • Tone: Friendly, encouraging, never blaming
  • Length: Titles 3-6 words, descriptions 1-2 sentences
  • CTAs: Action-oriented verbs + outcome

Files Changed

src/components/states/
  ├── EmptyState.tsx (new)
  ├── ErrorState.tsx (new)
  ├── LoadingSkeleton.tsx (new)
  └── index.ts (new)

docs/
  ├── UI_STATES_GUIDE.md (new)
  ├── FIGMA_DESIGN_SPECS.md (new)
  ├── IMPLEMENTATION_EXAMPLES.md (new)
  └── README.md (new)

src/index.css (modified - added shimmer animation)

Next Steps

  1. Design Review: Validate with product team
  2. Figma: Create visual mockups and add link to FIGMA_DESIGN_SPECS.md
  3. Integration: Implement states in actual pages (Home, Bond, TrustScore, Activity)
  4. Testing: Add unit tests for state components
  5. Accessibility: Audit with screen readers

Testing Checklist

  • All empty states render correctly
  • Error states show appropriate messages
  • Loading skeletons match content layout
  • Responsive on mobile, tablet, desktop
  • Keyboard navigation works
  • Screen reader announces states correctly
  • Animations are smooth
  • State transitions work properly

Screenshots

To be added: Screenshots of each state variant

Related Issues

  • Addresses requirement: "Design consistent empty states, error states, and loading skeletons"
  • Tag: ui-ux-design

Review Notes

Please review:

  1. Component API and prop interfaces
  2. Microcopy tone and messaging
  3. Color choices and visual hierarchy
  4. Documentation completeness
  5. Accessibility implementation

Questions for Reviewers

  1. Should we add custom illustrations instead of emojis?
  2. Do the error messages provide enough context?
  3. Are the loading skeleton variants sufficient?
  4. Should we add more animation options?

Branch: design/states-empty-error-loading Commit: docs: add ui/ux specs for empty, error, and loading states Files: 9 files changed, 1942 insertions(+)