blob: b71777e032eabe1fee358143bc0168a9a2f346f1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
|
<!--
SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<div v-if="!hardMuted" :class="$style.root" @click="$emit('select', note.user)">
<div :class="$style.avatar">
<MkAvatar :class="$style.icon" :user="note.user" indictor/>
</div>
<div :class="$style.contents">
<header :class="$style.header">
<MkA v-user-preview="note.user.id" :class="$style.headerName" :to="userPage(note.user)">
<MkUserName :user="note.user"/>
</MkA>
<MkA :to="notePage(note)">
<MkTime :time="note.createdAt" :class="$style.headerTime" colored/>
</MkA>
</header>
<div>
<div v-if="muted" :class="[$style.text, $style.muted]">
<SkMutedNote :muted="muted" :note="note"></SkMutedNote>
</div>
<Mfm v-else :class="$style.text" :text="getNoteSummary(note)" :isBlock="true" :plain="true" :nowrap="false" :isNote="true" nyaize="respect" :author="note.user"/>
</div>
</div>
</div>
<div v-else>
<!--
MkDateSeparatedList uses TransitionGroup which requires single element in the child elements
so MkNote create empty div instead of no elements
-->
</div>
</template>
<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { getNoteSummary } from '@/utility/get-note-summary.js';
import { userPage } from '@/filters/user.js';
import { notePage } from '@/filters/note.js';
import { checkMutes } from '@/utility/check-word-mute';
import SkMutedNote from '@/components/SkMutedNote.vue';
const props = defineProps<{
note: Misskey.entities.Note,
}>();
defineEmits<{
(event: 'select', user: Misskey.entities.UserLite): void
}>();
// eslint-disable-next-line vue/no-setup-props-reactivity-loss
const { muted, hardMuted } = checkMutes(props.note);
</script>
<style lang="scss" module>
.root {
position: relative;
box-sizing: border-box;
padding: 12px 16px;
font-size: 0.9em;
overflow-wrap: break-word;
display: flex;
contain: content;
cursor: pointer;
}
.avatar {
align-self: center;
flex-shrink: 0;
width: 42px;
height: 42px;
margin-right: 8px;
}
.contents {
flex: 1;
min-width: 0;
}
.header {
display: flex;
align-items: baseline;
justify-content: space-between;
white-space: nowrap;
}
.headerName {
text-overflow: ellipsis;
white-space: nowrap;
min-width: 0;
overflow: hidden;
font-weight: bold;
}
.headerTime {
margin-left: auto;
font-size: 0.9em;
}
.icon {
display: block;
width: 100%;
height: 100%;
}
.text {
display: flex;
width: 100%;
overflow: clip;
line-height: 1.25em;
height: 2.5em;
}
.muted {
font-style: italic;
}
@container (max-width: 600px) {
.root {
padding: 16px;
font-size: 0.9em;
}
}
@container (max-width: 500px) {
.root {
padding: 12px;
font-size: 0.85em;
}
}
</style>
|