DPS909 — rc 0.4 — Week 2
Within week two, I made 2 PRs for the internal project GitHub-Dashboard.
The two components will be use on main page. For language list, I used listRepos to get the list of repositories, then map them into language array, calculation sum on unique elements, then sort them into a complete language list. The process looked long but there was currently no support for getting languages through all repos in Github API (can only list languages in a specific repo).
For top language used, I simply just took the most one in the array above, then used devicon to illustrate the language (this library was probably the only one with programming language icons for now).
The challenging one was the account age. Calculating duration from a time in the past, in exact number of year/month/day is quite complicated. Even the most popular library moment.js didn’t support it. Luckily I found a plugin of moment.js called moment-precise-range which met exactly the need, or else it would have been a bit hurt to implement it on my own.