-
-
Notifications
You must be signed in to change notification settings - Fork 5.6k
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
Implement actions badge svgs #28102
Implement actions badge svgs #28102
Conversation
Very nice, even without dependencies 👍 |
This comment was marked as outdated.
This comment was marked as outdated.
I guess the only difference is that the library probably supports more styling options, but that can be added later.
I assume this counts as "Derivative Works" which is allowed in their Apache 2.0 Licence. I would put a comment and link to original repo like this. Not sure if worth it to include a full copy of the license as well, but if we follow it strictly, we should. |
This comment was marked as outdated.
This comment was marked as outdated.
Some docs on this would be nice, like this. |
routers/web/repo/actions/badge.go
Outdated
gF := float64(defaultOffset) | ||
lW := float64(drawer.MeasureString(label)>>6) + gF | ||
mW := float64(drawer.MeasureString(message)>>6) + gF |
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.
Is it right to do so (guessing font size)?
The SVG uses font-family="Geneva,DejaVu Sans,sans-serif"
, do you really know its width on client side?
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 think there is no way knowing how wide it would render on a client, but as long as these approximations work on common clients, I can accept them.
@lng2020 Are you still working on this PR? |
Sorry. I thought this one was replaced by #28585. But it turns out that one was closed last month.
Would you like to take over or would you like me to finish? I can solve most reviews above except the client-side font problem.
Or this PR can be replaced by a more well-designed badge system, which includes more badges like |
So the problem now is that do we need an internal badge system? ps: tried the service mentioned above, it works, but not all things supported. |
I think as a start, we can serve just the action badges, more can come later if there is demand and I think this PR lays a good base, so let's get it finished. |
I think it is good enough for daily usage. Why end users need so long a label. |
As expected. The function calculates the text length is
So the text width is only about 95% of the whole width. If the text is long, the remaining 5% will become noticeable. |
@lng2020 please fix the merge conflicts. 🍵 |
Co-authored-by: delvh <dev.lh@web.de>
Co-authored-by: delvh <dev.lh@web.de>
* giteaofficial/main: (23 commits) Fix wrong test usage of `AppSubURL` (go-gitea#29459) Improve contrast on blame timestamp, fix double border (go-gitea#29482) Fix/Improve `processWindowErrorEvent` (go-gitea#29407) Apply compact padding to small buttons with svg icons (go-gitea#29471) Fix counter display number incorrectly displayed on the page (go-gitea#29448) Fix incorrect user location link on profile page (go-gitea#29474) Fix workflow trigger event bugs (go-gitea#29467) Fix URL calculation in clone input box (go-gitea#29470) Remove jQuery from the "find file" page (go-gitea#29456) Move generate from module to service (go-gitea#29465) The job should always run when `if` is `always()` (go-gitea#29464) Recolor dark theme to blue shade (go-gitea#29283) Let ctx.FormOptionalBool() return optional.Option[bool] (go-gitea#29461) Implement actions badge svgs (go-gitea#28102) Fix missed return (go-gitea#29450) Use tailwind instead of `gt-[wh]-` helper classes (go-gitea#29423) Lock issues and pulls faster (go-gitea#29436) Allow to change primary email before account activation (go-gitea#29412) Update docs about `DEFAULT_ACTIONS_URL` (go-gitea#29442) Only use supported sort order for "explore/users" page (go-gitea#29430) ...
replace #27187
close #23688
The badge has two parts: label(workflow name) and message(action status). 5 colors are provided with 7 statuses.
Color mapping:
preview: