2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2020-02-15 08:42:21 +09:00
|
|
|
<div>
|
2022-01-13 02:21:43 +09:00
|
|
|
<MkPagination ref="paginationComponent" :pagination="pagination">
|
2020-02-15 08:42:21 +09:00
|
|
|
<template #empty>
|
2020-03-28 19:33:11 +09:00
|
|
|
<div class="_fullinfo">
|
2020-03-23 19:06:46 +09:00
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
2020-12-26 10:47:36 +09:00
|
|
|
<div>{{ $ts.noFollowRequests }}</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-02-15 08:42:21 +09:00
|
|
|
</template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<template #default="{items}">
|
2022-01-13 02:21:43 +09:00
|
|
|
<div class="mk-follow-requests">
|
|
|
|
<div v-for="req in items" :key="req.id" class="user _panel">
|
|
|
|
<MkAvatar class="avatar" :user="req.follower" :show-indicator="true"/>
|
|
|
|
<div class="body">
|
|
|
|
<div class="name">
|
|
|
|
<MkA v-user-preview="req.follower.id" class="name" :to="userPage(req.follower)"><MkUserName :user="req.follower"/></MkA>
|
|
|
|
<p class="acct">@{{ acct(req.follower) }}</p>
|
|
|
|
</div>
|
|
|
|
<div v-if="req.follower.description" class="description" :title="req.follower.description">
|
|
|
|
<Mfm :text="req.follower.description" :is-note="false" :author="req.follower" :i="$i" :custom-emojis="req.follower.emojis" :plain="true" :nowrap="true"/>
|
|
|
|
</div>
|
|
|
|
<div class="actions">
|
|
|
|
<button class="_button" @click="accept(req.follower)"><i class="fas fa-check"></i></button>
|
|
|
|
<button class="_button" @click="reject(req.follower)"><i class="fas fa-times"></i></button>
|
|
|
|
</div>
|
2020-02-15 08:42:21 +09:00
|
|
|
</div>
|
|
|
|
</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</div>
|
2020-02-15 08:42:21 +09:00
|
|
|
</template>
|
2020-10-17 20:12:00 +09:00
|
|
|
</MkPagination>
|
2020-02-15 08:42:21 +09:00
|
|
|
</div>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-01-13 02:21:43 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref, computed } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
|
|
|
import { userPage, acct } from '@/filters/user';
|
|
|
|
import * as os from '@/os';
|
2022-01-13 02:21:43 +09:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-01-13 02:21:43 +09:00
|
|
|
|
|
|
|
const paginationComponent = ref<InstanceType<typeof MkPagination>>();
|
|
|
|
|
|
|
|
const pagination = {
|
2022-01-13 02:26:10 +09:00
|
|
|
endpoint: 'following/requests/list' as const,
|
2022-01-13 02:21:43 +09:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-01-13 02:21:43 +09:00
|
|
|
function accept(user) {
|
|
|
|
os.api('following/requests/accept', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-01-13 02:21:43 +09:00
|
|
|
function reject(user) {
|
|
|
|
os.api('following/requests/reject', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.followRequests,
|
|
|
|
icon: 'fas fa-user-clock',
|
|
|
|
bg: 'var(--bg)',
|
|
|
|
})));
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.mk-follow-requests {
|
|
|
|
> .user {
|
|
|
|
display: flex;
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> .avatar {
|
|
|
|
display: block;
|
|
|
|
flex-shrink: 0;
|
|
|
|
margin: 0 12px 0 0;
|
|
|
|
width: 42px;
|
|
|
|
height: 42px;
|
|
|
|
border-radius: 8px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .body {
|
|
|
|
display: flex;
|
|
|
|
width: calc(100% - 54px);
|
|
|
|
position: relative;
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
width: 45%;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
width: 100%;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name,
|
|
|
|
> .acct {
|
|
|
|
display: block;
|
|
|
|
white-space: nowrap;
|
|
|
|
text-overflow: ellipsis;
|
2021-03-02 22:57:16 +09:00
|
|
|
overflow: hidden;
|
2020-01-30 04:37:25 +09:00
|
|
|
margin: 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
font-size: 16px;
|
|
|
|
line-height: 24px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .acct {
|
|
|
|
font-size: 15px;
|
|
|
|
line-height: 16px;
|
|
|
|
opacity: 0.7;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
width: 55%;
|
|
|
|
line-height: 42px;
|
|
|
|
white-space: nowrap;
|
2021-03-02 22:57:16 +09:00
|
|
|
overflow: hidden;
|
2020-01-30 04:37:25 +09:00
|
|
|
text-overflow: ellipsis;
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 14px;
|
|
|
|
padding-right: 40px;
|
|
|
|
padding-left: 8px;
|
|
|
|
box-sizing: border-box;
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .actions {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
bottom: 0;
|
|
|
|
right: 0;
|
|
|
|
margin: auto 0;
|
|
|
|
|
|
|
|
> button {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|