-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
62 additions
and
33 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,39 @@ | ||
import { Metadata } from "next"; | ||
"use client"; | ||
|
||
export const metadata: Metadata = { | ||
title: "Tasks | All Tasks", | ||
}; | ||
import { useQuery } from "@tanstack/react-query"; | ||
import { getAllTasks } from "@/actions/task"; | ||
import Link from "next/link"; | ||
import { Checkbox } from "@/components/ui/checkbox"; | ||
import Task from "@/components/task"; | ||
|
||
export default function TasksPage() { | ||
return <div className="w-full">All Tasks</div>; | ||
const query = useQuery({ | ||
queryKey: ["tasks"], | ||
queryFn: async () => await getAllTasks(), | ||
}); | ||
|
||
return ( | ||
<div className="flex h-full w-full flex-col gap-4 p-2"> | ||
<h4 className="overflow-hidden break-words text-lg font-medium tracking-tight text-blue-700"> | ||
All Tasks | ||
</h4> | ||
{query.isLoading ? ( | ||
<>Loading ...</> | ||
) : query.isError ? ( | ||
<>{query.error}</> | ||
) : query.data && query.data.length > 0 ? ( | ||
<div className="flex flex-col bg-white"> | ||
{query.data.map(task => { | ||
return ( | ||
<Link href={`/list/${task.listId}`}> | ||
<Task task={task} viewOnly /> | ||
</Link> | ||
); | ||
})} | ||
</div> | ||
) : ( | ||
<>No tasks found</> | ||
)} | ||
</div> | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
import { z } from "zod"; | ||
|
||
export const taskSchema = z.object({ | ||
title: z.string().min(2), | ||
title: z.string().min(2).max(50), | ||
}); |