mirror of
https://github.com/versia-pub/frontend.git
synced 2026-03-13 03:29:16 +01:00
feat: ✨ Add reply header rendering in notes
This commit is contained in:
parent
e90ff9d508
commit
dd62647928
6 changed files with 40 additions and 10 deletions
|
|
@ -3,7 +3,7 @@ import type { Account } from "~/types/mastodon/account";
|
|||
|
||||
export const useAccount = (
|
||||
client: MaybeRef<Mastodon | null>,
|
||||
accountId: string,
|
||||
accountId: MaybeRef<string | null>,
|
||||
) => {
|
||||
if (!client) {
|
||||
return ref(null as Account | null);
|
||||
|
|
@ -11,11 +11,14 @@ export const useAccount = (
|
|||
|
||||
const output = ref(null as Account | null);
|
||||
|
||||
ref(client)
|
||||
.value?.getAccount(accountId)
|
||||
.then((res) => {
|
||||
output.value = res.data;
|
||||
});
|
||||
watchEffect(() => {
|
||||
if (toValue(accountId))
|
||||
ref(client)
|
||||
.value?.getAccount(toValue(accountId) ?? "")
|
||||
.then((res) => {
|
||||
output.value = res.data;
|
||||
});
|
||||
});
|
||||
|
||||
return output;
|
||||
};
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ export const useNoteData = (
|
|||
noteProp: MaybeRef<Status | undefined>,
|
||||
client: Ref<Mastodon | null>,
|
||||
) => {
|
||||
const isReply = computed(() => !!toValue(noteProp)?.in_reply_to_id);
|
||||
const isQuote = computed(() => !!toValue(noteProp)?.quote);
|
||||
const isReblog = computed(
|
||||
() => !isQuote.value && !!toValue(noteProp)?.reblog,
|
||||
|
|
@ -54,7 +55,7 @@ export const useNoteData = (
|
|||
);
|
||||
|
||||
if (result?.data) {
|
||||
useEvent("note:delete", result.data);
|
||||
useEvent("note:delete", result.data as Status);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
@ -66,6 +67,7 @@ export const useNoteData = (
|
|||
reblog,
|
||||
reblogDisplayName,
|
||||
shouldHide,
|
||||
isReply,
|
||||
url,
|
||||
remove,
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue