1
1
<script lang="ts">
2
2
import {SvgIcon } from ' ../svg.ts' ;
3
+ import dayjs from ' dayjs' ;
3
4
import {
4
5
Chart ,
5
6
Title ,
@@ -26,6 +27,7 @@ import {sleep} from '../utils.ts';
26
27
import ' chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm' ;
27
28
import {fomanticQuery } from ' ../modules/fomantic/base.ts' ;
28
29
import type {Entries } from ' type-fest' ;
30
+ import {pathEscapeSegments } from ' ../utils/url.ts' ;
29
31
30
32
const customEventListener: Plugin = {
31
33
id: ' customEventListener' ,
@@ -65,6 +67,10 @@ export default {
65
67
type: String ,
66
68
required: true ,
67
69
},
70
+ repoDefaultBranchName: {
71
+ type: String ,
72
+ required: true ,
73
+ },
68
74
},
69
75
data : () => ({
70
76
isLoading: false ,
@@ -100,6 +106,15 @@ export default {
100
106
.slice (0 , 100 );
101
107
},
102
108
109
+ getContributorSearchQuery(contributorEmail : string ) {
110
+ const min = dayjs (this .xAxisMin ).format (' YYYY-MM-DD' );
111
+ const max = dayjs (this .xAxisMax ).format (' YYYY-MM-DD' );
112
+ const params = new URLSearchParams ({
113
+ ' q' : ` after:${min }, before:${max }, author:${contributorEmail } ` ,
114
+ });
115
+ return ` ${this .repoLink }/commits/branch/${pathEscapeSegments (this .repoDefaultBranchName )}/search?${params .toString ()} ` ;
116
+ },
117
+
103
118
async fetchGraphData() {
104
119
this .isLoading = true ;
105
120
try {
@@ -167,7 +182,7 @@ export default {
167
182
// for details.
168
183
user .max_contribution_type += 1 ;
169
184
170
- filteredData [key ] = {... user , weeks: filteredWeeks };
185
+ filteredData [key ] = {... user , weeks: filteredWeeks , email: key };
171
186
}
172
187
173
188
return filteredData ;
@@ -215,7 +230,7 @@ export default {
215
230
};
216
231
},
217
232
218
- updateOtherCharts({chart }: {chart: Chart }, reset ? : boolean = false ) {
233
+ updateOtherCharts({chart }: {chart: Chart }, reset : boolean = false ) {
219
234
const minVal = chart .options .scales .x .min ;
220
235
const maxVal = chart .options .scales .x .max ;
221
236
if (reset ) {
@@ -381,15 +396,19 @@ export default {
381
396
<div class =" ui top attached header tw-flex tw-flex-1" >
382
397
<b class =" ui right" >#{{ index + 1 }}</b >
383
398
<a :href =" contributor.home_link" >
384
- <img class =" ui avatar tw-align-middle" height =" 40" width =" 40" :src =" contributor.avatar_link" >
399
+ <img class =" ui avatar tw-align-middle" height =" 40" width =" 40" :src =" contributor.avatar_link" alt = " " >
385
400
</a >
386
401
<div class =" tw-ml-2" >
387
402
<a v-if =" contributor.home_link !== ''" :href =" contributor.home_link" ><h4 >{{ contributor.name }}</h4 ></a >
388
403
<h4 v-else class =" contributor-name" >
389
404
{{ contributor.name }}
390
405
</h4 >
391
406
<p class =" tw-text-12 tw-flex tw-gap-1" >
392
- <strong v-if =" contributor.total_commits" >{{ contributor.total_commits.toLocaleString() }} {{ locale.contributionType.commits }}</strong >
407
+ <strong v-if =" contributor.total_commits" >
408
+ <a class =" silenced" :href =" getContributorSearchQuery(contributor.email)" >
409
+ {{ contributor.total_commits.toLocaleString() }} {{ locale.contributionType.commits }}
410
+ </a >
411
+ </strong >
393
412
<strong v-if =" contributor.total_additions" class =" text green" >{{ contributor.total_additions.toLocaleString() }}++ </strong >
394
413
<strong v-if =" contributor.total_deletions" class =" text red" >
395
414
{{ contributor.total_deletions.toLocaleString() }}--</strong >
0 commit comments