@@ -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 ] ;
0 commit comments