2024-09-09 11:57:36 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
|
|
|
<template>
|
|
|
|
<div :class="[$style.root, { [$style.collapsed]: collapsed }]">
|
|
|
|
<div>
|
|
|
|
<span v-if="note.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
|
|
|
<span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deletedNote }})</span>
|
|
|
|
<EmA v-if="note.replyId" :class="$style.reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></EmA>
|
|
|
|
<EmMfm v-if="note.text" :text="note.text" :author="note.user" :nyaize="'respect'" :emojiUrls="note.emojis"/>
|
|
|
|
<EmA v-if="note.renoteId" :class="$style.rp" :to="`/notes/${note.renoteId}`">RN: ...</EmA>
|
|
|
|
</div>
|
|
|
|
<details v-if="note.files && note.files.length > 0">
|
|
|
|
<summary>({{ i18n.tsx.withNFiles({ n: note.files.length }) }})</summary>
|
|
|
|
<EmMediaList :mediaList="note.files" :originalEntityUrl="`${url}/notes/${note.id}`"/>
|
|
|
|
</details>
|
|
|
|
<details v-if="note.poll">
|
|
|
|
<summary>{{ i18n.ts.poll }}</summary>
|
|
|
|
<EmPoll :noteId="note.id" :poll="note.poll"/>
|
|
|
|
</details>
|
|
|
|
<button v-if="isLong && collapsed" :class="$style.fade" class="_button" @click="collapsed = false">
|
|
|
|
<span :class="$style.fadeLabel">{{ i18n.ts.showMore }}</span>
|
|
|
|
</button>
|
|
|
|
<button v-else-if="isLong && !collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
|
|
|
|
<span :class="$style.showLessLabel">{{ i18n.ts.showLess }}</span>
|
|
|
|
</button>
|
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
|
|
|
<script lang="ts" setup>
|
|
|
|
import { ref } from 'vue';
|
|
|
|
import * as Misskey from 'misskey-js';
|
|
|
|
import EmMediaList from '@/components/EmMediaList.vue';
|
|
|
|
import EmPoll from '@/components/EmPoll.vue';
|
|
|
|
import { i18n } from '@/i18n.js';
|
2024-09-10 09:39:53 +00:00
|
|
|
import { url } from '@@/js/config.js';
|
|
|
|
import { shouldCollapsed } from '@@/js/collapsed.js';
|
2024-09-09 13:44:39 +00:00
|
|
|
import EmA from '@/components/EmA.vue';
|
2024-09-09 11:57:36 +00:00
|
|
|
import EmMfm from '@/components/EmMfm.js';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
note: Misskey.entities.Note;
|
|
|
|
}>();
|
|
|
|
|
|
|
|
const isLong = shouldCollapsed(props.note, []);
|
|
|
|
|
|
|
|
const collapsed = ref(isLong);
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
|
|
|
overflow-wrap: break-word;
|
|
|
|
|
|
|
|
&.collapsed {
|
|
|
|
position: relative;
|
|
|
|
max-height: 9em;
|
|
|
|
overflow: clip;
|
|
|
|
|
|
|
|
> .fade {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 64px;
|
2024-10-09 09:08:14 +00:00
|
|
|
background: linear-gradient(0deg, var(--MI_THEME-panel), color(from var(--MI_THEME-panel) srgb r g b / 0));
|
2024-09-09 11:57:36 +00:00
|
|
|
|
|
|
|
> .fadeLabel {
|
|
|
|
display: inline-block;
|
2024-10-09 09:08:14 +00:00
|
|
|
background: var(--MI_THEME-panel);
|
2024-09-09 11:57:36 +00:00
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
> .fadeLabel {
|
2024-10-09 09:08:14 +00:00
|
|
|
background: var(--MI_THEME-panelHighlight);
|
2024-09-09 11:57:36 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
.reply {
|
|
|
|
margin-right: 6px;
|
2024-10-09 09:08:14 +00:00
|
|
|
color: var(--MI_THEME-accent);
|
2024-09-09 11:57:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.rp {
|
|
|
|
margin-left: 4px;
|
|
|
|
font-style: oblique;
|
2024-10-09 09:08:14 +00:00
|
|
|
color: var(--MI_THEME-renote);
|
2024-09-09 11:57:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
.showLess {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 14px;
|
|
|
|
position: sticky;
|
|
|
|
bottom: calc(var(--stickyBottom, 0px) + 14px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.showLessLabel {
|
|
|
|
display: inline-block;
|
2024-10-09 09:08:14 +00:00
|
|
|
background: var(--MI_THEME-popup);
|
2024-09-09 11:57:36 +00:00
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
</style>
|