2024-04-15 03:16:57 +02:00
|
|
|
<template>
|
2024-12-02 22:29:08 +01:00
|
|
|
<div v-if="loaded" class="mx-auto max-w-2xl w-full pb-72 *:rounded space-y-4 *:border *:border-border/50">
|
2024-12-01 17:26:51 +01:00
|
|
|
<Note v-for="note of context?.ancestors" :note="note" />
|
2024-12-02 22:29:08 +01:00
|
|
|
<Note v-if="note" :note="note" />
|
2024-12-01 17:26:51 +01:00
|
|
|
<Note v-for="note of context?.descendants" :note="note" />
|
2024-06-15 23:18:58 +02:00
|
|
|
</div>
|
2024-12-02 22:29:08 +01:00
|
|
|
|
|
|
|
|
<div v-else class="p-4 flex items-center justify-center h-48">
|
|
|
|
|
<Loader class="size-8 animate-spin" />
|
|
|
|
|
</div>
|
2024-04-15 03:16:57 +02:00
|
|
|
</template>
|
|
|
|
|
|
|
|
|
|
<script setup lang="ts">
|
2024-12-02 22:29:08 +01:00
|
|
|
import { Loader } from "lucide-vue-next";
|
2024-12-01 17:26:51 +01:00
|
|
|
import Note from "~/components/notes/note.vue";
|
2024-12-07 22:17:22 +01:00
|
|
|
import * as m from "~/paraglide/messages.js";
|
2024-06-21 04:09:09 +02:00
|
|
|
|
2024-04-28 09:46:05 +02:00
|
|
|
definePageMeta({
|
|
|
|
|
layout: "app",
|
2024-12-04 15:17:47 +01:00
|
|
|
breadcrumbs: [
|
|
|
|
|
{
|
2024-12-07 22:17:22 +01:00
|
|
|
text: m.chunky_awake_mallard_grow(),
|
2024-12-04 15:17:47 +01:00
|
|
|
},
|
|
|
|
|
],
|
2024-04-29 01:48:03 +02:00
|
|
|
});
|
2024-04-15 03:16:57 +02:00
|
|
|
|
2024-05-12 05:42:24 +02:00
|
|
|
const element = ref<HTMLElement | null>(null);
|
2024-04-15 03:16:57 +02:00
|
|
|
const route = useRoute();
|
2024-04-25 08:56:01 +02:00
|
|
|
const uuid = route.params.uuid as string;
|
2024-04-15 03:16:57 +02:00
|
|
|
|
2024-04-27 03:28:12 +02:00
|
|
|
const note = useNote(client, uuid);
|
2024-05-12 05:42:24 +02:00
|
|
|
const noteId = computed(() => note.value?.id ?? null);
|
|
|
|
|
const context = useNoteContext(client, noteId);
|
|
|
|
|
const loaded = computed(() => note.value !== null && context.value !== null);
|
|
|
|
|
|
|
|
|
|
// If ancestors changes, scroll down so that the initial note stays at the same place
|
|
|
|
|
watch(
|
|
|
|
|
[() => context.value?.ancestors, loaded],
|
|
|
|
|
async () => {
|
2024-06-20 02:07:56 +02:00
|
|
|
if (context.value?.ancestors.length === 0) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
if (!loaded.value) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
2024-05-12 05:42:24 +02:00
|
|
|
await nextTick();
|
|
|
|
|
// Wait for 200ms
|
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, 200));
|
|
|
|
|
element.value?.scrollIntoView({
|
|
|
|
|
behavior: "smooth",
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
{
|
|
|
|
|
immediate: true,
|
|
|
|
|
},
|
|
|
|
|
);
|
2024-04-26 07:54:02 +02:00
|
|
|
|
2024-12-07 11:21:13 +01:00
|
|
|
useSeoMeta({
|
|
|
|
|
title: computed(() =>
|
2024-12-07 22:17:22 +01:00
|
|
|
note.value
|
|
|
|
|
? note.value.account.display_name
|
|
|
|
|
: m.steep_sour_warthog_aim(),
|
2024-12-07 11:21:13 +01:00
|
|
|
),
|
|
|
|
|
description: computed(() => (note.value ? note.value.content : undefined)),
|
|
|
|
|
ogImage: computed(() =>
|
|
|
|
|
note.value ? note.value.media_attachments[0]?.preview_url : undefined,
|
|
|
|
|
),
|
2024-06-21 08:01:33 +02:00
|
|
|
robots: computed(() => ({
|
|
|
|
|
noindex: !!note.value?.account.noindex,
|
|
|
|
|
nofollow: !!note.value?.account.noindex,
|
|
|
|
|
noarchive: !!note.value?.account.noindex,
|
|
|
|
|
noimageindex: !!note.value?.account.noindex,
|
|
|
|
|
})),
|
2024-04-26 07:54:02 +02:00
|
|
|
});
|
2024-04-22 09:38:51 +02:00
|
|
|
</script>
|