-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: icon type auto-generation and normalization #696
Conversation
plugins/ui/make_icon_types.py
Outdated
index = words.index(word) | ||
if index < len(words) - 1: | ||
next_word = words[index + 1] | ||
if next_word == "IconDefinition;": |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@bender we should consider changing something in @deephaven/icons
so that we have a separate types file that only includes the icon names. This would help with some .ts scenarios as well so we don't have to exclude the stuff at the end of the file.
...
// end of current icons/dist/index.d.ts
import { IconDefinition, IconLookup, IconName, IconPrefix, IconPack } from '@fortawesome/fontawesome-common-types';
export { IconDefinition, IconLookup, IconName, IconPrefix, IconPack } from '@fortawesome/fontawesome-common-types';
export const prefix: IconPrefix;
export const vs: IconPack;
export const dh: IconPack;
As-is, this is potentially brittle to changes.
You could modify the I also think our d.ts file is slightly wrong. It doesn't look like we export a Another option would be to use Node and do |
Can use the example below to validate snake case and camel case for icon names works. For duplicate icons (ex. vsEye and dhEye) I default to the vsIcon if they enter the icon name with no prefix. So 'Eye' or 'eye' would render 'vsEye' but 'dhEye' or 'dh_eye' still renders 'dhEye'
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just double check with @dsmmcken that we do want to include dh_refresh
and other icons that conflict with the VS counterpart similarly.
"dh_new_circle_large_filled", | ||
"dh_new_square_filled", | ||
"dh_organization_add", | ||
"dh_pandas", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@dsmmcken I want to make sure we get this right...
So we have a dhPandas
icon, and no vsPandas
icon. Do we want the Literal IconTypes
to only contain pandas
and it points to dhPandas
icon? And not have a dh_pandas
? And then for something like refresh where we have vsRefresh
and dhRefresh
, we should just have refresh
=> vsRefresh
and dh_refresh
=> dhRefresh
?
Only concern is if we just have pandas
=> dhPandas
and no dh_pandas
, then if we update VS Code icons and then they add a vsPandas
, then we'd have pandas
=> vsPandas
, and dh_pandas
=> dhPandas
. Meaning we'd be changing that icon. Would that be an issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or should we just always prefix our dh
icons with dh_
and then we can avoid any conflicts altogether?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see arguments for both now that you lay it out that way. I guess I am good with always prefixing dh_ to handle potential future conflicts.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also added this change now but leaving this unresolved so it can be seen during review.
Why use Python and regex to parse the icons instead of just importing all the icons in JS and iterating the actual objects? The output file is written line by line and not using anything specific from Python to create the types. It works, but IMO it makes a lot more sense to use Node and |
Also, why do we list multiple variants of some things in the icon mappings? Specifically we have things like Or only accept the allowed icon names and mark it as breaking that some icon names changed. I think that's fine since this is still pre-release/beta/whatever, but I know others on the team don't share my view. Final note, this should not be a |
@mattrunyon it's Python as in theory this should be part of the Python build process. Still manually generated right now so that's kind of a moot point. We also don't add icons very frequently. @ethanalvizo see @dsmmcken 's comment about dh icons, they should just be |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor cleanup looks good overall
Closes #601
Closes #784
Updated deephaven/ui README with instructions on how to run the script. Wasn't certain if it should run everytime the docker container is built?