-
-
Notifications
You must be signed in to change notification settings - Fork 23.4k
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
Custom Cards #2409
base: master
Are you sure you want to change the base?
Custom Cards #2409
Conversation
@Zo-Bro-23 is attempting to deploy a commit to the github readme stats Team on Vercel. A member of the Team first needs to authorize it. |
@anuraghazra @rickstaa thoughts? |
@Zo-Bro-23 Thanks for your pull request. I like the idea. I, however, have some very busy months ahead due to my graduation, so I can not promise I can review this PR in time. Maybe @anuraghazra can take a look at it. |
@anuraghazra ready for review! If possible, I'd like feedback on three things please:
Looking forward to reading your reviews; cheers! |
86aafe8
to
8bc69e7
Compare
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 don't think giving users the ability to construct their stats and language cards is wise. The idea of having an endpoint where people can create custom cards (i.e. wild) is very cool. I would, however, make the stats and language card items reserved and throw an error if people try to use those.
Custom Cards
This PR adds an option to generate custom cards in addition to the GitHub Stats cards!
Right now only stats and top languages can be generated, but options will be soon added for wakatime and repo cards!API Usage
Main endpoint is
https://{VERCEL_URL}/api/wild
.Stats Card
Endpoint is
/
. The following options aren't used:username
exclude_repo
locale
count_private
include_all_commits
custom_title
cache_seconds
In addition, the following new options are added (through query params):
total_stars
total_commits
total_prs
total_issues
total_contribs
level
(for rank level)score
(for rank score)stars_title
commits_title
issues_title
prs_title
contribs_title
title
(main title)Top Languages Card
Endpoint is
/top-langs
. The following options aren't used:username
langs_count
exclude_repo
locale
custom_title
cache_seconds
In addition, the following new options are added (through query params):
title
(main title)langs
- Format is as follows:It's essentially JSON with
;
separating the different objects. The object attributes are as follows (same as used internally):name
- Name of categorysize
- An arbitrary size to calculate what percent of the bar to fillcolor
- HEX code for the color of the categorytext
- Text to add next to the categoryname
defaults toNo Name
,size
defaults to0
,text
defaults to a percentage value of that category (calculated fromsize
), andcolor
defaults to the selected theme's default color.Repo Card
Endpoint is
/pin
. The following options aren't used:username
repo
show_owner
locale
cache_seconds
In addition, the following new options are added (through query params):
title
(instead of repo name)description
(instead of repo description)footer
(instead of repo language)badge
- Circular badge color next to repo language or footerhighlight
- Highlight text (usually Template or Archive)stars
- Star count (can be text or number - number will be auto-formatted)forks
- Fork count (can be text or number - number will be auto-formatted)Changelog
./vercel.json
- ChangedmaxDuration
; ignore for now (used for testing), will revert before PR is published../src/cards/stats-card.js
kFormatter
to allowNaN
values too (checks if it's text or number)renderStatsCard()
function./src/cards/top-languages-card.js
renderTopLanguages()
functionkFormatter
(stars and forks) to allowNaN
values too (checks if it's text or number)./src/cards/repo-card.js
./api/wild/index.js
- Adds an API endpoint for custom cards like shown above./api/wild/top-langs.js
- Adds an API endpoint for custom top language cards./api/wild/pin.js
- Adds an API endpoint for custom repo cardsTo Do
[x] Wakatime(not needed because Top Languages added support for custom text)Add tests(probably not needed asrenderStatsCard()
still works the same, and the new APIs don't add much to the existing ones)renderStatsCard()
doesn't affect anything else (other tests, etc)