mirror of
https://github.com/tiennm99/ghglance.git
synced 2026-10-18 12:14:23 +00:00
feat: add all-time variants of productive, language, contribution cards
Four time-bounded cards ("last year") now have all-time counterparts, and
the stats card gains a lifetime commits row.
New cards:
- 6-most-commit-language-all-time.svg (byte-weighted, all lifetime commits)
- 7-productive-time-all-time.svg (hour histogram over all lifetime commits)
- 8-contributions-all-time.svg (area chart spanning every active year)
Data pipeline:
- Drop the "since" filter from commitHistoryQuery; FetchProductive now
paginates unbounded commits and splits each commit into last-year and
all-time buckets in a single pass — no extra API calls.
- New contributionYearQuery iterates user.contributionYears to
concatenate calendar data and accumulate TotalCommitsAllTime.
- -commits-per-repo default bumped 100 → 500 to give all-time depth.
Polish:
- Productive-time title embeds the configured tz as "UTC±N.NN" (e.g.
UTC+7.00) on both last-year and all-time cards.
- Contribution x-axis flipped to mm/yy with an "mm/yy" footer caption
paralleling productive-time's "hour of day".
- Contribution x-axis label stride now targets ~6 labels regardless of
bucket count so the all-time chart (~100 months) stays readable while
the underlying curve still samples every month.
This commit is contained in:
1 parent
1ad861787a
commit
50b29b4a78
11 files changed
+280
-58
No files matched your search
@@ -24,6 +24,7 @@ query($login: String!, $after: String) {
|
||||
contributionTypes: [COMMIT, PULL_REQUEST, ISSUE, PULL_REQUEST_REVIEW]
|
||||
) { totalCount }
|
||||
contributionsCollection {
|
||||
contributionYears
|
||||
totalCommitContributions
|
||||
totalIssueContributions
|
||||
totalPullRequestContributions
|
||||
@@ -69,12 +70,12 @@ query($login: String!, $after: String) {
|
||||
// repo, filtered to commits authored by the target user. Used to build the
|
||||
// productive-time heatmap.
|
||||
const commitHistoryQuery = `
|
||||
query($login: String!, $repo: String!, $userId: ID!, $since: GitTimestamp!, $after: String) {
|
||||
query($login: String!, $repo: String!, $userId: ID!, $after: String) {
|
||||
repository(owner: $login, name: $repo) {
|
||||
defaultBranchRef {
|
||||
target {
|
||||
... on Commit {
|
||||
history(first: 100, after: $after, author: { id: $userId }, since: $since) {
|
||||
history(first: 100, after: $after, author: { id: $userId }) {
|
||||
pageInfo { hasNextPage endCursor }
|
||||
nodes { committedDate }
|
||||
}
|
||||
@@ -83,3 +84,23 @@ query($login: String!, $repo: String!, $userId: ID!, $since: GitTimestamp!, $aft
|
||||
}
|
||||
}
|
||||
}`
|
||||
|
||||
// contributionYearQuery fetches a single year's contribution calendar days
|
||||
// plus the commit total for that year. Looped in Go over user.contributionYears
|
||||
// to build the all-time contribution series and lifetime commit count.
|
||||
const contributionYearQuery = `
|
||||
query($login: String!, $from: DateTime!, $to: DateTime!) {
|
||||
user(login: $login) {
|
||||
contributionsCollection(from: $from, to: $to) {
|
||||
totalCommitContributions
|
||||
contributionCalendar {
|
||||
weeks {
|
||||
contributionDays {
|
||||
contributionCount
|
||||
date
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}`
|
||||
Reference in new issue
Block a user