barkey/packages/frontend/src/components/SkFollowingFeedEntry.vue

124 lines
2.3 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: hazelnoot and other Sharkey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
2024-10-02 04:45:41 +00:00
<div :class="$style.root" @click="$emit('select', note.user)">
2024-10-02 04:20:39 +00:00
<div :class="$style.avatar">
<MkAvatar :class="$style.icon" :user="note.user" indictor/>
</div>
2024-10-02 04:20:39 +00:00
<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>
2024-10-02 02:40:19 +00:00
<MkA :to="notePage(note)">
<MkTime :time="note.createdAt" :class="$style.headerTime" colored/>
</MkA>
</header>
<div>
2024-10-03 04:45:49 +00:00
<div v-if="isMuted" :class="[$style.text, $style.muted]">({{ i18n.ts.postFiltered }})</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>
</template>
<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { getNoteSummary } from '@/scripts/get-note-summary.js';
import { userPage } from '@/filters/user.js';
2024-10-02 02:40:19 +00:00
import { notePage } from '@/filters/note.js';
2024-10-03 04:45:49 +00:00
import { i18n } from '@/i18n.js';
2024-10-03 04:45:49 +00:00
withDefaults(defineProps<{
note: Misskey.entities.Note,
isMuted: boolean
}>(), {
isMuted: false,
});
2024-10-01 22:28:04 +00:00
defineEmits<{
2024-10-02 04:45:41 +00:00
(event: 'select', user: Misskey.entities.UserLite): void
2024-10-01 22:28:04 +00:00
}>();
</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;
}
2024-10-02 04:20:39 +00:00
.avatar {
align-self: center;
flex-shrink: 0;
width: 42px;
height: 42px;
margin-right: 8px;
}
2024-10-02 04:20:39 +00:00
.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;
}
2024-10-03 04:45:49 +00:00
.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>