@@ -4,19 +4,20 @@ import TaskCard from './TaskCard';
44import FolderCard from './FolderCard' ;
55import { AnimatePresence } from 'framer-motion' ;
66import Fuse from 'fuse.js' ;
7+ import { type Item } from '../types' ;
78
89const RootView : React . FC = ( ) => {
9- const items = useStore ( ( state ) => state . items ) ;
10- const searchQuery = useStore ( ( state ) => state . searchQuery ) ;
11- const showCompleted = useStore ( ( state ) => state . showCompleted ) ;
10+ const items = useStore ( ( state : any ) => state . items ) ;
11+ const searchQuery = useStore ( ( state : any ) => state . searchQuery ) ;
12+ const showCompleted = useStore ( ( state : any ) => state . showCompleted ) ;
1213
1314 const isSearching = searchQuery . trim ( ) . length > 0 ;
1415
1516 // Normal Root Items (No search)
1617 const rootTasks = useMemo ( ( ) => items
17- . filter ( i => i . type === 'task' && i . parent_id === null )
18- . filter ( i => showCompleted || ! i . is_completed )
19- . sort ( ( a , b ) => {
18+ . filter ( ( i : Item ) => i . type === 'task' && i . parent_id === null )
19+ . filter ( ( i : Item ) => showCompleted || ! i . is_completed )
20+ . sort ( ( a : Item , b : Item ) => {
2021 if ( a . is_completed !== b . is_completed ) {
2122 return a . is_completed ? 1 : - 1 ;
2223 }
@@ -25,16 +26,16 @@ const RootView: React.FC = () => {
2526 [ items , showCompleted ] ) ;
2627
2728 const folders = useMemo ( ( ) => items
28- . filter ( i => i . type === 'folder' )
29- . sort ( ( a , b ) => a . order_index - b . order_index ) ,
29+ . filter ( ( i : Item ) => i . type === 'folder' )
30+ . sort ( ( a : Item , b : Item ) => a . order_index - b . order_index ) ,
3031 [ items ] ) ;
3132
3233 // Global Search Results (Fuzzy)
3334 const { searchTaskResults, searchFolderResults } = useMemo ( ( ) => {
3435 if ( ! isSearching ) return { searchTaskResults : [ ] , searchFolderResults : [ ] } ;
3536
36- const searchableTasks = items . filter ( i => ( i . type === 'task' || i . type === 'subtask' ) && ( showCompleted || ! i . is_completed ) ) ;
37- const searchableFolders = items . filter ( i => i . type === 'folder' ) ;
37+ const searchableTasks = items . filter ( ( i : Item ) => ( i . type === 'task' || i . type === 'subtask' ) && ( showCompleted || ! i . is_completed ) ) ;
38+ const searchableFolders = items . filter ( ( i : Item ) => i . type === 'folder' ) ;
3839
3940 const fuseOptions = {
4041 keys : [ 'title' ] ,
@@ -47,13 +48,13 @@ const RootView: React.FC = () => {
4748 const folderFuse = new Fuse ( searchableFolders , fuseOptions ) ;
4849
4950 return {
50- searchTaskResults : taskFuse . search ( searchQuery ) . map ( r => r . item ) . sort ( ( a , b ) => {
51+ searchTaskResults : taskFuse . search ( searchQuery ) . map ( r => r . item as Item ) . sort ( ( a : Item , b : Item ) => {
5152 if ( a . is_completed !== b . is_completed ) {
5253 return a . is_completed ? 1 : - 1 ;
5354 }
5455 return 0 ; // Maintain fuse relevance within same completion status
5556 } ) ,
56- searchFolderResults : folderFuse . search ( searchQuery ) . map ( r => r . item )
57+ searchFolderResults : folderFuse . search ( searchQuery ) . map ( r => r . item as Item )
5758 } ;
5859 } , [ items , searchQuery , isSearching , showCompleted ] ) ;
5960
@@ -72,7 +73,7 @@ const RootView: React.FC = () => {
7273 < section className = "space-y-3" >
7374 < div className = "space-y-2" >
7475 < AnimatePresence mode = "popLayout" >
75- { searchTaskResults . map ( task => (
76+ { searchTaskResults . map ( ( task : Item ) => (
7677 < TaskCard key = { task . id } item = { task } />
7778 ) ) }
7879 </ AnimatePresence >
@@ -85,7 +86,7 @@ const RootView: React.FC = () => {
8586 < h2 className = "text-[10px] font-bold text-gray-500 uppercase tracking-widest px-1" > Matching Folders</ h2 >
8687 < div className = "grid grid-cols-2 gap-2" >
8788 < AnimatePresence mode = "popLayout" >
88- { searchFolderResults . map ( folder => (
89+ { searchFolderResults . map ( ( folder : Item ) => (
8990 < FolderCard key = { folder . id } item = { folder } />
9091 ) ) }
9192 </ AnimatePresence >
@@ -110,7 +111,7 @@ const RootView: React.FC = () => {
110111 { rootTasks . length > 0 ? (
111112 < div className = "space-y-2 overflow-y-auto custom-scrollbar pr-1" >
112113 < AnimatePresence initial = { false } mode = "popLayout" >
113- { rootTasks . map ( task => (
114+ { rootTasks . map ( ( task : Item ) => (
114115 < TaskCard key = { task . id } item = { task } />
115116 ) ) }
116117 </ AnimatePresence >
@@ -126,7 +127,7 @@ const RootView: React.FC = () => {
126127 { folders . length > 0 ? (
127128 < div className = "grid grid-cols-2 gap-2 items-start pb-4" >
128129 < AnimatePresence initial = { false } mode = "popLayout" >
129- { folders . map ( folder => (
130+ { folders . map ( ( folder : Item ) => (
130131 < FolderCard key = { folder . id } item = { folder } />
131132 ) ) }
132133 </ AnimatePresence >
0 commit comments