@@ -33,6 +33,24 @@ const getIconFromString = (iconString: string | React.ReactNode): React.ReactNod
3333 return iconMap [ iconString ] || iconMap [ 'default' ] || < Clipboard20Regular /> ;
3434} ;
3535
36+ const truncateDescription = ( description : string , maxLength : number = 180 ) : string => {
37+ if ( ! description ) return '' ;
38+
39+ if ( description . length <= maxLength ) {
40+ return description ;
41+ }
42+
43+ // Find the last space before the limit to avoid cutting words
44+ const truncated = description . substring ( 0 , maxLength ) ;
45+ const lastSpaceIndex = truncated . lastIndexOf ( ' ' ) ;
46+
47+ // If there's a space within the last 20 characters, cut there
48+ // Otherwise, cut at the exact limit
49+ const cutPoint = lastSpaceIndex > maxLength - 20 ? lastSpaceIndex : maxLength ;
50+
51+ return description . substring ( 0 , cutPoint ) + '...' ;
52+ } ;
53+
3654const HomeInput : React . FC < HomeInputProps > = ( {
3755 selectedTeam,
3856} ) => {
@@ -152,16 +170,17 @@ const HomeInput: React.FC<HomeInputProps> = ({
152170 return {
153171 id : `team-task-${ index } ` ,
154172 title : task ,
155- description : task ,
173+ description : truncateDescription ( task ) ,
156174 icon : getIconFromString ( "📋" )
157175 } ;
158176 } else {
159177 // Handle StartingTask objects
160178 const startingTask = task as any ; // Type assertion for now
179+ const taskDescription = startingTask . prompt || startingTask . name || 'Task description' ;
161180 return {
162181 id : startingTask . id || `team-task-${ index } ` ,
163182 title : startingTask . name || startingTask . prompt || 'Task' ,
164- description : startingTask . prompt || startingTask . name || 'Task description' ,
183+ description : truncateDescription ( taskDescription ) ,
165184 icon : getIconFromString ( startingTask . logo || "📋" )
166185 } ;
167186 }
0 commit comments