feat: Add visual feedback and polish (Task 15)

- Implement toast notification system for success/error messages
- Add loading states with skeleton loaders for async operations
- Create smooth CSS transitions and animations
- Enhance empty states with EmptyState component
- Add loading.tsx files for Next.js loading states
- Integrate toast notifications across all CRUD operations
- Add fade-in and scale-in animations for better UX
- Improve visual feedback for user actions
This commit is contained in:
2025-12-01 21:14:14 +00:00
parent a037117b15
commit e51e88fddd
20 changed files with 432 additions and 33 deletions

View File

@@ -3,6 +3,7 @@
import { useState } from 'react'
import { createList, updateList } from '@/lib/actions'
import { useRouter } from 'next/navigation'
import { useToast } from './ToastContainer'
interface ListFormProps {
list?: {
@@ -27,6 +28,7 @@ const PRESET_COLORS = [
export default function ListForm({ list, onCancel, onSuccess }: ListFormProps) {
const router = useRouter()
const { showToast } = useToast()
const [title, setTitle] = useState(list?.title || '')
const [color, setColor] = useState(list?.color || PRESET_COLORS[0])
const [isSubmitting, setIsSubmitting] = useState(false)
@@ -47,9 +49,11 @@ export default function ListForm({ list, onCancel, onSuccess }: ListFormProps) {
if (list) {
// Update existing list
await updateList(list.id, { title: title.trim(), color })
showToast('List updated successfully', 'success')
} else {
// Create new list
await createList(title.trim(), color)
showToast('List created successfully', 'success')
}
if (onSuccess) {
@@ -59,6 +63,7 @@ export default function ListForm({ list, onCancel, onSuccess }: ListFormProps) {
}
} catch (err) {
setError('Failed to save list. Please try again.')
showToast('Failed to save list', 'error')
console.error(err)
} finally {
setIsSubmitting(false)