refactor(todos): formulaires création et édition migrés vers Modal
This commit is contained in:
@@ -4,6 +4,7 @@ import type { Todo, TodoCreate, TodoFilters } from '../api/todos'
|
||||
import { fetchTodos, createTodo, updateTodo, deleteTodo, postponeTodo } from '../api/todos'
|
||||
import SwipeableRow from '../components/todos/SwipeableRow'
|
||||
import TodoForm from '../components/todos/TodoForm'
|
||||
import Modal from '../components/Modal'
|
||||
|
||||
type EditingTodo = Todo | null
|
||||
|
||||
@@ -151,22 +152,14 @@ export default function TodosPage() {
|
||||
|
||||
{/* Formulaire de création */}
|
||||
{showForm && (
|
||||
<div className="glass" style={{ padding: 16, borderRadius: 10, marginBottom: 16 }}>
|
||||
<div className="hidden lg:block">
|
||||
<Modal title="Nouvelle tâche" onClose={() => setShowForm(false)}>
|
||||
<TodoForm onSubmit={handleCreate} onCancel={() => setShowForm(false)} extended />
|
||||
</div>
|
||||
<div className="block lg:hidden">
|
||||
<TodoForm onSubmit={handleCreate} onCancel={() => setShowForm(false)} />
|
||||
</div>
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{/* Formulaire d'édition */}
|
||||
{editingTodo && (
|
||||
<div className="glass" style={{ padding: 16, borderRadius: 10, marginBottom: 16, borderLeft: '3px solid var(--accent)' }}>
|
||||
<p style={{ color: 'var(--ink-3)', fontSize: 11, fontFamily: 'var(--font-ui)', marginBottom: 8, textTransform: 'uppercase', letterSpacing: 1 }}>
|
||||
Modifier la tâche
|
||||
</p>
|
||||
<Modal title="Modifier la tâche" onClose={() => setEditingTodo(null)}>
|
||||
<TodoForm
|
||||
onSubmit={data => handleUpdate(editingTodo.id, data)}
|
||||
onCancel={() => setEditingTodo(null)}
|
||||
@@ -182,7 +175,7 @@ export default function TodosPage() {
|
||||
tags: editingTodo.tags,
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
</Modal>
|
||||
)}
|
||||
|
||||
{loading && (
|
||||
@@ -377,7 +370,6 @@ export default function TodosPage() {
|
||||
</div>
|
||||
|
||||
{/* FAB mobile (au-dessus de la barre de navigation) */}
|
||||
{!showForm && (
|
||||
<button
|
||||
className="lg:hidden"
|
||||
onClick={() => setShowForm(true)}
|
||||
@@ -401,10 +393,8 @@ export default function TodosPage() {
|
||||
lineHeight: 1,
|
||||
}}
|
||||
>+</button>
|
||||
)}
|
||||
|
||||
{/* Bouton création laptop */}
|
||||
{!showForm && (
|
||||
<button
|
||||
className="hidden lg:flex"
|
||||
onClick={() => setShowForm(true)}
|
||||
@@ -428,7 +418,6 @@ export default function TodosPage() {
|
||||
>
|
||||
+ Nouvelle tâche
|
||||
</button>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user