Preview existing replies in tooltip when hovering reply button

This commit is contained in:
Michcio 2022-09-06 13:09:47 +02:00
parent 427e36e7ec
commit 7e635d23d3

View file

@ -70,7 +70,7 @@
</div>
<footer class="footer">
<XReactionsViewer ref="reactionsViewer" :note="appearNote"/>
<button class="button _button" @click="reply()">
<button ref="replyButton" class="button _button" @click="reply()">
<template v-if="appearNote.reply"><i class="fas fa-reply-all"></i></template>
<template v-else><i class="fas fa-reply"></i></template>
<p v-if="appearNote.repliesCount > 0" class="count">{{ appearNote.repliesCount }}</p>
@ -160,6 +160,7 @@ const isRenote = (
const el = ref<HTMLElement>();
const menuButton = ref<HTMLElement>();
const replyButton = ref<HTMLElement>();
const renoteButton = ref<InstanceType<typeof XRenoteButton>>();
const renoteTime = ref<HTMLElement>();
const reactButton = ref<HTMLElement>();
@ -208,6 +209,18 @@ useTooltip(parentReply, async (showing) => {
}, {}, 'closed');
});
useTooltip(replyButton, async (showing) => {
const replies = await os.api('notes/replies', {
noteId: appearNote.id,
});
os.popup(NoteTooltip, {
showing,
notes: replies,
targetElement: replyButton.value,
}, {}, 'closed');
});
function reply(viaKeyboard = false): void {
pleaseLogin();
os.post({