Skip to content
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

Added github comment icon workflow #946

Merged

Conversation

jguddas
Copy link
Member

@jguddas jguddas commented Feb 13, 2023

This automatically creates and updates a comment in PRs that shows a preview of all icons that have been changed or updated.

Example

Performance

The action itself is quick due to not running any calculations or even starting up Node.
The API route is cashed and takes less than 200ms to return the rendered svg.

image

Permission problems

This workflow only runs for PRs that are created from inside this repository.

https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

@karsa-mistmere
Copy link
Member

This looks pretty neat, although useful as it is, I think we'll still have to do some validations manually.
I think the white "midlines" will need to be a bit thinner.
What exactly do the colours represent?

@karsa-mistmere karsa-mistmere added the 💡 idea New ideas label Feb 13, 2023
@jguddas
Copy link
Member Author

jguddas commented Feb 13, 2023

The different colors are, so you can easily see when things are not 100% connected, like here in the cat ear for example.

image

@ericfennis
Copy link
Member

@jguddas Nice work, looks really cool!
I think this really helps the review process of icons.
Maybe we can add the 100% scale variant of the icon somewhere as well.

I noticed that the builds are failing for site and the github action. Can you check what is going on?

@karsa-mistmere
Copy link
Member

@jguddas: do you think it could be possible to different shapes for points within a path and endpoints of paths?
I think that could be super useful for finding misaligned paths and checking if paths are incorrectly merged or broken up for no reason.

@jguddas
Copy link
Member Author

jguddas commented Feb 16, 2023

@jguddas: do you think it could be possible to different shapes for points within a path and endpoints of paths?

Great idea.

There are 3 things:

  1. Path elements
  2. Path segments (the things split in d using Move command)
  3. Path commands.

I would like to highlight move commands by adding the big start/end circle.
What do you think?

I don't know how to best highlight the path elements.

  • On the right side, the color is based on the path commands.
  • On the left side, I changed it, so the colors are different for each Path element.

@karsa-mistmere
Copy link
Member

Nice, the one on the right seems much more legible to me apart from colours that are a bit too close in hue.
A few more questions:

  • Why is the top control point from the head's circle missing? Is it a bug or is it on purpose?
  • Is it maybe possible to differentiate closed and non-closed paths? (again, for the head's circle it is not important which point is the starting point, since it's closed)

@jguddas
Copy link
Member Author

jguddas commented Feb 16, 2023

@ericfennis I don't have access to the build, but I can tell you why the action is failing.

The action fails due to being run from a fork, I will see if I can find a quick fix.

@jguddas
Copy link
Member Author

jguddas commented Feb 16, 2023

Why is the top control point from the head's circle missing? Is it a bug or is it on purpose?

It's due to being a circle element instead of a path, what do you think of only showing control points for path elements?

Is it maybe possible to differentiate closed and non-closed paths?

Good idea, I think it would definitely be nice to only show the start/end node for open paths.

@jguddas
Copy link
Member Author

jguddas commented Feb 16, 2023

site/src/pages/api/gh-icon/[data].ts Outdated Show resolved Hide resolved
.github/workflows/pull-request.yml Outdated Show resolved Hide resolved
@jguddas
Copy link
Member Author

jguddas commented Feb 16, 2023

I moved the whole thing into a react component 🎉
image

@jguddas
Copy link
Member Author

jguddas commented Mar 4, 2023

That should be everything.

@jguddas jguddas force-pushed the feat/added-github-comment-icon-workflow branch from 485923d to 99a4b82 Compare March 5, 2023 10:59
Copy link
Member

@ericfennis ericfennis left a comment

Choose a reason for hiding this comment

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

@jguddas Nice this looks event better!
Nice work. Good to go for me

@karsa-mistmere
Copy link
Member

@jguddas: Really nice, I love the latest changes (dark mode support + extra 1px outline to check for gaps). :)

@karsa-mistmere
Copy link
Member

karsa-mistmere commented Mar 20, 2023

@jguddas: I think this is almost good to go, but I still strongly believe CSS classes should be used to style the paths, since there are a looooot of repeating attribute values, and dark mode support should be handled not by using a <picture> tag and generating separate preview files for light and dark mode, but via CSS prefers-color-scheme media queries using the very same CSS classes.
(It could also be a good idea to insert HTML comments before each section, stating the purpose of that group of paths (grid, centerlines, outlines, points, arcs etc.).

@jguddas
Copy link
Member Author

jguddas commented Mar 20, 2023

It would be nice to not have to use the picture tag, but I'm not sure how I would go about cleanly integrating style tags.

What about getting rid of the duplications by using groups like this?

- <p d="…" strokeWidth={5} />
- <p d="…" strokeWidth={5} />
+ <g id="grid" strokeWidth={5} >
+   <p d="…" />
+   <p d="…" />
+ </g>

@karsa-mistmere
Copy link
Member

karsa-mistmere commented Mar 21, 2023

Yeah, grouping is also a good idea, although I'd probably still go for BEM style CSS classes instead of using the id attribute, should the SVGs ever need to be embedded in an HTML page (some debug page on the app review site maybe?) where the global IDs would no longer be unique.

@karsa-mistmere
Copy link
Member

karsa-mistmere commented Mar 27, 2023

@jguddas: I've posted a PR for this branch that solves dark mode support via CSS only, eliminating the need for building separate icons for light and dark modes: jguddas#1

@karsa-mistmere
Copy link
Member

@jguddas: any chance of also adding a curvature preview in v2.0? 😅🤪

image
as in https://www.figma.com/community/plugin/932729267119671976/Curvature

@jguddas
Copy link
Member Author

jguddas commented Apr 2, 2023

An edit page that makes it easy for people to contribute by showing them errors and a preview of their icon would be super nice IMO.

@jguddas
Copy link
Member Author

jguddas commented Apr 3, 2023

Okay @karsa-mistmere, @ericfennis lets merge this!

@ericfennis ericfennis merged commit 93cfd3d into lucide-icons:main Apr 3, 2023
11 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💡 idea New ideas
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants