2023-07-27 14:31:52 +09:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2023-01-19 10:29:30 +09:00
|
|
|
<template>
|
|
|
|
<MkModalWindow
|
|
|
|
ref="dialog"
|
|
|
|
:width="400"
|
|
|
|
:height="450"
|
|
|
|
@close="dialog.close()"
|
|
|
|
@closed="emit('closed')"
|
|
|
|
>
|
2023-04-29 15:48:06 +09:00
|
|
|
<template #header>{{ i18n.ts.reactionsList }}</template>
|
2023-01-19 10:29:30 +09:00
|
|
|
|
2023-05-19 13:58:09 +09:00
|
|
|
<MkSpacer :marginMin="20" :marginMax="28">
|
2023-01-19 10:29:30 +09:00
|
|
|
<div v-if="note" class="_gaps">
|
2023-02-12 17:15:12 +09:00
|
|
|
<div v-if="reactions.length === 0" class="_fullinfo">
|
2023-06-09 14:00:53 +09:00
|
|
|
<img :src="infoImageUrl" class="_ghost"/>
|
2023-02-12 17:15:12 +09:00
|
|
|
<div>{{ i18n.ts.nothing }}</div>
|
2023-01-19 10:29:30 +09:00
|
|
|
</div>
|
2023-02-12 17:15:12 +09:00
|
|
|
<template v-else>
|
|
|
|
<div :class="$style.tabs">
|
|
|
|
<button v-for="reaction in reactions" :key="reaction" :class="[$style.tab, { [$style.tabActive]: tab === reaction }]" class="_button" @click="tab = reaction">
|
|
|
|
<MkReactionIcon :reaction="reaction"/>
|
|
|
|
<span style="margin-left: 4px;">{{ note.reactions[reaction] }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
2023-04-29 15:48:06 +09:00
|
|
|
<MkA v-for="user in users" :key="user.id" :to="userPage(user)" @click="dialog.close()">
|
2023-05-19 13:58:09 +09:00
|
|
|
<MkUserCardMini :user="user" :withChart="false"/>
|
2023-02-12 17:15:12 +09:00
|
|
|
</MkA>
|
|
|
|
</template>
|
2023-01-19 10:29:30 +09:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<MkLoading/>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkModalWindow>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { onMounted, watch } from 'vue';
|
|
|
|
import * as misskey from 'misskey-js';
|
|
|
|
import MkModalWindow from '@/components/MkModalWindow.vue';
|
|
|
|
import MkReactionIcon from '@/components/MkReactionIcon.vue';
|
|
|
|
import MkUserCardMini from '@/components/MkUserCardMini.vue';
|
|
|
|
import { userPage } from '@/filters/user';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import * as os from '@/os';
|
2023-06-09 14:00:53 +09:00
|
|
|
import { infoImageUrl } from '@/instance';
|
2023-01-19 10:29:30 +09:00
|
|
|
|
|
|
|
const emit = defineEmits<{
|
|
|
|
(ev: 'closed'): void,
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
noteId: misskey.entities.Note['id'];
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const dialog = $shallowRef<InstanceType<typeof MkModalWindow>>();
|
|
|
|
|
|
|
|
let note = $ref<misskey.entities.Note>();
|
|
|
|
let tab = $ref<string>();
|
|
|
|
let reactions = $ref<string[]>();
|
|
|
|
let users = $ref();
|
|
|
|
|
|
|
|
watch($$(tab), async () => {
|
|
|
|
const res = await os.api('notes/reactions', {
|
|
|
|
noteId: props.noteId,
|
|
|
|
type: tab,
|
|
|
|
limit: 30,
|
|
|
|
});
|
|
|
|
|
|
|
|
users = res.map(x => x.user);
|
|
|
|
});
|
|
|
|
|
|
|
|
onMounted(() => {
|
|
|
|
os.api('notes/show', {
|
|
|
|
noteId: props.noteId,
|
|
|
|
}).then((res) => {
|
|
|
|
reactions = Object.keys(res.reactions);
|
|
|
|
tab = reactions[0];
|
|
|
|
note = res;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.tabs {
|
|
|
|
display: flex;
|
|
|
|
gap: 8px;
|
|
|
|
flex-wrap: wrap;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tab {
|
|
|
|
padding: 4px 6px;
|
|
|
|
border: solid 1px var(--divider);
|
|
|
|
border-radius: 6px;
|
|
|
|
}
|
|
|
|
|
|
|
|
.tabActive {
|
|
|
|
border-color: var(--accent);
|
|
|
|
}
|
|
|
|
</style>
|