2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-08-18 13:44:21 +00:00
|
|
|
<template>
|
2023-12-22 11:41:42 +00:00
|
|
|
<div style="position: relative;">
|
|
|
|
<MkA :to="`/channels/${channel.id}`" class="eftoefju _panel" tabindex="-1" @click="updateLastReadedAt">
|
|
|
|
<div class="banner" :style="bannerStyle">
|
|
|
|
<div class="fade"></div>
|
2023-12-23 01:09:23 +00:00
|
|
|
<div class="name"><i class="ph-television ph-bold ph-lg"></i> {{ channel.name }}</div>
|
2023-12-22 11:41:42 +00:00
|
|
|
<div v-if="channel.isSensitive" class="sensitiveIndicator">{{ i18n.ts.sensitive }}</div>
|
|
|
|
<div class="status">
|
|
|
|
<div>
|
2023-12-23 01:09:23 +00:00
|
|
|
<i class="ph-users ph-bold ph-lg"></i>
|
2023-12-22 11:41:42 +00:00
|
|
|
<I18n :src="i18n.ts._channel.usersCount" tag="span" style="margin-left: 4px;">
|
|
|
|
<template #n>
|
|
|
|
<b>{{ channel.usersCount }}</b>
|
|
|
|
</template>
|
|
|
|
</I18n>
|
|
|
|
</div>
|
|
|
|
<div>
|
2023-12-23 01:09:23 +00:00
|
|
|
<i class="ph-pencil ph-bold ph-lg"></i>
|
2023-12-22 11:41:42 +00:00
|
|
|
<I18n :src="i18n.ts._channel.notesCount" tag="span" style="margin-left: 4px;">
|
|
|
|
<template #n>
|
|
|
|
<b>{{ channel.notesCount }}</b>
|
|
|
|
</template>
|
|
|
|
</I18n>
|
|
|
|
</div>
|
2020-10-17 11:12:00 +00:00
|
|
|
</div>
|
2020-08-18 13:44:21 +00:00
|
|
|
</div>
|
2023-12-22 11:41:42 +00:00
|
|
|
<article v-if="channel.description">
|
|
|
|
<p :title="channel.description">{{ channel.description.length > 85 ? channel.description.slice(0, 85) + '…' : channel.description }}</p>
|
|
|
|
</article>
|
|
|
|
<footer>
|
|
|
|
<span v-if="channel.lastNotedAt">
|
|
|
|
{{ i18n.ts.updatedAt }}: <MkTime :time="channel.lastNotedAt"/>
|
|
|
|
</span>
|
|
|
|
</footer>
|
|
|
|
</MkA>
|
|
|
|
<div
|
|
|
|
v-if="channel.lastNotedAt && (channel.isFavorited || channel.isFollowing) && (!lastReadedAt || Date.parse(channel.lastNotedAt) > lastReadedAt)"
|
|
|
|
class="indicator"
|
|
|
|
></div>
|
|
|
|
</div>
|
2020-08-18 13:44:21 +00:00
|
|
|
</template>
|
|
|
|
|
2022-01-10 15:05:18 +00:00
|
|
|
<script lang="ts" setup>
|
2023-12-22 11:41:42 +00:00
|
|
|
import { computed, ref, watch } from 'vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { i18n } from '@/i18n.js';
|
2023-12-22 11:41:42 +00:00
|
|
|
import { miLocalStorage } from '@/local-storage.js';
|
2020-08-18 13:44:21 +00:00
|
|
|
|
2022-01-10 15:05:18 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
channel: Record<string, any>;
|
|
|
|
}>();
|
2020-08-18 13:44:21 +00:00
|
|
|
|
2023-12-22 11:41:42 +00:00
|
|
|
const getLastReadedAt = (): number | null => {
|
|
|
|
return miLocalStorage.getItemAsJson(`channelLastReadedAt:${props.channel.id}`) ?? null;
|
|
|
|
};
|
|
|
|
|
|
|
|
const lastReadedAt = ref(getLastReadedAt());
|
|
|
|
|
|
|
|
watch(() => props.channel.id, () => {
|
|
|
|
lastReadedAt.value = getLastReadedAt();
|
|
|
|
});
|
|
|
|
|
|
|
|
const updateLastReadedAt = () => {
|
|
|
|
lastReadedAt.value = props.channel.lastNotedAt ? Date.parse(props.channel.lastNotedAt) : Date.now();
|
|
|
|
};
|
|
|
|
|
2022-01-10 15:05:18 +00:00
|
|
|
const bannerStyle = computed(() => {
|
|
|
|
if (props.channel.bannerUrl) {
|
|
|
|
return { backgroundImage: `url(${props.channel.bannerUrl})` };
|
|
|
|
} else {
|
|
|
|
return { backgroundColor: '#4c5e6d' };
|
|
|
|
}
|
2020-08-18 13:44:21 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2022-12-27 09:29:39 +00:00
|
|
|
<style lang="scss" scoped>
|
2020-08-18 13:44:21 +00:00
|
|
|
.eftoefju {
|
|
|
|
display: block;
|
2021-03-02 13:57:16 +00:00
|
|
|
overflow: hidden;
|
2020-08-18 13:44:21 +00:00
|
|
|
width: 100%;
|
|
|
|
|
|
|
|
&:hover {
|
|
|
|
text-decoration: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
position: relative;
|
|
|
|
width: 100%;
|
|
|
|
height: 200px;
|
|
|
|
background-position: center;
|
|
|
|
background-size: cover;
|
|
|
|
|
|
|
|
> .fade {
|
|
|
|
position: absolute;
|
|
|
|
bottom: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 64px;
|
|
|
|
background: linear-gradient(0deg, var(--panel), var(--X15));
|
|
|
|
}
|
|
|
|
|
|
|
|
> .name {
|
|
|
|
position: absolute;
|
|
|
|
top: 16px;
|
|
|
|
left: 16px;
|
|
|
|
padding: 12px 16px;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
|
|
|
color: #fff;
|
|
|
|
font-size: 1.2em;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .status {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
bottom: 16px;
|
|
|
|
right: 16px;
|
|
|
|
padding: 8px 12px;
|
|
|
|
font-size: 80%;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
2023-10-31 18:44:34 +00:00
|
|
|
border-radius: var(--radius-sm);
|
2020-08-18 13:44:21 +00:00
|
|
|
color: #fff;
|
|
|
|
}
|
2023-08-05 04:58:31 +00:00
|
|
|
|
|
|
|
> .sensitiveIndicator {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
bottom: 16px;
|
|
|
|
left: 16px;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
|
|
|
color: var(--warn);
|
2023-10-31 18:44:34 +00:00
|
|
|
border-radius: var(--radius-sm);
|
2023-08-05 04:58:31 +00:00
|
|
|
font-weight: bold;
|
|
|
|
font-size: 1em;
|
|
|
|
padding: 4px 7px;
|
|
|
|
}
|
2020-08-18 13:44:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
> article {
|
|
|
|
padding: 16px;
|
|
|
|
|
|
|
|
> p {
|
|
|
|
margin: 0;
|
|
|
|
font-size: 1em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
padding: 12px 16px;
|
2021-04-10 03:40:50 +00:00
|
|
|
border-top: solid 0.5px var(--divider);
|
2020-08-18 13:44:21 +00:00
|
|
|
|
|
|
|
> span {
|
|
|
|
opacity: 0.7;
|
|
|
|
font-size: 0.9em;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 550px) {
|
|
|
|
font-size: 0.9em;
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
height: 80px;
|
|
|
|
|
|
|
|
> .status {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> article {
|
|
|
|
padding: 12px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> footer {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
@media (max-width: 500px) {
|
|
|
|
font-size: 0.8em;
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
height: 70px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> article {
|
|
|
|
padding: 8px;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-12-22 11:41:42 +00:00
|
|
|
.indicator {
|
|
|
|
position: absolute;
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
transform: translate(25%, -25%);
|
|
|
|
background-color: var(--accent);
|
|
|
|
border: solid var(--bg) 4px;
|
|
|
|
border-radius: 100%;
|
|
|
|
width: 1.5rem;
|
|
|
|
height: 1.5rem;
|
|
|
|
aspect-ratio: 1 / 1;
|
|
|
|
}
|
|
|
|
|
2020-08-18 13:44:21 +00:00
|
|
|
</style>
|