2023-07-26 22:31:52 -07:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 11:37:25 -08:00
|
|
|
<template>
|
2023-01-13 22:05:23 -08:00
|
|
|
<div :class="[$style.root, { [$style.collapsed]: collapsed }]">
|
2023-06-01 01:19:46 -07:00
|
|
|
<div>
|
2022-07-20 06:24:26 -07:00
|
|
|
<span v-if="note.isHidden" style="opacity: 0.5">({{ i18n.ts.private }})</span>
|
|
|
|
<span v-if="note.deletedAt" style="opacity: 0.5">({{ i18n.ts.deleted }})</span>
|
2023-01-13 22:05:23 -08:00
|
|
|
<MkA v-if="note.replyId" :class="$style.reply" :to="`/notes/${note.replyId}`"><i class="ti ti-arrow-back-up"></i></MkA>
|
2023-05-18 21:58:09 -07:00
|
|
|
<Mfm v-if="note.text" :text="note.text" :author="note.user" :i="$i" :emojiUrls="note.emojis"/>
|
2023-01-13 22:05:23 -08:00
|
|
|
<MkA v-if="note.renoteId" :class="$style.rp" :to="`/notes/${note.renoteId}`">RN: ...</MkA>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
<details v-if="note.files.length > 0">
|
2023-03-31 22:01:57 -07:00
|
|
|
<summary>({{ i18n.t('withNFiles', { n: note.files.length }) }})</summary>
|
2023-05-18 21:58:09 -07:00
|
|
|
<MkMediaList :mediaList="note.files"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
</details>
|
|
|
|
<details v-if="note.poll">
|
2022-07-20 06:24:26 -07:00
|
|
|
<summary>{{ i18n.ts.poll }}</summary>
|
2022-12-29 20:56:22 -08:00
|
|
|
<MkPoll :note="note"/>
|
2020-01-29 11:37:25 -08:00
|
|
|
</details>
|
2023-07-08 03:01:47 -07:00
|
|
|
<button v-if="isLong && collapsed" :class="$style.fade" class="_button" @click="collapsed = false">
|
2023-01-13 22:05:23 -08:00
|
|
|
<span :class="$style.fadeLabel">{{ i18n.ts.showMore }}</span>
|
2021-11-19 01:56:30 -08:00
|
|
|
</button>
|
2023-07-08 03:01:47 -07:00
|
|
|
<button v-else-if="isLong && !collapsed" :class="$style.showLess" class="_button" @click="collapsed = true">
|
|
|
|
<span :class="$style.showLessLabel">{{ i18n.ts.showLess }}</span>
|
|
|
|
</button>
|
2020-01-29 11:37:25 -08:00
|
|
|
</div>
|
|
|
|
</template>
|
|
|
|
|
2022-01-13 19:02:10 -08:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { } from 'vue';
|
2023-09-03 21:33:38 -07:00
|
|
|
import * as Misskey from 'misskey-js';
|
2022-12-29 20:56:22 -08:00
|
|
|
import MkMediaList from '@/components/MkMediaList.vue';
|
|
|
|
import MkPoll from '@/components/MkPoll.vue';
|
2022-07-20 06:24:26 -07:00
|
|
|
import { i18n } from '@/i18n';
|
2023-03-31 21:52:07 -07:00
|
|
|
import { $i } from '@/account';
|
2023-07-21 02:58:57 -07:00
|
|
|
import { shouldCollapsed } from '@/scripts/collapsed';
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-01-13 19:02:10 -08:00
|
|
|
const props = defineProps<{
|
2023-09-03 21:33:38 -07:00
|
|
|
note: Misskey.entities.Note;
|
2022-01-13 19:02:10 -08:00
|
|
|
}>();
|
|
|
|
|
2023-07-21 02:58:57 -07:00
|
|
|
const isLong = shouldCollapsed(props.note);
|
2023-07-08 03:01:47 -07:00
|
|
|
|
|
|
|
const collapsed = $ref(isLong);
|
2020-01-29 11:37:25 -08:00
|
|
|
</script>
|
|
|
|
|
2023-01-13 22:05:23 -08:00
|
|
|
<style lang="scss" module>
|
|
|
|
.root {
|
2020-01-29 11:37:25 -08:00
|
|
|
overflow-wrap: break-word;
|
|
|
|
|
2021-11-19 01:56:30 -08:00
|
|
|
&.collapsed {
|
|
|
|
position: relative;
|
|
|
|
max-height: 9em;
|
2023-01-01 19:15:26 -08:00
|
|
|
overflow: clip;
|
2021-11-19 01:56:30 -08:00
|
|
|
|
|
|
|
> .fade {
|
|
|
|
display: block;
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 64px;
|
|
|
|
background: linear-gradient(0deg, var(--panel), var(--X15));
|
|
|
|
|
2023-01-13 22:05:23 -08:00
|
|
|
> .fadeLabel {
|
2021-11-19 01:56:30 -08:00
|
|
|
display: inline-block;
|
|
|
|
background: var(--panel);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
|
|
|
|
|
|
|
&:hover {
|
2023-01-13 22:05:23 -08:00
|
|
|
> .fadeLabel {
|
2021-11-19 01:56:30 -08:00
|
|
|
background: var(--panelHighlight);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
}
|
2023-01-13 22:05:23 -08:00
|
|
|
|
|
|
|
.reply {
|
|
|
|
margin-right: 6px;
|
|
|
|
color: var(--accent);
|
|
|
|
}
|
|
|
|
|
|
|
|
.rp {
|
|
|
|
margin-left: 4px;
|
|
|
|
font-style: oblique;
|
|
|
|
color: var(--renote);
|
|
|
|
}
|
2023-07-08 03:01:47 -07:00
|
|
|
|
|
|
|
.showLess {
|
|
|
|
width: 100%;
|
|
|
|
margin-top: 14px;
|
|
|
|
position: sticky;
|
|
|
|
bottom: calc(var(--stickyBottom, 0px) + 14px);
|
|
|
|
}
|
|
|
|
|
|
|
|
.showLessLabel {
|
|
|
|
display: inline-block;
|
|
|
|
background: var(--popup);
|
|
|
|
padding: 6px 10px;
|
|
|
|
font-size: 0.8em;
|
|
|
|
border-radius: 999px;
|
|
|
|
box-shadow: 0 2px 6px rgb(0 0 0 / 20%);
|
|
|
|
}
|
2020-01-29 11:37:25 -08:00
|
|
|
</style>
|