2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2022-07-07 04:19:50 -07:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader/></template>
|
|
|
|
<MkSpacer :content-max="800">
|
|
|
|
<MkPagination ref="paginationComponent" :pagination="pagination">
|
|
|
|
<template #empty>
|
|
|
|
<div class="_fullinfo">
|
|
|
|
<img src="https://xn--931a.moe/assets/info.jpg" class="_ghost"/>
|
2022-07-20 06:24:26 -07:00
|
|
|
<div>{{ i18n.ts.noFollowRequests }}</div>
|
2022-07-07 04:19:50 -07:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
<template #default="{items}">
|
|
|
|
<div class="mk-follow-requests">
|
|
|
|
<div v-for="req in items" :key="req.id" class="user _panel">
|
2023-01-15 21:18:11 -08:00
|
|
|
<MkAvatar class="avatar" :user="req.follower" indicator link preview/>
|
2022-07-07 04:19:50 -07:00
|
|
|
<div class="body">
|
|
|
|
<div class="name">
|
2023-02-08 03:07:19 -08:00
|
|
|
<MkA v-user-preview="req.follower.id" class="name" :to="userPage(req.follower)"><MkUserName :user="req.follower"/></MkA>
|
2022-07-07 04:19:50 -07:00
|
|
|
<p class="acct">@{{ acct(req.follower) }}</p>
|
|
|
|
</div>
|
|
|
|
<div v-if="req.follower.description" class="description" :title="req.follower.description">
|
2022-12-28 17:14:44 -08:00
|
|
|
<Mfm :text="req.follower.description" :is-note="false" :author="req.follower" :i="$i" :plain="true" :nowrap="true"/>
|
2022-07-07 04:19:50 -07:00
|
|
|
</div>
|
|
|
|
<div class="actions">
|
2022-12-19 02:01:30 -08:00
|
|
|
<button class="_button" @click="accept(req.follower)"><i class="ti ti-check"></i></button>
|
|
|
|
<button class="_button" @click="reject(req.follower)"><i class="ti ti-x"></i></button>
|
2022-07-07 04:19:50 -07:00
|
|
|
</div>
|
2022-01-12 09:21:43 -08:00
|
|
|
</div>
|
2020-02-14 15:42:21 -08:00
|
|
|
</div>
|
|
|
|
</div>
|
2022-07-07 04:19:50 -07:00
|
|
|
</template>
|
|
|
|
</MkPagination>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 11:37:25 -08:00
|
|
|
</template>
|
|
|
|
|
2022-01-12 09:21:43 -08:00
|
|
|
<script lang="ts" setup>
|
2023-01-02 20:37:32 -08:00
|
|
|
import { shallowRef, computed } from 'vue';
|
2022-09-06 02:21:49 -07:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import { userPage, acct } from '@/filters/user';
|
|
|
|
import * as os from '@/os';
|
2022-01-12 09:21:43 -08:00
|
|
|
import { i18n } from '@/i18n';
|
2022-06-20 01:38:49 -07:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2022-01-12 09:21:43 -08:00
|
|
|
|
2023-01-02 20:37:32 -08:00
|
|
|
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
|
2022-01-12 09:21:43 -08:00
|
|
|
|
|
|
|
const pagination = {
|
2022-01-12 09:26:10 -08:00
|
|
|
endpoint: 'following/requests/list' as const,
|
2022-01-12 09:21:43 -08:00
|
|
|
limit: 10,
|
|
|
|
};
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-01-12 09:21:43 -08:00
|
|
|
function accept(user) {
|
|
|
|
os.api('following/requests/accept', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-01-12 09:21:43 -08:00
|
|
|
function reject(user) {
|
|
|
|
os.api('following/requests/reject', { userId: user.id }).then(() => {
|
|
|
|
paginationComponent.value.reload();
|
|
|
|
});
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.followRequests,
|
2022-12-26 00:15:30 -08:00
|
|
|
icon: 'ti ti-user-plus',
|
2022-06-20 01:38:49 -07:00
|
|
|
})));
|
2020-01-29 11:37:25 -08:00
|
|
|
</script>
|
|
|
|
|
2022-12-27 01:29:39 -08:00
|
|
|
<style lang="scss" scoped>
|
2020-01-29 11:37:25 -08:00
|
|
|
.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 05:57:16 -08:00
|
|
|
overflow: hidden;
|
2020-01-29 11:37:25 -08: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 05:57:16 -08:00
|
|
|
overflow: hidden;
|
2020-01-29 11:37:25 -08: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>
|