feat(ui/perf): implement loading states, keyboard navigation, and lazy-loaded tools
Add comprehensive UX and performance improvements: **Loading States & Feedback:** - Add loading overlay with spinner and custom messages - Integrate loading states into all file operations (open, save, export) - Create loading-store.ts for centralized loading state management **Keyboard Navigation:** - Expand keyboard shortcuts to include tool selection (1-7) - Add layer navigation with Arrow Up/Down - Add layer operations (Ctrl+D duplicate, Delete/Backspace remove) - Display keyboard shortcuts in tool tooltips - Enhanced keyboard shortcut system with proper key conflict handling **Performance - Code Splitting:** - Implement dynamic tool loader with lazy loading - Tools load on-demand when first selected - Preload common tools (pencil, brush, eraser) for instant access - Add tool caching to prevent redundant loads - Reduces initial bundle size and improves startup time **Integration:** - Add LoadingOverlay to app layout - Update canvas-with-tools to use lazy-loaded tool instances - Add keyboard shortcut hints to tool palette UI 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
29
components/ui/loading-overlay.tsx
Normal file
29
components/ui/loading-overlay.tsx
Normal file
@@ -0,0 +1,29 @@
|
||||
'use client';
|
||||
|
||||
import { useLoadingStore } from '@/store/loading-store';
|
||||
import { Loader2 } from 'lucide-react';
|
||||
|
||||
export function LoadingOverlay() {
|
||||
const { isLoading, loadingMessage } = useLoadingStore();
|
||||
|
||||
if (!isLoading) return null;
|
||||
|
||||
return (
|
||||
<div
|
||||
className="fixed inset-0 z-[10000] bg-background/80 backdrop-blur-sm flex items-center justify-center animate-fadeIn"
|
||||
role="dialog"
|
||||
aria-busy="true"
|
||||
aria-label="Loading"
|
||||
>
|
||||
<div className="bg-card border border-border rounded-lg p-6 shadow-2xl flex flex-col items-center gap-4 min-w-[300px]">
|
||||
<Loader2 className="h-12 w-12 text-primary animate-spin" aria-hidden="true" />
|
||||
{loadingMessage && (
|
||||
<p className="text-sm font-medium text-foreground text-center">
|
||||
{loadingMessage}
|
||||
</p>
|
||||
)}
|
||||
<p className="text-xs text-muted-foreground">Please wait...</p>
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user