summaryrefslogtreecommitdiff
path: root/src/client/pages/settings/account-info.vue
blob: c881b91535a7c2768a1cb57a5a614141d90a7abb (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
<template>
<FormBase>
	<FormKeyValueView>
		<template #key>ID</template>
		<template #value><span class="_monospace">{{ $store.state.i.id }}</span></template>
	</FormKeyValueView>

	<FormGroup>
		<FormKeyValueView>
			<template #key>{{ $t('registeredDate') }}</template>
			<template #value><MkTime :time="$store.state.i.createdAt" mode="detail"/></template>
		</FormKeyValueView>
	</FormGroup>

	<FormGroup v-if="stats">
		<template #label>{{ $t('statistics') }}</template>
		<FormKeyValueView>
			<template #key>{{ $t('notesCount') }}</template>
			<template #value>{{ number(stats.notesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('repliesCount') }}</template>
			<template #value>{{ number(stats.repliesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('renotesCount') }}</template>
			<template #value>{{ number(stats.renotesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('repliedCount') }}</template>
			<template #value>{{ number(stats.repliedCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('renotedCount') }}</template>
			<template #value>{{ number(stats.renotedCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('pollVotesCount') }}</template>
			<template #value>{{ number(stats.pollVotesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('pollVotedCount') }}</template>
			<template #value>{{ number(stats.pollVotedCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('sentReactionsCount') }}</template>
			<template #value>{{ number(stats.sentReactionsCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('receivedReactionsCount') }}</template>
			<template #value>{{ number(stats.receivedReactionsCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('noteFavoritesCount') }}</template>
			<template #value>{{ number(stats.noteFavoritesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followingCount') }}</template>
			<template #value>{{ number(stats.followingCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followingCount') }} ({{ $t('local') }})</template>
			<template #value>{{ number(stats.localFollowingCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followingCount') }} ({{ $t('remote') }})</template>
			<template #value>{{ number(stats.remoteFollowingCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followersCount') }}</template>
			<template #value>{{ number(stats.followersCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followersCount') }} ({{ $t('local') }})</template>
			<template #value>{{ number(stats.localFollowersCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('followersCount') }} ({{ $t('remote') }})</template>
			<template #value>{{ number(stats.remoteFollowersCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('pageLikesCount') }}</template>
			<template #value>{{ number(stats.pageLikesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('pageLikedCount') }}</template>
			<template #value>{{ number(stats.pageLikedCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('driveFilesCount') }}</template>
			<template #value>{{ number(stats.driveFilesCount) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('driveUsage') }}</template>
			<template #value>{{ bytes(stats.driveUsage) }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>{{ $t('reversiCount') }}</template>
			<template #value>{{ number(stats.reversiCount) }}</template>
		</FormKeyValueView>
	</FormGroup>

	<FormGroup>
		<template #label>{{ $t('other') }}</template>
		<FormKeyValueView>
			<template #key>emailVerified</template>
			<template #value>{{ $store.state.i.emailVerified ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>twoFactorEnabled</template>
			<template #value>{{ $store.state.i.twoFactorEnabled ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>securityKeys</template>
			<template #value>{{ $store.state.i.securityKeys ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>usePasswordLessLogin</template>
			<template #value>{{ $store.state.i.usePasswordLessLogin ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>isModerator</template>
			<template #value>{{ $store.state.i.isModerator ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
		<FormKeyValueView>
			<template #key>isAdmin</template>
			<template #value>{{ $store.state.i.isAdmin ? $t('yes') : $t('no') }}</template>
		</FormKeyValueView>
	</FormGroup>
</FormBase>
</template>

<script lang="ts">
import { defineAsyncComponent, defineComponent } from 'vue';
import { faInfoCircle } from '@fortawesome/free-solid-svg-icons';
import FormSwitch from '@/components/form/switch.vue';
import FormSelect from '@/components/form/select.vue';
import FormLink from '@/components/form/link.vue';
import FormBase from '@/components/form/base.vue';
import FormGroup from '@/components/form/group.vue';
import FormButton from '@/components/form/button.vue';
import FormKeyValueView from '@/components/form/key-value-view.vue';
import * as os from '@/os';
import number from '@/filters/number';
import bytes from '@/filters/bytes';

export default defineComponent({
	components: {
		FormBase,
		FormSelect,
		FormSwitch,
		FormButton,
		FormLink,
		FormGroup,
		FormKeyValueView,
	},

	emits: ['info'],
	
	data() {
		return {
			INFO: {
				title: this.$t('accountInfo'),
				icon: faInfoCircle
			},
			stats: null
		}
	},

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

		os.api('users/stats', {
			userId: this.$store.state.i.id
		}).then(stats => {
			this.stats = stats;
		});
	},

	methods: {
		number,
		bytes,
	}
});
</script>