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:
@@ -4,6 +4,7 @@ import { useState } from 'react'
|
||||
import { useRouter } from 'next/navigation'
|
||||
import { createItem } from '@/lib/actions'
|
||||
import { Plus } from 'lucide-react'
|
||||
import { useToast } from './ToastContainer'
|
||||
|
||||
interface InlineItemCreateProps {
|
||||
listId: string
|
||||
@@ -11,6 +12,7 @@ interface InlineItemCreateProps {
|
||||
|
||||
export default function InlineItemCreate({ listId }: InlineItemCreateProps) {
|
||||
const router = useRouter()
|
||||
const { showToast } = useToast()
|
||||
const [isCreating, setIsCreating] = useState(false)
|
||||
const [title, setTitle] = useState('')
|
||||
const [isSubmitting, setIsSubmitting] = useState(false)
|
||||
@@ -26,11 +28,13 @@ export default function InlineItemCreate({ listId }: InlineItemCreateProps) {
|
||||
|
||||
try {
|
||||
await createItem(listId, title.trim())
|
||||
showToast('Task added successfully', 'success')
|
||||
setTitle('')
|
||||
setIsCreating(false)
|
||||
router.refresh()
|
||||
} catch (error) {
|
||||
console.error('Error creating item:', error)
|
||||
showToast('Failed to add task', 'error')
|
||||
} finally {
|
||||
setIsSubmitting(false)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user