Skip to content

Commit caab1f9

Browse files
committed
docs: add jsdoc to TableView hooks
1 parent bedf794 commit caab1f9

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/app/tasks/TableView.tsx

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,10 @@ export default function TasksTableView() {
4646
return columns.filter((column) => Array.from(visibleColumns).includes(column.uid));
4747
}, [visibleColumns]);
4848

49+
/**
50+
* Filters tasks based on the provided search filter and the selected task types
51+
* @returns The filtered todos
52+
*/
4953
const filteredItems = useMemo(() => {
5054
let filteredTodos = todos.filter((td) => td.isCompleted === showingCompleted);
5155

@@ -70,6 +74,10 @@ export default function TasksTableView() {
7074
return filteredItems.slice(start, end);
7175
}, [page, filteredItems, rowsPerPage]);
7276

77+
/**
78+
* Sorts items based on the `Number` representation of the selected sort descriptor
79+
* @returns The sorted items
80+
*/
7381
const sortedItems = useMemo(() => {
7482
return [...items].sort((a, b) => {
7583
const key = columns.find((c) => c.uid === sortDescriptor.column)?.uid as keyof Todo;
@@ -81,7 +89,6 @@ export default function TasksTableView() {
8189
return sortDescriptor.direction === "descending" ? -cmp : cmp;
8290
});
8391
}, [sortDescriptor, items]);
84-
8592
const renderCell = (todo: Todo, columnKey: Key) => {
8693
const { id } = todo;
8794
const cellValue = todo[columnKey as keyof Todo];

src/app/tasks/components/DoneButton.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
11
import { setTodoCompletedState } from "@/lib/util";
22
import { Todo } from "@/types";
3-
import { Button, Checkbox } from "@nextui-org/react";
4-
import { toast } from "sonner";
3+
import { Checkbox } from "@nextui-org/react";
54
import { useMutation, useQueryClient } from "@tanstack/react-query";
6-
import { HiCheck } from "react-icons/hi";
5+
import { toast } from "sonner";
76

87
export default function DoneButton({ todo }: { todo: Todo }) {
98
const { id, isCompleted } = todo;

0 commit comments

Comments
 (0)