diff --git a/src/client/queries/todo.ts b/src/client/queries/todo.ts deleted file mode 100644 index c02a71b..0000000 --- a/src/client/queries/todo.ts +++ /dev/null @@ -1,7 +0,0 @@ -import { useQueryClient } from '@tanstack/react-query' -import { orpc } from '@/client/orpc' - -export const useInvalidateTodos = () => { - const queryClient = useQueryClient() - return () => queryClient.invalidateQueries({ queryKey: orpc.todo.list.key() }) -} diff --git a/src/components/TodoForm.tsx b/src/components/TodoForm.tsx deleted file mode 100644 index 3f92f6b..0000000 --- a/src/components/TodoForm.tsx +++ /dev/null @@ -1,41 +0,0 @@ -import type { SubmitEventHandler } from 'react' -import { useState } from 'react' - -interface TodoFormProps { - onSubmit: (title: string) => void - isPending: boolean -} - -export const TodoForm = ({ onSubmit, isPending }: TodoFormProps) => { - const [title, setTitle] = useState('') - - const handleSubmit: SubmitEventHandler = (e) => { - e.preventDefault() - if (title.trim()) { - onSubmit(title.trim()) - setTitle('') - } - } - - return ( -
-
- setTitle(e.target.value)} - placeholder="添加新任务..." - className="w-full pl-6 pr-32 py-5 bg-white rounded-2xl shadow-[0_8px_30px_rgb(0,0,0,0.04)] border-0 ring-1 ring-slate-100 focus:ring-2 focus:ring-indigo-500/50 outline-none transition-all placeholder:text-slate-400 text-lg text-slate-700" - disabled={isPending} - /> - -
-
- ) -} diff --git a/src/components/TodoItem.tsx b/src/components/TodoItem.tsx deleted file mode 100644 index 1963ff3..0000000 --- a/src/components/TodoItem.tsx +++ /dev/null @@ -1,77 +0,0 @@ -import type { RouterOutputs } from '@/server/api/types' - -type Todo = RouterOutputs['todo']['list'][number] - -interface TodoItemProps { - todo: Todo - onToggle: (id: string, completed: boolean) => void - onDelete: (id: string) => void -} - -export const TodoItem = ({ todo, onToggle, onDelete }: TodoItemProps) => { - return ( -
- - -
-

- {todo.title} -

-
- -
- - {new Date(todo.createdAt).toLocaleDateString('zh-CN')} - - -
-
- ) -}