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

@@ -4,6 +4,7 @@ import { useState } from 'react'
import { useRouter } from 'next/navigation'
import { deleteItem } from '@/lib/actions'
import { Trash2 } from 'lucide-react'
import { useToast } from './ToastContainer'
interface DeleteItemButtonProps {
itemId: string
@@ -13,6 +14,7 @@ interface DeleteItemButtonProps {
export default function DeleteItemButton({ itemId, listId, variant = 'full' }: DeleteItemButtonProps) {
const router = useRouter()
const { showToast } = useToast()
const [isDeleting, setIsDeleting] = useState(false)
const [showConfirm, setShowConfirm] = useState(false)
@@ -22,6 +24,7 @@ export default function DeleteItemButton({ itemId, listId, variant = 'full' }: D
setIsDeleting(true)
try {
await deleteItem(itemId)
showToast('Task deleted successfully', 'success')
if (listId) {
router.push(`/list/${listId}`)
} else {
@@ -29,6 +32,7 @@ export default function DeleteItemButton({ itemId, listId, variant = 'full' }: D
}
} catch (error) {
console.error('Error deleting item:', error)
showToast('Failed to delete task', 'error')
setIsDeleting(false)
setShowConfirm(false)
}