2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2020-11-25 13:31:34 +01:00
|
|
|
<div>
|
2022-01-09 19:30:35 +01:00
|
|
|
<MkPagination v-slot="{items}" ref="list" :pagination="type === 'following' ? followingPagination : followersPagination" class="mk-following-or-followers">
|
2022-07-05 15:40:53 +02:00
|
|
|
<div class="users">
|
2021-11-19 11:36:12 +01:00
|
|
|
<MkUserInfo v-for="user in items.map(x => type === 'following' ? x.followee : x.follower)" :key="user.id" class="user" :user="user"/>
|
2020-01-29 20:37:25 +01:00
|
|
|
</div>
|
2020-10-17 13:12:00 +02:00
|
|
|
</MkPagination>
|
|
|
|
</div>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-12 18:46:14 +01:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed } from 'vue';
|
2022-12-12 04:24:12 +01:00
|
|
|
import * as misskey from 'calckey-js';
|
2022-08-30 17:24:33 +02:00
|
|
|
import MkUserInfo from '@/components/MkUserInfo.vue';
|
2022-09-06 11:21:49 +02:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-12 18:46:14 +01:00
|
|
|
const props = defineProps<{
|
|
|
|
user: misskey.entities.User;
|
|
|
|
type: 'following' | 'followers';
|
|
|
|
}>();
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-12 18:46:14 +01:00
|
|
|
const followingPagination = {
|
|
|
|
endpoint: 'users/following' as const,
|
|
|
|
limit: 20,
|
|
|
|
params: computed(() => ({
|
|
|
|
userId: props.user.id,
|
|
|
|
})),
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2022-01-12 18:46:14 +01:00
|
|
|
const followersPagination = {
|
|
|
|
endpoint: 'users/followers' as const,
|
|
|
|
limit: 20,
|
|
|
|
params: computed(() => ({
|
|
|
|
userId: props.user.id,
|
|
|
|
})),
|
|
|
|
};
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-following-or-followers {
|
2020-10-17 13:12:00 +02:00
|
|
|
> .users {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
grid-gap: var(--margin);
|
2020-01-29 20:37:25 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|