Skip to content

docs: contributors list add last updated time #6871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 31 additions & 10 deletions site/src/components/Contributors/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,22 @@
import { ref, watchEffect } from 'vue';
import { useRoute } from 'vue-router';
import { REPO_PATH } from './constants';
import dayjs from 'dayjs';

defineProps({
isZn: Boolean,
});

const route = useRoute();
const contributors = ref([]);
const lastCommitTime = ref(0);

const filterData = data => {
const arr = [];
data.forEach(item => {
if (!!item.author?.login || !!item.author?.html_url || !!item.author?.avatar_url) {
lastCommitTime.value = Math.max(lastCommitTime.value, +new Date(item.commit.author.date));

arr.push({
login: item.author.login,
url: item.author.html_url,
Expand Down Expand Up @@ -46,18 +52,33 @@ watchEffect(() => {
</script>

<template>
<ul v-if="contributors.length > 0" class="acss-1ppw8kl">
<li v-for="item in contributors" :key="item.login">
<a-tooltip :title="`${isZn ? '文档贡献者:' : 'contribotors: '}${item.login}`">
<a :href="item.url" target="_blank">
<a-avatar :src="item.avatar" size="small" />
</a>
</a-tooltip>
</li>
</ul>
<div class="contributors-list">
<ul v-if="contributors.length > 0" class="acss-1ppw8kl">
<li v-for="item in contributors" :key="item.login">
<a-tooltip :title="`${isZn ? '文档贡献者:' : 'Contributor: '}${item.login}`">
<a :href="item.url" target="_blank">
<a-avatar :src="item.avatar" size="small" />
</a>
</a-tooltip>
</li>
</ul>
<span>
{{ isZn ? '最后更新' : 'Last updated' }} : {{ dayjs(lastCommitTime).format('YYYY/MM/DD') }}
</span>
</div>
</template>

<style scoped>
.contributors-list {
margin-top: 120px !important;
display: flex;
gap: 8px;
}

.contributors-list span {
color: var(--primary-color);
}

.acss-1ppw8kl {
display: -webkit-box;
display: -webkit-flex;
Expand All @@ -67,8 +88,8 @@ watchEffect(() => {
-webkit-flex-wrap: wrap;
-ms-flex-wrap: wrap;
flex-wrap: wrap;
margin-top: 120px !important;
clear: both;
flex: 1;
}

.acss-1ppw8kl li {
Expand Down