-
-
Notifications
You must be signed in to change notification settings - Fork 28.2k
Custom Cards #2409
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
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
rickstaa
left a comment
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:usernameexclude_repolocalecount_privateinclude_all_commitscustom_titlecache_secondsIn addition, the following new options are added (through query params):
total_starstotal_commitstotal_prstotal_issuestotal_contribslevel(for rank level)score(for rank score)stars_titlecommits_titleissues_titleprs_titlecontribs_titletitle(main title)Top Languages Card
Endpoint is
/top-langs. The following options aren't used:usernamelangs_countexclude_repolocalecustom_titlecache_secondsIn addition, the following new options are added (through query params):
title(main title)langs- Format is as follows:{ "name": "Rap", "size": 50, "color": "#4287f5", "text": "50 Hours" }; { "name": "Pop", "size": 20, "color": "#eb4034", "text": "20 Hours" }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 categorynamedefaults toNo Name,sizedefaults to0,textdefaults to a percentage value of that category (calculated fromsize), andcolordefaults to the selected theme's default color.Repo Card
Endpoint is
/pin. The following options aren't used:usernamereposhow_ownerlocalecache_secondsIn 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.jskFormatterto allowNaNvalues too (checks if it's text or number)renderStatsCard()function./src/cards/top-languages-card.jsrenderTopLanguages()functionkFormatter(stars and forks) to allowNaNvalues 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)