Skip to content

Commit 197a00f

Browse files
authored
docs: contributors list add last updated time (#6871)
1 parent 3f99a7e commit 197a00f

File tree

1 file changed

+31
-10
lines changed

1 file changed

+31
-10
lines changed

site/src/components/Contributors/index.vue

+31-10
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,22 @@
22
import { ref, watchEffect } from 'vue';
33
import { useRoute } from 'vue-router';
44
import { REPO_PATH } from './constants';
5+
import dayjs from 'dayjs';
56
67
defineProps({
78
isZn: Boolean,
89
});
10+
911
const route = useRoute();
1012
const contributors = ref([]);
13+
const lastCommitTime = ref(0);
14+
1115
const filterData = data => {
1216
const arr = [];
1317
data.forEach(item => {
1418
if (!!item.author?.login || !!item.author?.html_url || !!item.author?.avatar_url) {
19+
lastCommitTime.value = Math.max(lastCommitTime.value, +new Date(item.commit.author.date));
20+
1521
arr.push({
1622
login: item.author.login,
1723
url: item.author.html_url,
@@ -46,18 +52,33 @@ watchEffect(() => {
4652
</script>
4753

4854
<template>
49-
<ul v-if="contributors.length > 0" class="acss-1ppw8kl">
50-
<li v-for="item in contributors" :key="item.login">
51-
<a-tooltip :title="`${isZn ? '文档贡献者:' : 'contribotors: '}${item.login}`">
52-
<a :href="item.url" target="_blank">
53-
<a-avatar :src="item.avatar" size="small" />
54-
</a>
55-
</a-tooltip>
56-
</li>
57-
</ul>
55+
<div class="contributors-list">
56+
<ul v-if="contributors.length > 0" class="acss-1ppw8kl">
57+
<li v-for="item in contributors" :key="item.login">
58+
<a-tooltip :title="`${isZn ? '文档贡献者:' : 'Contributor: '}${item.login}`">
59+
<a :href="item.url" target="_blank">
60+
<a-avatar :src="item.avatar" size="small" />
61+
</a>
62+
</a-tooltip>
63+
</li>
64+
</ul>
65+
<span>
66+
{{ isZn ? '最后更新' : 'Last updated' }} : {{ dayjs(lastCommitTime).format('YYYY/MM/DD') }}
67+
</span>
68+
</div>
5869
</template>
5970

6071
<style scoped>
72+
.contributors-list {
73+
margin-top: 120px !important;
74+
display: flex;
75+
gap: 8px;
76+
}
77+
78+
.contributors-list span {
79+
color: var(--primary-color);
80+
}
81+
6182
.acss-1ppw8kl {
6283
display: -webkit-box;
6384
display: -webkit-flex;
@@ -67,8 +88,8 @@ watchEffect(() => {
6788
-webkit-flex-wrap: wrap;
6889
-ms-flex-wrap: wrap;
6990
flex-wrap: wrap;
70-
margin-top: 120px !important;
7191
clear: both;
92+
flex: 1;
7293
}
7394
7495
.acss-1ppw8kl li {

0 commit comments

Comments
 (0)