summaryrefslogtreecommitdiff
path: root/src/client/pages/settings/mute-block.vue
blob: 3457e31614658c9b25c78ca0e0e1ab9c975cba8c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
<template>
<section class="rrfwjxfl _section">
	<MkTab v-model:value="tab" style="margin-bottom: var(--margin);">
		<option value="mute">{{ $ts.mutedUsers }}</option>
		<option value="block">{{ $ts.blockedUsers }}</option>
	</MkTab>
	<div class="_content" v-if="tab === 'mute'">
		<MkPagination :pagination="mutingPagination" class="muting">
			<template #empty><MkInfo>{{ $ts.noUsers }}</MkInfo></template>
			<template #default="{items}">
				<div class="user" v-for="mute in items" :key="mute.id">
					<MkA class="name" :to="userPage(mute.mutee)">
						<MkAcct :user="mute.mutee"/>
					</MkA>
				</div>
			</template>
		</MkPagination>
	</div>
	<div class="_content" v-if="tab === 'block'">
		<MkPagination :pagination="blockingPagination" class="blocking">
			<template #empty><MkInfo>{{ $ts.noUsers }}</MkInfo></template>
			<template #default="{items}">
				<div class="user" v-for="block in items" :key="block.id">
					<MkA class="name" :to="userPage(block.blockee)">
						<MkAcct :user="block.blockee"/>
					</MkA>
				</div>
			</template>
		</MkPagination>
	</div>
</section>
</template>

<script lang="ts">
import { defineComponent } from 'vue';
import { faBan } from '@fortawesome/free-solid-svg-icons';
import MkPagination from '@/components/ui/pagination.vue';
import MkTab from '@/components/tab.vue';
import MkInfo from '@/components/ui/info.vue';
import { userPage } from '@/filters/user';
import * as os from '@/os';

export default defineComponent({
	components: {
		MkPagination,
		MkTab,
		MkInfo,
	},

	emits: ['info'],

	data() {
		return {
			INFO: {
				title: this.$ts.muteAndBlock,
				icon: faBan
			},
			tab: 'mute',
			mutingPagination: {
				endpoint: 'mute/list',
				limit: 10,
			},
			blockingPagination: {
				endpoint: 'blocking/list',
				limit: 10,
			},
		}
	},

	mounted() {
		this.$emit('info', this.INFO);
	},

	methods: {
		userPage
	}
});
</script>

<style lang="scss" scoped>
.rrfwjxfl {
	> ._content {
		max-height: 350px;
		overflow: auto;

		> .muting,
		> .blocking {
			> .empty {
				opacity: 0.5 !important;
			}
		}
	}
}
</style>