File tree Expand file tree Collapse file tree 4 files changed +92
-1
lines changed
Expand file tree Collapse file tree 4 files changed +92
-1
lines changed Original file line number Diff line number Diff line change 1+ import md5 from 'md5' ;
2+ import { simpleGit } from 'simple-git' ;
3+
4+ const git = simpleGit ( ) ;
5+
6+ export default {
7+ async load ( ) {
8+ try {
9+ const log = await git . log ( ) ;
10+ const contributorsMap = new Map ( ) ;
11+
12+ log . all . forEach ( ( commit ) => {
13+ const { author_email, author_name } = commit ;
14+ if ( author_email && ! contributorsMap . has ( author_name ) ) {
15+ contributorsMap . set ( author_name , {
16+ name : author_name ,
17+ email : author_email ,
18+ avatar : `https://gravatar.com/avatar/${ md5 ( author_email ) } ?d=retro`
19+ } ) ;
20+ }
21+ } ) ;
22+
23+ const contributors = Array . from ( contributorsMap . values ( ) ) . sort ( ( a , b ) =>
24+ a . name . localeCompare ( b . name )
25+ ) ;
26+
27+ return {
28+ contributors
29+ } ;
30+ } catch ( error ) {
31+ console . error ( 'Failed to load contributors:' , error ) ;
32+ return { contributors : [ ] } ;
33+ }
34+ }
35+ } ;
Original file line number Diff line number Diff line change 1+ <script setup lang="ts">
2+ import { ref } from ' vue' ;
3+
4+ import { data } from ' ./HomeContributors.data' ;
5+
6+ interface Contributor {
7+ avatar: string ;
8+ name: string ;
9+ }
10+
11+ const contributors = ref <Contributor []>(data .contributors );
12+ </script >
13+
14+ <template >
15+ <div class =" mt-20" >
16+ <div class =" mb-10 text-center text-6xl font-bold" >Team & Contributors</div >
17+
18+ <div class =" flex items-center justify-center" >
19+ <a
20+ href =" https://github.com/siberiacancode"
21+ target =" _blank"
22+ class =" no-underline! text-[var(--vp-c-text-1)]! flex items-center gap-2"
23+ >
24+ <img
25+ src =" https://avatars.githubusercontent.com/u/122668137?s=200&v=4"
26+ alt =" SIBERIA CAN CODE"
27+ class =" size-10 rounded-lg"
28+ />
29+ <div class =" text-2xl font-bold" >SIBERIA CAN CODE</div >
30+ </a >
31+ </div >
32+
33+ <div class =" mt-12 text-center" >
34+ <div class =" mt-6 flex flex-wrap justify-center gap-3" >
35+ <div
36+ v-for =" contributor in contributors"
37+ :key =" contributor.name"
38+ :href =" `https://github.com/${contributor.name}`"
39+ class =" flex items-center gap-2"
40+ >
41+ <img
42+ :src =" contributor.avatar"
43+ :alt =" contributor.name"
44+ class =" size-6 rounded-full"
45+ loading =" lazy"
46+ />
47+ <div class =" text-xs" >
48+ {{ contributor.name }}
49+ </div >
50+ </div >
51+ </div >
52+ </div >
53+ </div >
54+ </template >
Original file line number Diff line number Diff line change 1+ export { default as HomeContributors } from './HomeContributors/HomeContributors.vue' ;
12export { default as HomeHeroBefore } from './HomeHeroBefore/HomeHeroBefore.vue' ;
23export { default as HomeHooks } from './HomeHooks/HomeHooks.vue' ;
Original file line number Diff line number Diff line change @@ -43,7 +43,8 @@ features:
4343---
4444
4545<script setup >
46- import { HomeHooks } from ' ./.vitepress/sections'
46+ import { HomeHooks , HomeContributors } from ' ./.vitepress/sections'
4747</script >
4848
4949<HomeHooks />
50+ <HomeContributors />
You canβt perform that action at this time.
0 commit comments