Extract reusable form patterns following Svelte 5 best practices: **New Store Factory** (`project-form.svelte.ts`) - Centralizes form state management with `$state` and `$derived` runes - Provides validation, payload building, and field mutation methods - Type-safe with ProjectFormData interface - Reusable across different contexts **New Helpers** - `useDraftRecovery.svelte.ts`: Generic draft restoration with auto-detection - `useFormGuards.svelte.ts`: Navigation guards, beforeunload warning, Cmd+S shortcut - `DraftPrompt.svelte`: Extracted UI component for draft recovery prompts **Refactored ProjectForm.svelte** - Reduced from 720 lines to 417 lines (42% reduction) - Uses new composable helpers instead of inline logic - Cleaner separation between UI orchestration and business logic - All form state now managed through formStore - Draft recovery, navigation guards fully extracted **Benefits** - Reusable patterns for PostForm, EssayForm, etc. - Easier to test helpers in isolation - Consistent UX across all admin forms - Better maintainability and code organization Closes Task 3 of admin modernization plan (Phase 2) 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com> |
||
|---|---|---|
| .. | ||
| assets | ||
| lib | ||
| routes | ||
| stories | ||
| app.css | ||
| app.d.ts | ||
| app.html | ||
| decs.d.ts | ||
| global.d.ts | ||