2022-12-26 16:37:42 +09:00
|
|
|
<script setup lang="ts">
|
|
|
|
import type { FilterContext, Status } from 'masto'
|
|
|
|
|
|
|
|
const { status, context } = defineProps<{
|
|
|
|
status: Status
|
|
|
|
context?: FilterContext | 'details'
|
|
|
|
}>()
|
|
|
|
|
|
|
|
const isDM = $computed(() => status.visibility === 'direct')
|
|
|
|
const isDetails = $computed(() => context === 'details')
|
|
|
|
|
|
|
|
// Content Filter logic
|
|
|
|
const filterResult = $computed(() => status.filtered?.length ? status.filtered[0] : null)
|
|
|
|
const filter = $computed(() => filterResult?.filter)
|
|
|
|
|
|
|
|
// a bit of a hack due to Filter being different in v1 and v2
|
|
|
|
// clean up when masto.js supports explicit versions: https://github.com/neet/masto.js/issues/722
|
|
|
|
const filterPhrase = $computed(() => filter?.phrase || (filter as any)?.title)
|
|
|
|
const isFiltered = $computed(() => filterPhrase && (context && context !== 'details' ? filter?.context.includes(context) : false))
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div
|
|
|
|
space-y-3
|
|
|
|
:class="{
|
2023-01-02 04:20:13 +09:00
|
|
|
'pt2 pb0.5 px3.5 bg-fade border-1 border-primary-light rounded-5 mx--1': isDM,
|
|
|
|
'ms--3.5 mt--1': isDM && context !== 'details',
|
2022-12-26 16:37:42 +09:00
|
|
|
}"
|
|
|
|
>
|
2022-12-30 01:31:04 +09:00
|
|
|
<StatusBody v-if="!isFiltered && status.sensitive && !status.spoilerText" :status="status" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" />
|
2022-12-26 16:37:42 +09:00
|
|
|
<StatusSpoiler :enabled="status.sensitive || isFiltered" :filter="isFiltered">
|
2022-12-30 01:31:04 +09:00
|
|
|
<template v-if="filterPhrase" #spoiler>
|
|
|
|
<p>{{ `${$t('status.filter_hidden_phrase')}: ${filterPhrase}` }}</p>
|
2022-12-26 16:37:42 +09:00
|
|
|
</template>
|
2022-12-30 01:31:04 +09:00
|
|
|
<template v-else-if="status.spoilerText" #spoiler>
|
|
|
|
<p>{{ status.spoilerText }}</p>
|
|
|
|
</template>
|
|
|
|
<StatusBody v-if="!status.sensitive || status.spoilerText" :status="status" :with-action="!isDetails" :class="isDetails ? 'text-xl' : ''" />
|
2022-12-28 20:49:47 +09:00
|
|
|
<StatusPoll v-if="status.poll" :status="status" />
|
2022-12-26 16:37:42 +09:00
|
|
|
<StatusMedia
|
|
|
|
v-if="status.mediaAttachments?.length"
|
|
|
|
:status="status"
|
|
|
|
/>
|
|
|
|
<StatusPreviewCard
|
|
|
|
v-if="status.card"
|
|
|
|
:card="status.card"
|
|
|
|
:small-picture-only="status.mediaAttachments?.length > 0"
|
|
|
|
/>
|
|
|
|
<StatusCard
|
|
|
|
v-if="status.reblog"
|
|
|
|
:status="status.reblog" border="~ rounded"
|
|
|
|
:actions="false"
|
|
|
|
/>
|
|
|
|
<div v-if="isDM" />
|
|
|
|
</StatusSpoiler>
|
|
|
|
</div>
|
|
|
|
</template>
|