Chore: treeview icon dialog refactors#378
Conversation
Move treeview and dialog icon refactors into their own branch so the sources bubble branch stays focused on citation UI changes. Made-with: Cursor
There was a problem hiding this comment.
Code Review
This pull request centralizes icon components by moving local SVG definitions into a dedicated icons directory and exporting them. New components like ChevronRightIcon, FileIcon, FolderIcon, GlobeIcon, and XIcon were added and integrated into FeedbackContentDialog, RichTreeView, TreeView, and WorkflowTreeView. Review feedback identifies opportunities to simplify the code by removing redundant JSX fragments and refactoring the Dynamic component usage to pass props directly instead of using anonymous wrapper functions, which is more idiomatic in Solid.js.
| return <FileIcon width="18" height="18" />; | ||
| } | ||
| return <>{context.isExpanded(props.itemId) ? <FolderOpenIcon /> : <FolderIcon />}</>; | ||
| return <>{context.isExpanded(props.itemId) ? <FolderOpenIcon width="18" height="18" /> : <FolderIcon width="18" height="18" />}</>; |
There was a problem hiding this comment.
The fragment <>...</> is redundant here as the ternary operator already returns a single JSX element in both branches. Removing it simplifies the code and adheres better to Solid.js idioms.
| return <>{context.isExpanded(props.itemId) ? <FolderOpenIcon width="18" height="18" /> : <FolderIcon width="18" height="18" />}</>; | |
| return context.isExpanded(props.itemId) ? <FolderOpenIcon width="18" height="18" /> : <FolderIcon width="18" height="18" />; |
| <Dynamic | ||
| component={ | ||
| context.isExpanded(props.itemId) | ||
| ? () => <ChevronDownIcon width="18" height="18" style={{ transition: 'transform 0.2s' }} /> | ||
| : () => <ChevronRightIcon width="18" height="18" style={{ transition: 'transform 0.2s' }} /> | ||
| } | ||
| /> |
There was a problem hiding this comment.
Instead of creating anonymous wrapper components inside the component prop of Dynamic, you can pass the component directly and provide the props to Dynamic. This is more idiomatic in Solid.js and avoids unnecessary component re-definitions on every state change.
<Dynamic
component={context.isExpanded(props.itemId) ? ChevronDownIcon : ChevronRightIcon}
width="18"
height="18"
style={{ transition: 'transform 0.2s' }}
/>
| <Dynamic | ||
| component={ | ||
| context.isExpanded(props.itemId) | ||
| ? () => <ChevronDownIcon width="20" height="20" class="transition-transform duration-200" /> | ||
| : () => <ChevronRightIcon width="20" height="20" class="transition-transform duration-200" /> | ||
| } | ||
| /> |
There was a problem hiding this comment.
Instead of creating anonymous wrapper components inside the component prop of Dynamic, you can pass the component directly and provide the props to Dynamic. This is more idiomatic in Solid.js and avoids unnecessary component re-definitions on every state change.
| <Dynamic | |
| component={ | |
| context.isExpanded(props.itemId) | |
| ? () => <ChevronDownIcon width="20" height="20" class="transition-transform duration-200" /> | |
| : () => <ChevronRightIcon width="20" height="20" class="transition-transform duration-200" /> | |
| } | |
| /> | |
| <Dynamic | |
| component={context.isExpanded(props.itemId) ? ChevronDownIcon : ChevronRightIcon} | |
| width="20" | |
| height="20" | |
| class="transition-transform duration-200" | |
| /> |
Move treeview and dialog icon refactors into their own branch so the sources bubble branch stays focused on citation UI changes.