From 5e166101e32b836d16abe8e6f03db3d3b97c4372 Mon Sep 17 00:00:00 2001 From: Mar0xy Date: Fri, 3 Nov 2023 15:43:52 +0100 Subject: [PATCH] fix: tooltips missing --- packages/frontend/src/components/MkNote.vue | 67 ++++++++++++++++----- 1 file changed, 53 insertions(+), 14 deletions(-) diff --git a/packages/frontend/src/components/MkNote.vue b/packages/frontend/src/components/MkNote.vue index e267560db..32894533d 100644 --- a/packages/frontend/src/components/MkNote.vue +++ b/packages/frontend/src/components/MkNote.vue @@ -288,23 +288,62 @@ if (props.mock) { }); } -if ($i && !props.mock) { - os.api("notes/renotes", { - noteId: appearNote.id, - userId: $i.id, - limit: 1, - }).then((res) => { - renoted.value = res.length > 0; +if (!props.mock) { + useTooltip(renoteButton, async (showing) => { + const renotes = await os.api('notes/renotes', { + noteId: appearNote.id, + limit: 11, + }); + + const users = renotes.map(x => x.user); + + if (users.length < 1) return; + + os.popup(MkUsersTooltip, { + showing, + users, + count: appearNote.renoteCount, + targetElement: renoteButton.value, + }, {}, 'closed'); }); - os.api("notes/renotes", { - noteId: appearNote.id, - userId: $i.id, - limit: 1, - quote: true, - }).then((res) => { - quoted.value = res.length > 0; + useTooltip(quoteButton, async (showing) => { + const renotes = await os.api('notes/renotes', { + noteId: appearNote.id, + limit: 11, + quote: true, + }); + + const users = renotes.map(x => x.user); + + if (users.length < 1) return; + + os.popup(MkUsersTooltip, { + showing, + users, + count: appearNote.renoteCount, + targetElement: quoteButton.value, + }, {}, 'closed'); }); + + if ($i) { + os.api("notes/renotes", { + noteId: appearNote.id, + userId: $i.id, + limit: 1, + }).then((res) => { + renoted.value = res.length > 0; + }); + + os.api("notes/renotes", { + noteId: appearNote.id, + userId: $i.id, + limit: 1, + quote: true, + }).then((res) => { + quoted.value = res.length > 0; + }); + } } type Visibility = 'public' | 'home' | 'followers' | 'specified';