From 8b058fd40a17df255e74a025c0a01fbcc08b636f Mon Sep 17 00:00:00 2001 From: imbytecat Date: Sat, 17 Jan 2026 03:18:56 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E4=BC=98=E5=8C=96=E5=BE=85=E5=8A=9E?= =?UTF-8?q?=E4=BA=8B=E9=A1=B9=E9=A1=B5=E9=9D=A2=E8=A7=86=E8=A7=89=E4=B8=8E?= =?UTF-8?q?=E4=BA=A4=E4=BA=92=E4=BD=93=E9=AA=8C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 优化待办事项页面的视觉样式与交互体验,重构头部信息展示、输入框与按钮布局、进度条样式,并改进任务项的视觉反馈与操作交互,提升整体设计一致性与用户操作流畅性。 --- src/routes/todo.tsx | 281 +++++++++++++++++--------------------------- 1 file changed, 111 insertions(+), 170 deletions(-) diff --git a/src/routes/todo.tsx b/src/routes/todo.tsx index 468661f..ff24520 100644 --- a/src/routes/todo.tsx +++ b/src/routes/todo.tsx @@ -114,71 +114,68 @@ function Todo() { const completedCount = todos.filter((todo) => todo.completed).length const totalCount = todos.length + const progress = totalCount > 0 ? (completedCount / totalCount) * 100 : 0 return ( -
-
+
+
{/* Header */} -
-

- 我的待办事项 -

-

- 已完成 {completedCount} / {totalCount} 项任务 -

+
+
+

+ 我的待办 +

+

保持专注,逐个击破

+
+
+
+ {completedCount} + /{totalCount} +
+
+ 已完成 +
+
{/* Add Todo Form */} -
-
-
- - -
+ +
+ +
- {/* Progress Bar */} -
-
- 完成进度 - - {totalCount > 0 - ? Math.round((completedCount / totalCount) * 100) - : 0} - % - -
-
+ {/* Progress Bar (Only visible when there are tasks) */} + {totalCount > 0 && ( +
0 ? (completedCount / totalCount) * 100 : 0}%`, - }} + className="h-full bg-indigo-500 transition-all duration-500 ease-out rounded-full" + style={{ width: `${progress}%` }} />
-
+ )} {/* Todo List */}
{todos.length === 0 ? ( -
-
+
+
-

暂无待办事项

-

- 添加你的第一个任务开始吧! +

没有待办事项

+

+ 输入上方内容添加您的第一个任务

) : ( todos.map((todo) => (
-
- {/* Checkbox */} + + +
+

+ {todo.title} +

+
+ +
+ + {new Date(todo.createdAt).toLocaleDateString('zh-CN')} + - - {/* Todo Content */} -
-

- {todo.title} -

-
- - - {new Date(todo.createdAt).toLocaleDateString('zh-CN')} - -
-
- - {/* Status Badge and Delete Button */} -
- - {todo.completed ? '已完成' : '进行中'} - - -
)) )}
- - {/* Footer Stats */} - {todos.length > 0 && ( -
-
-

- {totalCount - completedCount} -

-

待完成

-
-
-

- {completedCount} -

-

已完成

-
-
- )}
)