hippofish/packages/frontend/src/components/MkClipPreview.vue

67 lines
1.6 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and misskey-project
SPDX-License-Identifier: AGPL-3.0-only
-->
2023-03-17 07:09:43 +01:00
<template>
<MkA :to="`/clips/${clip.id}`" :class="$style.link">
<div :class="$style.root" class="_panel _gaps_s">
<b>{{ clip.name }}</b>
<div :class="$style.description">
<div v-if="clip.description"><Mfm :text="clip.description" :plain="true" :nowrap="true"/></div>
<div v-if="clip.lastClippedAt">{{ i18n.ts.updatedAt }}: <MkTime :time="clip.lastClippedAt" mode="detail"/></div>
<div v-if="clip.notesCount != null">{{ i18n.ts.notesCount }}: {{ number(clip.notesCount) }} / {{ $i?.policies.noteEachClipsLimit }} ({{ i18n.tsx.remainingN({ n: remaining }) }})</div>
</div>
<div :class="$style.divider"></div>
<div>
<MkAvatar :user="clip.user" :class="$style.userAvatar" indicator link preview/> <MkUserName :user="clip.user" :nowrap="false"/>
</div>
2023-03-17 07:09:43 +01:00
</div>
</MkA>
2023-03-17 07:09:43 +01:00
</template>
<script lang="ts" setup>
import * as Misskey from 'misskey-js';
import { computed } from 'vue';
2023-09-19 09:37:43 +02:00
import { i18n } from '@/i18n.js';
import { $i } from '@/account.js';
import number from '@/filters/number.js';
2023-03-17 07:09:43 +01:00
const props = defineProps<{
clip: Misskey.entities.Clip;
2023-03-17 07:09:43 +01:00
}>();
const remaining = computed(() => {
return ($i?.policies && props.clip.notesCount != null) ? ($i.policies.noteEachClipsLimit - props.clip.notesCount) : i18n.ts.unknown;
});
2023-03-17 07:09:43 +01:00
</script>
<style lang="scss" module>
.link {
2023-03-17 07:09:43 +01:00
display: block;
&:hover {
text-decoration: none;
color: var(--accent);
}
}
.root {
2023-03-17 07:09:43 +01:00
padding: 16px;
}
.divider {
height: 1px;
background: var(--divider);
2023-03-17 07:09:43 +01:00
}
.description {
font-size: 90%;
2023-03-17 07:09:43 +01:00
}
.userAvatar {
width: 32px;
height: 32px;
}
</style>