fix: cleanup

This commit is contained in:
sim1222 2023-01-05 15:34:42 +09:00
parent b32e7ba445
commit 768894faf6
No known key found for this signature in database
GPG Key ID: 04EF48D01BEB0298

View File

@ -3,7 +3,7 @@
<MkModalWindow ref="dialog" :width="800" class="window" @close="dialog?.close()" @click="dialog?.close()" @closed="$emit('closed')"> <MkModalWindow ref="dialog" :width="800" class="window" @close="dialog?.close()" @click="dialog?.close()" @closed="$emit('closed')">
<template #header>リアクションリスト</template> <template #header>リアクションリスト</template>
<MkStickyContainer class="container"> <MkStickyContainer class="container">
<FormFolder v-for="x in tes" class="_gap"> <FormFolder v-for="x in reactUsers" class="_gap">
<template #label> <template #label>
<MkReactionIcon :reaction="x.type" :custom-emojis="note.emojis"/> <MkReactionIcon :reaction="x.type" :custom-emojis="note.emojis"/>
{{ x.type.replace("@.", "") }} {{ x.type.replace("@.", "") }}
@ -16,27 +16,22 @@
</MkA> </MkA>
</div> </div>
</FormFolder> </FormFolder>
<MkError v-if="tes.length === 0 && !fetching"/> <MkError v-if="reactUsers.length === 0 && !fetching"/>
</MkStickyContainer> </MkStickyContainer>
</MkModalWindow> </MkModalWindow>
</div> </div>
</template> </template>
<script lang="ts" setup> <script lang="ts" setup>
import { ref, watch, onMounted, onUnmounted } from 'vue'; import { ref, onMounted } from 'vue';
import * as misskey from 'misskey-js'; import * as misskey from 'misskey-js';
import { NoteReaction, UserLite } from 'misskey-js/built/entities'; import { NoteReaction, UserLite } from 'misskey-js/built/entities';
import { useNoteCapture } from '@/scripts/use-note-capture';
import MkFolder from '@/components/MkFolder.vue';
import FormFolder from '@/components/form/folder.vue'; import FormFolder from '@/components/form/folder.vue';
import MkUserCardMini from '@/components/MkUserCardMini.vue'; import MkUserCardMini from '@/components/MkUserCardMini.vue';
import MkReactionIcon from '@/components/MkReactionIcon.vue'; import MkReactionIcon from '@/components/MkReactionIcon.vue';
import MkModalWindow from '@/components/MkModalWindow.vue'; import MkModalWindow from '@/components/MkModalWindow.vue';
import * as os from '@/os'; import * as os from '@/os';
import XDetails from '@/components/MkReactionsViewer.details.vue';
import XReaction from '@/components/MkReactionsViewer.reaction.vue'; import XReaction from '@/components/MkReactionsViewer.reaction.vue';
import MkModal from '@/components/MkModal.vue';
import NotFound from "@/pages/not-found.vue";
const props = defineProps<{ const props = defineProps<{
note: misskey.entities.Note; note: misskey.entities.Note;
@ -50,10 +45,8 @@ type reactionUsers = {
const dialog = $ref<InstanceType<typeof MkModalWindow>>(); const dialog = $ref<InstanceType<typeof MkModalWindow>>();
const el = ref<HTMLElement>(); const el = ref<HTMLElement>();
const isDeleted = ref();
const reactions = ref([] as NoteReaction[]); const reactions = ref([] as NoteReaction[]);
const users = ref([] as UserLite[]); const reactUsers = ref([] as reactionUsers);
const tes = ref([] as reactionUsers);
const fetching = ref(true); const fetching = ref(true);
const initialReactions = new Set(Object.keys(props.note.reactions)); const initialReactions = new Set(Object.keys(props.note.reactions));
@ -71,7 +64,7 @@ onMounted(async () => {
type: reaction, type: reaction,
limit: 100, limit: 100,
}); });
tes.value.push({ reactUsers.value.push({
type: reaction, type: reaction,
count: count, count: count,
users: users.map(x => x.user), users: users.map(x => x.user),
@ -79,17 +72,7 @@ onMounted(async () => {
} }
}); });
const reload = defineEmits() // TODO:
const getUsers = async (reaction: string) => {
const reactions = await os.apiGet('notes/reactions', {
noteId: props.note.id,
type: reaction,
limit: 100,
});
return reactions.map(x => x.user);
};
// useNoteCapture({ // useNoteCapture({
// rootEl: el, // rootEl: el,
// note: $$(props.note), // note: $$(props.note),