feat(frontend): improve error handling and UX - Sprint 3 Story 4
Add comprehensive error handling with Error Boundary and improve user feedback. Changes: - Created global ErrorBoundary component with fallback UI using react-error-boundary - Integrated ErrorBoundary in root layout to catch all errors - Created Loading component with variants (sm, md, lg) for consistent loading states - Created EmptyState component for better empty data display with CTAs - Improved form error messages in login and register pages (consistent destructive styling) - Updated projects page to use EmptyState component - Added better error handling with retry actions UX improvements: - Better error messages and recovery options with clear action buttons - Consistent loading indicators across all pages - Helpful empty states with clear descriptions and CTAs - Graceful error handling without crashes - Consistent destructive color theme for all error messages Technical: - Installed react-error-boundary package (v5) - All TypeScript types are properly defined - Build and type checking pass successfully 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
37
components/ui/loading.tsx
Normal file
37
components/ui/loading.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
import { Loader2 } from 'lucide-react';
|
||||
import { cn } from '@/lib/utils';
|
||||
|
||||
interface LoadingProps {
|
||||
className?: string;
|
||||
text?: string;
|
||||
size?: 'sm' | 'md' | 'lg';
|
||||
}
|
||||
|
||||
export function Loading({ className, text, size = 'md' }: LoadingProps) {
|
||||
const sizeClasses = {
|
||||
sm: 'h-4 w-4',
|
||||
md: 'h-6 w-6',
|
||||
lg: 'h-8 w-8',
|
||||
};
|
||||
|
||||
return (
|
||||
<div className={cn('flex items-center justify-center', className)}>
|
||||
<Loader2 className={cn(sizeClasses[size], 'animate-spin mr-2')} />
|
||||
{text && <span className="text-muted-foreground">{text}</span>}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Full page loading component
|
||||
export function LoadingPage({ text = 'Loading...' }: { text?: string }) {
|
||||
return (
|
||||
<div className="flex min-h-[400px] items-center justify-center">
|
||||
<Loading text={text} size="lg" />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
||||
// Inline loading for buttons or small areas
|
||||
export function LoadingInline({ text }: { text?: string }) {
|
||||
return <Loading text={text} size="sm" />;
|
||||
}
|
||||
Reference in New Issue
Block a user