12
12
<span ><strong v-html =" reblogDisplayName" ></strong > reblogged</span >
13
13
</Skeleton >
14
14
</div >
15
- <SocialElementsNotesReplyHeader v-if =" isReply" :account_id =" note ?.in_reply_to_account_id ?? null" />
16
- <SocialElementsNotesHeader :note =" note " :small =" small" />
17
- <LazySocialElementsNotesNoteContent :note =" note " :loaded =" loaded" :url =" url" :content =" content"
15
+ <SocialElementsNotesReplyHeader v-if =" isReply" :account_id =" outputtedNote ?.in_reply_to_account_id ?? null" />
16
+ <SocialElementsNotesHeader :note =" outputtedNote " :small =" small" />
17
+ <LazySocialElementsNotesNoteContent :note =" outputtedNote " :loaded =" loaded" :url =" url" :content =" content"
18
18
:is-quote =" isQuote" :should-hide =" shouldHide" />
19
19
<Skeleton class =" !h-10 w-full mt-6" :enabled =" !props.note || !loaded" v-if =" !small || !showInteractions" >
20
20
<div v-if =" showInteractions"
21
21
class =" mt-6 flex flex-row items-stretch disabled:*:opacity-70 [& >button]:max-w-28 disabled:*:cursor-not-allowed relative justify-around text-sm h-10 hover:enabled:[& >button]:bg-dark-800 [& >button]:duration-200 [& >button]:rounded [& >button]:flex [& >button]:flex-1 [& >button]:flex-row [& >button]:items-center [& >button]:justify-center" >
22
- <button class =" group" @click =" note && useEvent('note:reply', note)" :disabled =" !isSignedIn" >
22
+ <button class =" group" @click =" outputtedNote && useEvent('note:reply', outputtedNote)"
23
+ :disabled =" !isSignedIn" >
23
24
<iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:arrow-back-up"
24
25
class =" text-gray-200 group-hover:group-enabled:text-blue-600" aria-hidden =" true" />
25
- <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(note ?.replies_count) }}</span >
26
+ <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(outputtedNote ?.replies_count) }}</span >
26
27
</button >
27
28
<button class =" group" @click =" likeFn" :disabled =" !isSignedIn" >
28
- <iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:heart" v-if =" !note ?.favourited"
29
+ <iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:heart" v-if =" !outputtedNote ?.favourited"
29
30
class =" size-5 text-gray-200 group-hover:group-enabled:text-pink-600" aria-hidden =" true" />
30
31
<iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:heart-filled" v-else
31
32
class =" size-5 text-pink-600 group-hover:group-enabled:text-gray-200" aria-hidden =" true" />
32
- <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(note ?.favourites_count) }}</span >
33
+ <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(outputtedNote ?.favourites_count) }}</span >
33
34
</button >
34
35
<button class =" group" @click =" reblogFn" :disabled =" !isSignedIn" >
35
- <iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:repeat" v-if =" !note ?.reblogged"
36
+ <iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:repeat" v-if =" !outputtedNote ?.reblogged"
36
37
class =" size-5 text-gray-200 group-hover:group-enabled:text-green-600" aria-hidden =" true" />
37
38
<iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:repeat" v-else
38
39
class =" size-5 text-green-600 group-hover:group-enabled:text-gray-200" aria-hidden =" true" />
39
- <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(note ?.reblogs_count) }}</span >
40
+ <span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(outputtedNote ?.reblogs_count) }}</span >
40
41
</button >
41
- <button class =" group" @click =" note && useEvent('note:quote', note)" :disabled =" !isSignedIn" >
42
+ <button class =" group" @click =" outputtedNote && useEvent('note:quote', outputtedNote)"
43
+ :disabled =" !isSignedIn" >
42
44
<iconify-icon width =" 1.25rem" height =" 1.25rem" icon =" tabler:quote"
43
45
class =" size-5 text-gray-200 group-hover:group-enabled:text-blue-600" aria-hidden =" true" />
44
46
<span class =" text-gray-400 mt-0.5 ml-2" >{{ numberFormat(0) }}</span >
51
53
</template >
52
54
53
55
<template #items >
56
+ <Menu .Item value =" " v-if =" isSignedIn && outputtedNote?.account.id === me?.id" >
57
+ <ButtonsDropdownElement @click =" outputtedNote && useEvent('note:edit', outputtedNote)"
58
+ icon =" tabler:pencil" class =" w-full" >
59
+ Edit
60
+ </ButtonsDropdownElement >
61
+ </Menu .Item >
54
62
<Menu .Item value =" " >
55
- <ButtonsDropdownElement @click =" copy(JSON.stringify(note , null, 4))" icon = " tabler:code "
56
- class =" w-full" >
63
+ <ButtonsDropdownElement @click =" copy(JSON.stringify(outputtedNote , null, 4))"
64
+ icon = " tabler:code " class =" w-full" >
57
65
Copy API
58
66
Response
59
67
</ButtonsDropdownElement >
@@ -95,12 +103,19 @@ const props = withDefaults(
95
103
96
104
const noteRef = ref (props .note );
97
105
106
+ useListen (" composer:send-edit" , (note ) => {
107
+ if (note .id === noteRef .value ?.id ) {
108
+ noteRef .value = note ;
109
+ }
110
+ });
111
+
98
112
const tokenData = useTokenData ();
99
113
const isSignedIn = useSignedIn ();
114
+ const me = useMe ();
100
115
const client = useMegalodon (tokenData );
101
116
const {
102
117
loaded,
103
- note,
118
+ note : outputtedNote ,
104
119
remove,
105
120
content,
106
121
shouldHide,
@@ -120,15 +135,19 @@ const numberFormat = (number = 0) =>
120
135
}).format (number );
121
136
122
137
const likeFn = async () => {
123
- if (! note .value ) return ;
124
- if (note .value .favourited ) {
125
- const output = await client .value ?.unfavouriteStatus (note .value .id );
138
+ if (! outputtedNote .value ) return ;
139
+ if (outputtedNote .value .favourited ) {
140
+ const output = await client .value ?.unfavouriteStatus (
141
+ outputtedNote .value .id ,
142
+ );
126
143
127
144
if (output ?.data ) {
128
145
noteRef .value = output .data ;
129
146
}
130
147
} else {
131
- const output = await client .value ?.favouriteStatus (note .value .id );
148
+ const output = await client .value ?.favouriteStatus (
149
+ outputtedNote .value .id ,
150
+ );
132
151
133
152
if (output ?.data ) {
134
153
noteRef .value = output .data ;
@@ -137,15 +156,17 @@ const likeFn = async () => {
137
156
};
138
157
139
158
const reblogFn = async () => {
140
- if (! note .value ) return ;
141
- if (note .value ?.reblogged ) {
142
- const output = await client .value ?.unreblogStatus (note .value .id );
159
+ if (! outputtedNote .value ) return ;
160
+ if (outputtedNote .value ?.reblogged ) {
161
+ const output = await client .value ?.unreblogStatus (
162
+ outputtedNote .value .id ,
163
+ );
143
164
144
165
if (output ?.data ) {
145
166
noteRef .value = output .data ;
146
167
}
147
168
} else {
148
- const output = await client .value ?.reblogStatus (note .value .id );
169
+ const output = await client .value ?.reblogStatus (outputtedNote .value .id );
149
170
150
171
if (output ?.data .reblog ) {
151
172
noteRef .value = output .data .reblog ;
0 commit comments