@@ -9,17 +9,22 @@ import {
99 removeFavorite ,
1010} from '../../../dashboard/src/api/favouritesApi' ;
1111
12- export const AppsSideNav : React . FC < { categories : TAppCategory [ ] } > = ( { categories } ) => {
12+ export const AppsSideNav : React . FC < { categories : TAppCategory [ ] } > = ( {
13+ categories,
14+ } ) => {
1315 const [ favoriteToolIds , setFavoriteToolIds ] = useState < string [ ] > ( [ ] ) ;
1416 const [ loadingFavorites , setLoadingFavorites ] = useState ( true ) ;
15- const [ updatingToolIds , setUpdatingToolIds ] = useState < Set < string > > ( new Set ( ) ) ;
17+ const [ updatingToolIds , setUpdatingToolIds ] = useState < Set < string > > (
18+ new Set ( )
19+ ) ;
1620
1721 useEffect ( ( ) => {
1822 const fetchFavorites = async ( ) => {
1923 try {
2024 const favs = await getUserFavorites ( ) ;
21- const toolIds = ( favs || [ ] ) . map ( ( fav : { tool_id : string ; version ?: string } ) =>
22- fav . tool_id + ( fav . version || '' )
25+ const toolIds = ( favs || [ ] ) . map (
26+ ( fav : { tool_id : string ; version ?: string } ) =>
27+ fav . tool_id + ( fav . version || '' )
2328 ) ;
2429 setFavoriteToolIds ( toolIds ) ;
2530 } catch ( err ) {
@@ -81,7 +86,9 @@ export const AppsSideNav: React.FC<{ categories: TAppCategory[] }> = ({ categori
8186
8287 category . apps . forEach ( ( app ) => {
8388 const toolId = app . app_id + ( app . version || '' ) ;
84- const linkPath = `${ app . app_id } ${ app . version ? `?appVersion=${ app . version } ` : '' } ` ;
89+ const linkPath = `${ app . app_id } ${
90+ app . version ? `?appVersion=${ app . version } ` : ''
91+ } `;
8592 const linkLabel = app . shortLabel || app . label || app . bundle_label ;
8693 const isFavorite = favoriteToolIds . includes ( toolId ) ;
8794
@@ -135,16 +142,20 @@ export const AppsSideNav: React.FC<{ categories: TAppCategory[] }> = ({ categori
135142 }
136143 } ) ;
137144
138- const bundleItems = Object . entries ( bundles ) . map ( ( [ bundleKey , bundle ] , index ) =>
139- getItem (
140- `${ bundle . label } [${ bundle . apps . length } ]` ,
141- bundleKey ,
142- index ,
143- bundle . apps . sort ( ( a , b ) => a . priority - b . priority )
144- )
145+ const bundleItems = Object . entries ( bundles ) . map (
146+ ( [ bundleKey , bundle ] , index ) =>
147+ getItem (
148+ `${ bundle . label } [${ bundle . apps . length } ]` ,
149+ bundleKey ,
150+ index ,
151+ bundle . apps . sort ( ( a , b ) => a . priority - b . priority )
152+ )
145153 ) ;
146154
147- return [ ...categoryItems . sort ( ( a , b ) => a . priority - b . priority ) , ...bundleItems ] ;
155+ return [
156+ ...categoryItems . sort ( ( a , b ) => a . priority - b . priority ) ,
157+ ...bundleItems ,
158+ ] ;
148159 } ;
149160
150161 const items : MenuItem [ ] = categories
@@ -172,9 +183,12 @@ export const AppsSideNav: React.FC<{ categories: TAppCategory[] }> = ({ categori
172183 ? `${ currentApp . bundle_label } ${ currentApp . bundle_id } `
173184 : '' ;
174185
175- const selectedKey = `${ appId } ${ appVersion || '' } ${ currentApp ?. bundle_id ?? '' } ` ;
186+ const selectedKey = `${ appId } ${ appVersion || '' } ${
187+ currentApp ?. bundle_id ?? ''
188+ } `;
176189
177- if ( loadingFavorites ) return < div style = { { padding : 16 } } > Loading tools...</ div > ;
190+ if ( loadingFavorites )
191+ return < div style = { { padding : 16 } } > Loading tools...</ div > ;
178192
179193 return (
180194 < >
0 commit comments