feat: Add reply header rendering in notes

This commit is contained in:
Jesse Wierzbinski 2024-05-11 16:33:40 -10:00
parent e90ff9d508
commit dd62647928
No known key found for this signature in database
6 changed files with 40 additions and 10 deletions

View file

@ -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;
};

View file

@ -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,
};