@@ -58,7 +58,11 @@ const TaskList = () => {
5858 new Date ( ) ,
5959 ) ;
6060 const [ taskSuggestions , setTaskSuggestions ] = useState <
61- { title : string ; category_id : string | null } [ ]
61+ {
62+ title : string ;
63+ category_id : string | null ;
64+ estimated_minute : number | null ;
65+ } [ ]
6266 > ( [ ] ) ;
6367 const [ showSuggestions , setShowSuggestions ] = useState ( false ) ;
6468 const [ selectedSuggestionIndex , setSelectedSuggestionIndex ] = useState ( - 1 ) ;
@@ -81,7 +85,7 @@ const TaskList = () => {
8185
8286 const { data, error } = await supabase
8387 . from ( "tasks" )
84- . select ( "title, category_id" )
88+ . select ( "title, category_id, estimated_minute " )
8589 . eq ( "user_id" , user . id )
8690 . ilike ( "title" , `%${ query } %` )
8791 . neq ( "title" , query )
@@ -95,12 +99,20 @@ const TaskList = () => {
9599
96100 const uniqueSuggestions =
97101 data ?. reduce (
98- ( acc : { title : string ; category_id : string | null } [ ] , task ) => {
102+ (
103+ acc : {
104+ title : string ;
105+ category_id : string | null ;
106+ estimated_minute : number | null ;
107+ } [ ] ,
108+ task ,
109+ ) => {
99110 const existing = acc . find ( ( item ) => item . title === task . title ) ;
100111 if ( ! existing ) {
101112 acc . push ( {
102113 title : task . title as string ,
103114 category_id : task . category_id as string | null ,
115+ estimated_minute : task . estimated_minute as number | null ,
104116 } ) ;
105117 }
106118 return acc ;
@@ -356,6 +368,7 @@ const TaskList = () => {
356368 const selectSuggestion = async ( suggestion : {
357369 title : string ;
358370 category_id : string | null ;
371+ estimated_minute : number | null ;
359372 } ) => {
360373 setShowSuggestions ( false ) ;
361374 setSelectedSuggestionIndex ( - 1 ) ;
@@ -369,7 +382,7 @@ const TaskList = () => {
369382 title : suggestion . title ,
370383 description : "" ,
371384 user_id : user . id ,
372- estimated_minute : null ,
385+ estimated_minute : suggestion . estimated_minute ,
373386 category_id : suggestion . category_id ,
374387 task_date : convertDateStringToDate (
375388 selectedDate
0 commit comments