@@ -15,7 +15,7 @@ import cx from "clsx";
1515import { useLocation , useNavigate } from "react-router-dom" ;
1616import classes from "./styles.module.css" ;
1717
18- import { moduleIcons } from "@/constants/tools" ;
18+ import { moduleRegistry , ToolModule } from "@/constants/tools" ;
1919import { useSidebarShortcuts } from "@/hooks/useSidebarShortcuts" ;
2020import { useSidebarState } from "@/hooks/useSidebarState" ;
2121import { DragDropContext , Draggable , Droppable , OnDragEndResponder } from "@hello-pangea/dnd" ;
@@ -162,44 +162,63 @@ export const Sidebar = ({ collapsed, setCollapsed }: Props) => {
162162 item : classes . accordionItem ,
163163 content : classes . accordionContent ,
164164 } }
165- defaultValue = { "Encoders / Decoders " }
165+ defaultValue = { "Network " }
166166 >
167- { sidebarTools
168- . reduce ( ( acc , tool ) => {
169- if ( ! acc . find ( t => t === tool . module ) ) {
170- acc . push ( tool . module ) ;
171- }
172- return acc ;
173- } , [ ] as string [ ] )
174- . filter ( module => module !== "" )
167+ { Object . values ( moduleRegistry )
168+ . sort ( ( a : ToolModule , b : ToolModule ) => a . order - b . order )
169+ . filter ( module => sidebarTools . find ( tool => tool . module === module . id ) )
175170 . map ( module => (
176- < Accordion . Item key = { module } value = { module } >
171+ < Accordion . Item key = { module . id } value = { module . id } >
177172 < Accordion . Control >
178- < Group wrap = "nowrap" style = { { whiteSpace : "nowrap" } } gap = { 8 } >
179- { cloneElement ( moduleIcons [ module ] as ReactElement , {
173+ < Group
174+ wrap = "nowrap"
175+ style = { { whiteSpace : "nowrap" } }
176+ gap = { 8 }
177+ title = { module . description }
178+ >
179+ { cloneElement ( module . icon as ReactElement , {
180180 size : SIDEBAR_CONSTANTS . ICON_SIZE . MEDIUM ,
181181 flex : 1 ,
182182 style : {
183183 minWidth : SIDEBAR_CONSTANTS . ICON_SIZE . MEDIUM ,
184184 marginRight : 1 ,
185185 } ,
186186 } ) }
187- < Text size = "13px" fw = "500" >
188- { module }
189- </ Text >
187+ < Group gap = { 8 } w = "95%" >
188+ < Text size = "12px" fw = "500" >
189+ { module . name }
190+ </ Text >
191+ { showDescription && (
192+ < Text
193+ size = "11px"
194+ c = "dimmed"
195+ w = "80%"
196+ styles = { {
197+ root : {
198+ whiteSpace : "nowrap" ,
199+ overflow : "hidden" ,
200+ textOverflow : "ellipsis" ,
201+ } ,
202+ } }
203+ >
204+ { module . description }
205+ </ Text >
206+ ) }
207+ </ Group >
190208 </ Group >
191209 </ Accordion . Control >
192210 < Accordion . Panel >
193211 < Box >
194212 { sidebarTools
195- . filter ( t => t . module === module )
213+ . filter ( t => t . module === module . id )
196214 . filter ( t => ! hiddenTools . includes ( t . id ) )
197215 . map ( tool => (
198216 < Tool
199217 key = { tool . id }
200218 tool = { tool }
201219 showDescription = { showDescription }
202220 handleNavigation = { handleNavigation }
221+ isModule
203222 />
204223 ) ) }
205224 </ Box >
@@ -227,7 +246,6 @@ export const Sidebar = ({ collapsed, setCollapsed }: Props) => {
227246 ...provided . draggableProps . style ,
228247 userSelect : "none" ,
229248 } }
230- title = { tool . description }
231249 >
232250 < Tool
233251 tool = { tool }
0 commit comments