Skip to content

Chore: treeview icon dialog refactors#378

Draft
chloebyun-wd wants to merge 2 commits intomainfrom
chore/treeview-icon-dialog-refactors
Draft

Chore: treeview icon dialog refactors#378
chloebyun-wd wants to merge 2 commits intomainfrom
chore/treeview-icon-dialog-refactors

Conversation

@chloebyun-wd
Copy link
Copy Markdown
Contributor

Move treeview and dialog icon refactors into their own branch so the sources bubble branch stays focused on citation UI changes.

Move treeview and dialog icon refactors into their own branch so the sources bubble branch stays focused on citation UI changes.

Made-with: Cursor
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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" />}</>;
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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" />;

Comment on lines +220 to +226
<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' }} />
}
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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' }}
            />

Comment on lines +80 to +86
<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" />
}
/>
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested 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"
/>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant