feat(docs): add provider icons to tools sidebar by waleedlatif1 · Pull Request #4807 · simstudioai/sim
Greptile Summary
This PR adds provider brand icons to the docs sidebar Tools section by introducing a getToolIcon helper that resolves an icon component from the existing blockTypeToIconMap based on the /tools/<slug> URL pattern.
- Adds
getToolIcon(url)which strips language prefixes, validates the path is a direct/tools/<slug>page (no sub-pages), and looks up the icon in the auto-generatedblockTypeToIconMap. - Renders the resolved icon at
size-[14px]insideSidebarItemwhen one is found; no icon is rendered for non-tool pages. - Removes
lg:blockfrom the sharedITEM_DESKTOPclass constant so that the flex layout (needed for icon + text alignment) is preserved at large breakpoints for all sidebar items.
Confidence Score: 4/5
Safe to merge — the feature is correctly scoped and the icon lookup is sound; the only side effect is a display-mode change for all sidebar items on desktop, which is visually benign for text-only entries.
The icon resolution logic correctly matches URL slugs to block types (the docs generator writes files as ${blockType}.mdx, preserving underscores, so URLs stay consistent with the map keys). The one intentional side effect — removing lg:block from ITEM_DESKTOP — changes desktop display mode for all sidebar items, not just tool pages, which the PR description implies are unaffected. For text-only items this is likely harmless, but it is an unannounced scope widening worth a second look.
apps/docs/components/docs-layout/sidebar-components.tsx — specifically the ITEM_DESKTOP constant change and its downstream effect on Blocks/Triggers sidebar items at large breakpoints.
Important Files Changed
| Filename | Overview |
|---|---|
| apps/docs/components/docs-layout/sidebar-components.tsx | Adds getToolIcon helper and renders provider icons for /tools/<slug> sidebar entries; removes lg:block from ITEM_DESKTOP (affects all sidebar items, not just tool pages). |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[SidebarItem renders] --> B[getToolIcon called with item.url]
B --> C[stripLangPrefix strips /en, /fr, etc.]
C --> D{path starts with /tools/?}
D -- No --> E[return null no icon rendered]
D -- Yes --> F[extract slug after /tools/]
F --> G{slug empty or contains /?}
G -- Yes --> E
G -- No --> H[blockTypeToIconMap lookup]
H --> I{key found in map?}
I -- No --> E
I -- Yes --> J[return IconComponent]
J --> K[render ToolIcon at size-14px]
E --> L[render item.name only]
K --> L
Reviews (1): Last reviewed commit: "feat(docs): add provider icons to tools ..." | Re-trigger Greptile