magnetar/fe_calckey/frontend/client/src/components/MkReactionsViewer.vue

50 lines
1.3 KiB
Vue

<template>
<div class="tdflqwzn" :class="{ isMe }">
<XReaction
v-for="r in Array.isArray(note.reactions)
? note.reactions
: Object.entries(note.reactions)"
:key="magReactionPairToLegacy(r)[0]"
:reaction="magReactionPairToLegacy(r)[0]"
:count="magReactionPairToLegacy(r)[1]"
:is-initial="initialReactions.has(magReactionPairToLegacy(r)[0])"
:note="note"
/>
</div>
</template>
<script lang="ts" setup>
import { computed } from "vue";
import * as misskey from "calckey-js";
import { $i } from "@/account";
import XReaction from "@/components/MkReactionsViewer.reaction.vue";
import { packed } from "magnetar-common";
import { magReactionPairToLegacy } from "@/scripts-mag/mag-util";
const props = defineProps<{
note: packed.PackNoteMaybeFull | misskey.entities.Note;
}>();
const initialReactions = new Set(Object.keys(props.note.reactions));
const isMe = computed(() => $i && $i.id === props.note.user.id);
</script>
<style lang="scss" scoped>
.tdflqwzn {
margin-inline: -2px;
margin-top: 0.2em;
width: 100%;
&:empty {
display: none;
}
&.isMe {
> span {
cursor: default !important;
}
}
}
</style>