11<script lang="ts">
22import {SvgIcon } from ' ../svg.ts' ;
3+ import dayjs from ' dayjs' ;
34import {
45 Chart ,
56 Title ,
@@ -26,6 +27,7 @@ import {sleep} from '../utils.ts';
2627import ' chartjs-adapter-dayjs-4/dist/chartjs-adapter-dayjs-4.esm' ;
2728import {fomanticQuery } from ' ../modules/fomantic/base.ts' ;
2829import type {Entries } from ' type-fest' ;
30+ import {pathEscapeSegments } from ' ../utils/url.ts' ;
2931
3032const customEventListener: Plugin = {
3133 id: ' customEventListener' ,
@@ -65,6 +67,10 @@ export default {
6567 type: String ,
6668 required: true ,
6769 },
70+ repoDefaultBranchName: {
71+ type: String ,
72+ required: true ,
73+ },
6874 },
6975 data : () => ({
7076 isLoading: false ,
@@ -100,6 +106,15 @@ export default {
100106 .slice (0 , 100 );
101107 },
102108
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+
103118 async fetchGraphData() {
104119 this .isLoading = true ;
105120 try {
@@ -167,7 +182,7 @@ export default {
167182 // for details.
168183 user .max_contribution_type += 1 ;
169184
170- filteredData [key ] = {... user , weeks: filteredWeeks };
185+ filteredData [key ] = {... user , weeks: filteredWeeks , email: key };
171186 }
172187
173188 return filteredData ;
@@ -215,7 +230,7 @@ export default {
215230 };
216231 },
217232
218- updateOtherCharts({chart }: {chart: Chart }, reset ? : boolean = false ) {
233+ updateOtherCharts({chart }: {chart: Chart }, reset : boolean = false ) {
219234 const minVal = chart .options .scales .x .min ;
220235 const maxVal = chart .options .scales .x .max ;
221236 if (reset ) {
@@ -381,15 +396,19 @@ export default {
381396 <div class =" ui top attached header tw-flex tw-flex-1" >
382397 <b class =" ui right" >#{{ index + 1 }}</b >
383398 <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 = " " >
385400 </a >
386401 <div class =" tw-ml-2" >
387402 <a v-if =" contributor.home_link !== ''" :href =" contributor.home_link" ><h4 >{{ contributor.name }}</h4 ></a >
388403 <h4 v-else class =" contributor-name" >
389404 {{ contributor.name }}
390405 </h4 >
391406 <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 >
393412 <strong v-if =" contributor.total_additions" class =" text green" >{{ contributor.total_additions.toLocaleString() }}++ </strong >
394413 <strong v-if =" contributor.total_deletions" class =" text red" >
395414 {{ contributor.total_deletions.toLocaleString() }}--</strong >
0 commit comments