1
0
mirror of https://github.com/MisskeyIO/misskey synced 2024-12-23 02:58:18 +09:00
MisskeyIO/packages/frontend/src/pages/follow-requests.vue

156 lines
3.4 KiB
Vue
Raw Normal View History

<template>
2022-07-07 20:19:50 +09:00
<MkStickyContainer>
<template #header><MkPageHeader/></template>
2023-05-19 16:20:53 +09:00
<MkSpacer :contentMax="800">
2022-07-07 20:19:50 +09:00
<MkPagination ref="paginationComponent" :pagination="pagination">
<template #empty>
<div class="_fullinfo">
<img :src="infoImageUrl" class="_ghost"/>
2022-07-20 22:24:26 +09:00
<div>{{ i18n.ts.noFollowRequests }}</div>
2022-07-07 20:19:50 +09: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-16 14:18:11 +09:00
<MkAvatar class="avatar" :user="req.follower" indicator link preview/>
2022-07-07 20:19:50 +09:00
<div class="body">
<div class="name">
2023-02-08 20:07:19 +09:00
<MkA v-user-preview="req.follower.id" class="name" :to="userPage(req.follower)"><MkUserName :user="req.follower"/></MkA>
2022-07-07 20:19:50 +09:00
<p class="acct">@{{ acct(req.follower) }}</p>
</div>
<div class="commands">
<MkButton class="command" rounded primary @click="accept(req.follower)"><i class="ti ti-check"/> {{ i18n.ts.accept }}</MkButton>
<MkButton class="command" rounded danger @click="reject(req.follower)"><i class="ti ti-x"/> {{ i18n.ts.reject }}</MkButton>
2022-07-07 20:19:50 +09:00
</div>
</div>
2020-02-15 08:42:21 +09:00
</div>
</div>
2022-07-07 20:19:50 +09:00
</template>
</MkPagination>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { shallowRef, computed } from 'vue';
import MkPagination from '@/components/MkPagination.vue';
import MkButton from '@/components/MkButton.vue';
2021-11-12 02:02:25 +09:00
import { userPage, acct } from '@/filters/user';
import * as os from '@/os';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import { infoImageUrl } from '@/instance';
const paginationComponent = shallowRef<InstanceType<typeof MkPagination>>();
const pagination = {
2022-01-13 02:26:10 +09:00
endpoint: 'following/requests/list' as const,
limit: 10,
};
function accept(user) {
os.api('following/requests/accept', { userId: user.id }).then(() => {
paginationComponent.value.reload();
});
}
function reject(user) {
os.api('following/requests/reject', { userId: user.id }).then(() => {
paginationComponent.value.reload();
});
}
const headerActions = $computed(() => []);
const headerTabs = $computed(() => []);
definePageMetadata(computed(() => ({
title: i18n.ts.followRequests,
2022-12-26 17:15:30 +09:00
icon: 'ti ti-user-plus',
})));
</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;
flex-wrap: wrap;
gap: 8px;
> .name {
flex: 1 1 50%;
> .name,
> .acct {
display: block;
white-space: nowrap;
text-overflow: ellipsis;
overflow: hidden;
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;
overflow: hidden;
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;
}
}
> .commands {
display: flex;
gap: 8px;
}
> .actions {
position: absolute;
top: 0;
bottom: 0;
right: 0;
margin: auto 0;
> button {
padding: 12px;
}
}
}
}
}
</style>