refactor: split language card into repos-per-language and most-commit-language

Align card set with github-profile-summary-cards' 5-card layout:

  0-profile-details.svg       (unchanged)
  1-repos-per-language.svg    (new) owned repos grouped by primary language
  2-most-commit-language.svg  (new) last-year commits attributed to each repo's primary language
  3-stats.svg                 (renumbered)
  4-productive-time.svg       (renumbered)

- FetchProductive now fills p.CommitsByLanguage from the same commit history
  it uses for the heatmap, so no extra API calls are introduced.
- TopRepos carries primary language so productive-time can aggregate by lang.
- LangStat.Bytes renamed to Value (repo count or commit count, context-dependent).
- Shared bar+legend renderer extracted to language_bar.go.
- Ignore generated output/ directory.
This commit is contained in:
tiennm99 committed 2026-04-18 18:57:42 +07:00
1 parent ff4975fae2
commit 7eb83be9de
14 files changed
+151 -74

No files matched your search

+7 -7
View File
@@ -2,19 +2,19 @@ package github
import "testing"
func TestSortLanguages(t *testing.T) {
bytes := map[string]int64{
"Go": 500,
"Python": 300,
"TypeScript": 500, // tie with Go → alphabetical wins
"HTML": 100,
func TestSortLangStats(t *testing.T) {
values := map[string]int64{
"Go": 5,
"Python": 3,
"TypeScript": 5, // tie with Go → alphabetical wins
"HTML": 1,
}
colors := map[string]string{
"Go": "#00ADD8",
"Python": "#3572A5",
"TypeScript": "#3178c6",
}
got := sortLanguages(bytes, colors)
got := sortLangStats(values, colors)
wantOrder := []string{"Go", "TypeScript", "Python", "HTML"}
if len(got) != len(wantOrder) {