From 7b3c1e6bba9c3a34042eaac626e56dbf811055b2 Mon Sep 17 00:00:00 2001 From: Stefan Koelle Date: Sun, 9 Aug 2026 15:06:25 +0200 Subject: [PATCH] ui refactor --- client/build/index.html | 2 +- client/src/App.tsx | 7 +++++++ client/src/components/TaskCard.tsx | 7 ++++++- client/src/vite-env.d.ts | 1 + 4 files changed, 15 insertions(+), 2 deletions(-) create mode 100644 client/src/vite-env.d.ts diff --git a/client/build/index.html b/client/build/index.html index 4e5f270..33851ae 100644 --- a/client/build/index.html +++ b/client/build/index.html @@ -23,7 +23,7 @@ padding: 20px; } - + diff --git a/client/src/App.tsx b/client/src/App.tsx index 7b0e4f9..08d602a 100644 --- a/client/src/App.tsx +++ b/client/src/App.tsx @@ -12,6 +12,13 @@ const App: React.FC = () => { const [loading, setLoading] = useState(true); const [error, setError] = useState(null); + useEffect(() => { + if (error) { + const timer = setTimeout(() => setError(null), 5000); + return () => clearTimeout(timer); + } + }, [error]); + useEffect(() => { loadTasks(); }, []); diff --git a/client/src/components/TaskCard.tsx b/client/src/components/TaskCard.tsx index 8f82f31..c258550 100644 --- a/client/src/components/TaskCard.tsx +++ b/client/src/components/TaskCard.tsx @@ -1,4 +1,4 @@ -import React, { useState } from 'react'; +import React, { useState, useEffect } from 'react'; import { FocusTask } from '../types'; import './TaskCard.css'; @@ -13,6 +13,11 @@ const TaskCard: React.FC = ({ task, onUpdate, onDelete }) => { const [editTitle, setEditTitle] = useState(task.title); const [editDescription, setEditDescription] = useState(task.description || ''); + useEffect(() => { + setEditTitle(task.title); + setEditDescription(task.description || ''); + }, [task.id, task.title, task.description]); + const handleSave = () => { if (editTitle.trim()) { onUpdate(editTitle, editDescription); diff --git a/client/src/vite-env.d.ts b/client/src/vite-env.d.ts new file mode 100644 index 0000000..11f02fe --- /dev/null +++ b/client/src/vite-env.d.ts @@ -0,0 +1 @@ +///