feat: role timeline

Resolve #10581
This commit is contained in:
syuilo 2023-04-12 11:40:08 +09:00
parent 81d2c5a4a7
commit 5d56799070
21 changed files with 348 additions and 8 deletions

View file

@ -1,13 +1,16 @@
<template>
<MkStickyContainer>
<template #header><MkPageHeader/></template>
<template #header><MkPageHeader v-model:tab="tab" :tabs="headerTabs"/></template>
<MkSpacer :content-max="1200">
<MkSpacer v-if="tab === 'users'" :content-max="1200">
<div class="_gaps_s">
<div v-if="role">{{ role.description }}</div>
<MkUserList :pagination="users" :extractor="(item) => item.user"/>
</div>
</MkSpacer>
<MkSpacer v-else-if="tab === 'timeline'" :content-max="700">
<MkTimeline ref="timeline" src="role" :role="props.role"/>
</MkSpacer>
</MkStickyContainer>
</template>
@ -16,11 +19,17 @@ import { computed, watch } from 'vue';
import * as os from '@/os';
import MkUserList from '@/components/MkUserList.vue';
import { definePageMetadata } from '@/scripts/page-metadata';
import { i18n } from '@/i18n';
import MkTimeline from '@/components/MkTimeline.vue';
const props = defineProps<{
const props = withDefaults(defineProps<{
role: string;
}>();
initialTab?: string;
}>(), {
initialTab: 'users',
});
let tab = $ref(props.initialTab);
let role = $ref();
watch(() => props.role, () => {
@ -39,6 +48,16 @@ const users = $computed(() => ({
},
}));
const headerTabs = $computed(() => [{
key: 'users',
icon: 'ti ti-users',
title: i18n.ts.users,
}, {
key: 'timeline',
icon: 'ti ti-pencil',
title: i18n.ts.timeline,
}]);
definePageMetadata(computed(() => ({
title: role?.name,
icon: 'ti ti-badge',