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:
@@ -5,6 +5,7 @@ import { Trash2 } from 'lucide-react'
|
||||
import { deleteList } from '@/lib/actions'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import Modal from './Modal'
|
||||
import { useToast } from './ToastContainer'
|
||||
|
||||
interface DeleteListButtonProps {
|
||||
listId: string
|
||||
@@ -20,6 +21,7 @@ export default function DeleteListButton({
|
||||
redirectAfterDelete = false
|
||||
}: DeleteListButtonProps) {
|
||||
const router = useRouter()
|
||||
const { showToast } = useToast()
|
||||
const [isConfirmOpen, setIsConfirmOpen] = useState(false)
|
||||
const [isDeleting, setIsDeleting] = useState(false)
|
||||
|
||||
@@ -27,6 +29,7 @@ export default function DeleteListButton({
|
||||
setIsDeleting(true)
|
||||
try {
|
||||
await deleteList(listId)
|
||||
showToast('List deleted successfully', 'success')
|
||||
setIsConfirmOpen(false)
|
||||
if (redirectAfterDelete) {
|
||||
router.push('/')
|
||||
@@ -35,7 +38,7 @@ export default function DeleteListButton({
|
||||
}
|
||||
} catch (err) {
|
||||
console.error('Failed to delete list:', err)
|
||||
alert('Failed to delete list. Please try again.')
|
||||
showToast('Failed to delete list', 'error')
|
||||
} finally {
|
||||
setIsDeleting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user