mirror of
https://github.com/tiennm99/ghstats.git
synced 2026-09-05 18:16:46 +00:00
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:
@@ -28,22 +28,34 @@ type Profile struct {
|
||||
TotalContributedTo int
|
||||
TotalContributions int // lifetime contributions from calendar + restricted
|
||||
|
||||
// Sorted desc by bytes. Color is GitHub's linguist color or "" if absent.
|
||||
Languages []LangStat
|
||||
// Count of owned repos grouped by primary language, sorted desc by Value.
|
||||
ReposByLanguage []LangStat
|
||||
|
||||
// Count of commits (last year, by this user) attributed to each repo's
|
||||
// primary language, sorted desc. Populated by FetchProductive.
|
||||
CommitsByLanguage []LangStat
|
||||
|
||||
// Commit-count histogram indexed by [day-of-week 0=Sunday][hour-of-day 0-23].
|
||||
Productive [7][24]int
|
||||
|
||||
// TopRepos is the list of owned repo names sorted by stargazer count desc,
|
||||
// populated by FetchProfile. Used as the seed set for FetchProductive.
|
||||
TopRepos []string
|
||||
// TopRepos are owned repos sorted by stargazer count desc. Populated by
|
||||
// FetchProfile and consumed by FetchProductive.
|
||||
TopRepos []RepoInfo
|
||||
}
|
||||
|
||||
// LangStat is one row in the top-languages card.
|
||||
// LangStat is one row in a language breakdown card. Value is repo count or
|
||||
// commit count depending on which slice holds it.
|
||||
type LangStat struct {
|
||||
Name string
|
||||
Color string
|
||||
Bytes int64
|
||||
Value int64
|
||||
}
|
||||
|
||||
// RepoInfo is the minimal owned-repo summary used for downstream fetches.
|
||||
type RepoInfo struct {
|
||||
Name string
|
||||
PrimaryLanguage string
|
||||
PrimaryColor string
|
||||
}
|
||||
|
||||
// repoNode is the GraphQL shape of one repository node; kept here because
|
||||
|
||||
Reference in New Issue
Block a user