Embed icons into js module to avoid xhr requests - #794
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR refactors the icon loading system from dynamic XHR requests to embedding icons directly into a JavaScript module. The change eliminates runtime HTTP requests for icons and improves performance.
Key Changes:
- Added a build-time script (
dump-icons.js) that converts SVG files to TypeScript exports - Replaced the callback-based
passIcon/insertIconAPI with direct string exports - Updated icon references from kebab-case to camelCase throughout the codebase
- Added string utility functions (
toCamelCase,uppercaseFirstLetter) to support icon name transformations
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
panel/src/scripts/dump-icons.js |
Build script that reads SVG files and generates TypeScript exports with camelCase naming |
panel/src/ts/utils/strings.ts |
New utility functions for string case conversion |
panel/src/ts/components/icons.ts |
Refactored from XHR-based loading to static exports containing embedded SVG strings |
panel/src/ts/components/views/updates.ts |
Updated to use direct icon imports and innerHTML assignment |
panel/src/ts/components/views/pages.ts |
Updated icon names from kebab-case to camelCase |
panel/src/ts/components/views/dashboard.ts |
Updated icon names from kebab-case to camelCase |
panel/src/ts/components/views/backups.ts |
Updated to use direct icon imports and innerHTML assignment |
panel/src/ts/components/statistics-chart.ts |
Replaced callback-based icon loading with direct icon reference |
panel/src/ts/components/notification.ts |
Updated types and icon usage to support new camelCase icon exports |
panel/src/ts/components/inputs/upload-input.ts |
Updated icon name construction with uppercaseFirstLetter helper |
panel/src/ts/components/inputs/tags-input.ts |
Updated icon types and conversion using toCamelCase |
panel/src/ts/components/inputs/select-input.ts |
Updated icon conversion using toCamelCase |
panel/src/ts/components/inputs/editor/markdown/menu.ts |
Updated button creation to use direct icon references |
panel/src/ts/components/inputs/editor/markdown/linktooltip.ts |
Updated to use direct icon imports |
panel/src/ts/components/inputs/editor/code/menu.ts |
Updated button creation to use direct icon references |
panel/src/ts/components/inputs/editor-input.ts |
Updated to use direct icon import |
panel/src/ts/components/inputs/date-input.ts |
Updated to use direct icon imports and innerHTML assignment |
panel/package.json |
Added dump:icons script for icon generation |
馃挕 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
giuscris
force-pushed
the
feature/js-icons
branch
from
November 22, 2025 23:18
c3df3ba to
98b912c
Compare
giuscris
marked this pull request as ready for review
November 22, 2025 23:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request introduces a new script to automate the generation of TypeScript icon exports from SVG files and adds a corresponding npm script for convenience. The main improvement is making it easier to keep icon exports up to date and consistent across the codebase.
Automation of icon exports:
panel/src/scripts/dump-icons.jsthat scans the SVG icon directory, sanitizes icon names, and generates a TypeScript module exporting each icon as a string. This helps ensure icons are always up to date and reduces manual work.Build process enhancements:
dump:iconstopanel/package.jsonfor running the icon export automation script. This makes it easy to regenerate icon exports as part of the build or development workflow.