frontend/app/components/notes/content.vue

38 lines
1.4 KiB
Vue
Raw Normal View History

2024-11-30 02:19:32 +01:00
<template>
<ContentWarning v-if="(sensitive || contentWarning) && preferences.show_content_warning" :content-warning="contentWarning" v-model="blurred" />
2024-12-07 15:16:45 +01:00
<OverflowGuard v-if="content" :character-count="characterCount" :class="(blurred && preferences.show_content_warning) && 'blur-md'">
2025-04-10 14:48:03 +02:00
<Prose v-html="content" v-render-emojis="emojis"></Prose>
</OverflowGuard>
2024-11-30 16:39:02 +01:00
<Attachments v-if="attachments.length > 0" :attachments="attachments" :class="(blurred && preferences.show_content_warning) && 'blur-xl'" />
2024-11-30 19:15:23 +01:00
<div v-if="quote" class="mt-4 rounded border overflow-hidden">
2024-11-30 16:39:02 +01:00
<Note :note="quote" :hide-actions="true" :small-layout="true" />
</div>
2024-11-30 02:19:32 +01:00
</template>
<script lang="ts" setup>
import type { Attachment, CustomEmoji, Status } from "@versia/client/schemas";
import type { z } from "zod";
import Attachments from "./attachments.vue";
2025-04-10 14:48:03 +02:00
import ContentWarning from "./content-warning.vue";
2024-11-30 16:39:02 +01:00
import Note from "./note.vue";
2025-04-10 14:48:03 +02:00
import OverflowGuard from "./overflow-guard.vue";
import Prose from "./prose.vue";
2024-11-30 16:39:02 +01:00
2024-12-07 15:16:45 +01:00
const { content, plainContent, sensitive, contentWarning } = defineProps<{
plainContent?: string;
2024-11-30 02:19:32 +01:00
content: string;
quote?: NonNullable<z.infer<typeof Status.shape.quote>>;
emojis: z.infer<typeof CustomEmoji>[];
attachments: z.infer<typeof Attachment>[];
2024-12-07 15:16:45 +01:00
sensitive: boolean;
contentWarning?: string;
2024-11-30 02:19:32 +01:00
}>();
2025-04-10 14:48:03 +02:00
2024-12-07 15:16:45 +01:00
const blurred = ref(sensitive || !!contentWarning);
const characterCount = plainContent?.length;
2024-11-30 02:19:32 +01:00
</script>