diff --git a/app/components/notes/actions.vue b/app/components/notes/actions.vue index 075a674..c21fb6f 100644 --- a/app/components/notes/actions.vue +++ b/app/components/notes/actions.vue @@ -6,7 +6,7 @@ :title="m.drab_tense_turtle_comfort()" :disabled="!authStore.isSignedIn" > - {{ numberFormat(replyCount) }} + {{ numberFormat(note.replies_count) }} - {{ numberFormat(likeCount) }} + {{ numberFormat(note.favourites_count) }} - {{ numberFormat(reblogCount) }} + {{ numberFormat(note.reblogs_count) }} (); +// biome-ignore lint/style/noNonNullAssertion: We want an error if not provided +const { note } = inject(key)!; const emit = defineEmits<{ edit: []; @@ -78,6 +68,9 @@ const emit = defineEmits<{ const { play } = useAudio(); const authStore = useAuthStore(); +const liked = note.favourited ?? false; +const reblogged = note.reblogged ?? false; + const like = async () => { if (preferences.confirm_actions.value.includes("like")) { const confirmation = await confirmModalService.confirm({ @@ -94,7 +87,7 @@ const like = async () => { play("like"); const id = toast.loading(m.slimy_candid_tiger_read()); - const { data } = await authStore.client.favouriteStatus(noteId); + const { data } = await authStore.client.favouriteStatus(note.id); toast.dismiss(id); toast.success(m.mealy_slow_buzzard_commend()); useEvent("note:edit", data); @@ -115,7 +108,7 @@ const unlike = async () => { } const id = toast.loading(m.busy_active_leopard_strive()); - const { data } = await authStore.client.unfavouriteStatus(noteId); + const { data } = await authStore.client.unfavouriteStatus(note.id); toast.dismiss(id); toast.success(m.fresh_direct_bear_affirm()); useEvent("note:edit", data); @@ -136,7 +129,7 @@ const reblog = async () => { } const id = toast.loading(m.late_sunny_cobra_scold()); - const { data } = await authStore.client.reblogStatus(noteId); + const { data } = await authStore.client.reblogStatus(note.id); toast.dismiss(id); toast.success(m.weird_moving_hawk_lift()); useEvent( @@ -160,7 +153,7 @@ const unreblog = async () => { } const id = toast.loading(m.white_sharp_gorilla_embrace()); - const { data } = await authStore.client.unreblogStatus(noteId); + const { data } = await authStore.client.unreblogStatus(note.id); toast.dismiss(id); toast.success(m.royal_polite_moose_catch()); useEvent("note:edit", data); @@ -172,7 +165,7 @@ const react = async (emoji: z.infer | UnicodeEmoji) => { ? (emoji as UnicodeEmoji).unicode : `:${(emoji as z.infer).shortcode}:`; - const { data } = await authStore.client.createEmojiReaction(noteId, text); + const { data } = await authStore.client.createEmojiReaction(note.id, text); toast.dismiss(id); toast.success(m.main_least_turtle_fall()); diff --git a/app/components/notes/content-warning.vue b/app/components/notes/content-warning.vue index 444c94a..1742169 100644 --- a/app/components/notes/content-warning.vue +++ b/app/components/notes/content-warning.vue @@ -1,7 +1,7 @@ @@ -21,14 +19,33 @@ diff --git a/app/components/notes/content.vue b/app/components/notes/content.vue index 2f5be2c..6ef91b2 100644 --- a/app/components/notes/content.vue +++ b/app/components/notes/content.vue @@ -1,51 +1,40 @@ diff --git a/app/components/notes/header.vue b/app/components/notes/header.vue index 029571e..c3d5c5d 100644 --- a/app/components/notes/header.vue +++ b/app/components/notes/header.vue @@ -2,14 +2,17 @@
- +
{{ author.display_name }}{{ note.account.display_name }}
- + @@ -41,36 +35,25 @@ diff --git a/app/components/notes/menu.vue b/app/components/notes/menu.vue index b77fa72..6ac1c89 100644 --- a/app/components/notes/menu.vue +++ b/app/components/notes/menu.vue @@ -21,15 +21,10 @@ import { } from "@/components/ui/dropdown-menu"; import { confirmModalService } from "~/components/modals/composable.ts"; import * as m from "~~/paraglide/messages.js"; +import { key } from "./provider"; -const { authorId, noteId } = defineProps<{ - apiNoteString: string; - isRemote: boolean; - url: string; - remoteUrl?: string; - authorId: string; - noteId: string; -}>(); +// biome-ignore lint/style/noNonNullAssertion: We want an error if not provided +const { note, isRemote } = inject(key)!; const emit = defineEmits<{ edit: []; @@ -38,7 +33,9 @@ const emit = defineEmits<{ const { copy } = useClipboard(); const authStore = useAuthStore(); -const authorIsMe = authStore.isSignedIn && authorId === authStore.account?.id; +const url = wrapUrl(`/@${note.account.acct}/${note.id}`); +const authorIsMe = + authStore.isSignedIn && note.account.id === authStore.account?.id; const copyText = (text: string) => { copy(text); @@ -68,7 +65,7 @@ const _delete = async () => { } const id = toast.loading(m.new_funny_fox_boil()); - await authStore.client.deleteStatus(noteId); + await authStore.client.deleteStatus(note.id); toast.dismiss(id); toast.success(m.green_tasty_bumblebee_beam()); @@ -91,11 +88,14 @@ const _delete = async () => { {{ m.front_lime_grizzly_persist() }} - + {{ m.yummy_moving_scallop_sail() }} - + {{ m.sunny_zany_jellyfish_pop() }} @@ -108,8 +108,8 @@ const _delete = async () => { {{ m.solid_witty_zebra_walk() }} @@ -119,7 +119,7 @@ const _delete = async () => { v-if="isRemote" target="_blank" rel="noopener noreferrer" - :href="remoteUrl" + :href="note.url" > {{ m.active_trite_lark_inspire() }} @@ -142,7 +142,10 @@ const _delete = async () => { {{ m.great_few_jaguar_rise() }} - + {{ m.misty_soft_sparrow_vent() }} diff --git a/app/components/notes/note.vue b/app/components/notes/note.vue index a7ed405..33b8ff6 100644 --- a/app/components/notes/note.vue +++ b/app/components/notes/note.vue @@ -8,63 +8,25 @@ class="absolute left-0 top-0 bottom-0 w-2 bg-border rounded-tl-md" /> - +
- + @@ -77,6 +39,7 @@ import { Card, CardContent, CardFooter, CardHeader } from "../ui/card"; import Actions from "./actions.vue"; import Content from "./content.vue"; import Header from "./header.vue"; +import { key } from "./provider"; import Reactions from "./reactions/index.vue"; import ReblogHeader from "./reblog-header.vue"; @@ -99,8 +62,9 @@ const noteToUse = computed(() => : (note as z.infer), ); -const url = wrapUrl(`/@${noteToUse.value.account.acct}/${noteToUse.value.id}`); -const accountUrl = wrapUrl(`/@${noteToUse.value.account.acct}`); -const reblogAccountUrl = wrapUrl(`/@${note.account.acct}`); -const isRemote = noteToUse.value.account.acct.includes("@"); +provide(key, { + note: noteToUse.value, + rebloggerNote: note.reblog ? (note as z.infer) : undefined, + isRemote: noteToUse.value.account.acct.includes("@"), +}); diff --git a/app/components/notes/prose.vue b/app/components/notes/prose.vue index b951c15..ed17c64 100644 --- a/app/components/notes/prose.vue +++ b/app/components/notes/prose.vue @@ -1,7 +1,7 @@ diff --git a/app/components/timelines/timeline.vue b/app/components/timelines/timeline.vue index fd50c5a..2e9b000 100644 --- a/app/components/timelines/timeline.vue +++ b/app/components/timelines/timeline.vue @@ -60,7 +60,7 @@ const props = defineProps<{ const emit = defineEmits<(e: "update") => void>(); -const loadMoreTrigger = ref(null); +const loadMoreTrigger = useTemplateRef("loadMoreTrigger"); useIntersectionObserver(loadMoreTrigger, ([observer]) => { if (observer?.isIntersecting && !props.isLoading && !props.hasReachedEnd) {