2020-08-18 07:44:21 -06:00
|
|
|
<template>
|
2022-06-20 02:38:49 -06:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="700">
|
|
|
|
<div v-if="channel">
|
|
|
|
<div class="wpgynlbz _panel _gap" :class="{ hide: !showBanner }">
|
|
|
|
<XChannelFollowButton :channel="channel" :full="true" class="subscribe"/>
|
|
|
|
<button class="_button toggle" @click="() => showBanner = !showBanner">
|
2022-11-06 19:30:26 -07:00
|
|
|
<template v-if="showBanner"><i class="ph-caret-up-bold"></i></template>
|
|
|
|
<template v-else><i class="ph-caret-down-bold"></i></template>
|
2022-06-20 02:38:49 -06:00
|
|
|
</button>
|
|
|
|
<div v-if="!showBanner" class="hideOverlay">
|
|
|
|
</div>
|
|
|
|
<div :style="{ backgroundImage: channel.bannerUrl ? `url(${channel.bannerUrl})` : null }" class="banner">
|
|
|
|
<div class="status">
|
2022-11-06 19:30:26 -07:00
|
|
|
<div><i class="ph-users-bold ph-fw-bold"></i><I18n :src="i18n.ts._channel.usersCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.usersCount }}</b></template></I18n></div>
|
|
|
|
<div><i class="ph-pencil-bold ph-fw-bold"></i><I18n :src="i18n.ts._channel.notesCount" tag="span" style="margin-left: 4px;"><template #n><b>{{ channel.notesCount }}</b></template></I18n></div>
|
2022-06-20 02:38:49 -06:00
|
|
|
</div>
|
|
|
|
<div class="fade"></div>
|
|
|
|
</div>
|
|
|
|
<div v-if="channel.description" class="description">
|
|
|
|
<Mfm :text="channel.description" :is-note="false" :i="$i"/>
|
2021-12-23 00:10:13 -07:00
|
|
|
</div>
|
2020-08-18 07:44:21 -06:00
|
|
|
</div>
|
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
<XPostForm v-if="$i" :channel="channel" class="post-form _panel _gap" fixed/>
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
<XTimeline :key="channelId" class="_gap" src="channel" :channel="channelId" @before="before" @after="after"/>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-08-18 07:44:21 -06:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, inject, watch } from 'vue';
|
2022-09-06 03:21:49 -06:00
|
|
|
import MkContainer from '@/components/MkContainer.vue';
|
2022-08-30 09:24:33 -06:00
|
|
|
import XPostForm from '@/components/MkPostForm.vue';
|
|
|
|
import XTimeline from '@/components/MkTimeline.vue';
|
|
|
|
import XChannelFollowButton from '@/components/MkChannelFollowButton.vue';
|
2021-11-11 10:02:25 -07:00
|
|
|
import * as os from '@/os';
|
2022-06-20 02:38:49 -06:00
|
|
|
import { useRouter } from '@/router';
|
|
|
|
import { $i } from '@/account';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
const router = useRouter();
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
const props = defineProps<{
|
|
|
|
channelId: string;
|
|
|
|
}>();
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
let channel = $ref(null);
|
|
|
|
let showBanner = $ref(true);
|
|
|
|
const pagination = {
|
|
|
|
endpoint: 'channels/timeline' as const,
|
|
|
|
limit: 10,
|
|
|
|
params: computed(() => ({
|
|
|
|
channelId: props.channelId,
|
|
|
|
})),
|
|
|
|
};
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
watch(() => props.channelId, async () => {
|
|
|
|
channel = await os.api('channels/show', {
|
|
|
|
channelId: props.channelId,
|
|
|
|
});
|
|
|
|
}, { immediate: true });
|
2020-08-18 07:44:21 -06:00
|
|
|
|
2022-06-20 02:38:49 -06:00
|
|
|
function edit() {
|
|
|
|
router.push(`/channels/${channel.id}/edit`);
|
|
|
|
}
|
|
|
|
|
|
|
|
const headerActions = $computed(() => channel && channel.userId ? [{
|
2022-11-06 19:30:26 -07:00
|
|
|
icon: 'ph-gear-six-bold',
|
2022-06-20 02:38:49 -06:00
|
|
|
text: i18n.ts.edit,
|
|
|
|
handler: edit,
|
|
|
|
}] : null);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => []);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => channel ? {
|
|
|
|
title: channel.name,
|
2022-11-06 19:30:26 -07:00
|
|
|
icon: 'ph-television-bold',
|
2022-06-20 02:38:49 -06:00
|
|
|
} : null));
|
2020-08-18 07:44:21 -06:00
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.wpgynlbz {
|
2020-10-17 21:16:42 -06:00
|
|
|
position: relative;
|
|
|
|
|
2020-08-18 07:44:21 -06:00
|
|
|
> .subscribe {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
top: 16px;
|
|
|
|
left: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .toggle {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 2;
|
|
|
|
top: 8px;
|
|
|
|
right: 8px;
|
|
|
|
font-size: 1.2em;
|
|
|
|
width: 48px;
|
|
|
|
height: 48px;
|
|
|
|
color: #fff;
|
|
|
|
background: rgba(0, 0, 0, 0.5);
|
|
|
|
border-radius: 100%;
|
|
|
|
|
2021-04-20 08:22:59 -06:00
|
|
|
> i {
|
2020-08-18 07:44:21 -06:00
|
|
|
vertical-align: middle;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
position: relative;
|
|
|
|
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));
|
|
|
|
}
|
|
|
|
|
|
|
|
> .status {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
bottom: 16px;
|
|
|
|
right: 16px;
|
|
|
|
padding: 8px 12px;
|
|
|
|
font-size: 80%;
|
|
|
|
background: rgba(0, 0, 0, 0.7);
|
|
|
|
border-radius: 6px;
|
|
|
|
color: #fff;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
padding: 16px;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .hideOverlay {
|
|
|
|
position: absolute;
|
|
|
|
z-index: 1;
|
|
|
|
top: 0;
|
|
|
|
left: 0;
|
|
|
|
width: 100%;
|
|
|
|
height: 100%;
|
2021-08-11 07:34:45 -06:00
|
|
|
-webkit-backdrop-filter: var(--blur, blur(16px));
|
|
|
|
backdrop-filter: var(--blur, blur(16px));
|
2020-08-18 07:44:21 -06:00
|
|
|
background: rgba(0, 0, 0, 0.3);
|
|
|
|
}
|
|
|
|
|
|
|
|
&.hide {
|
|
|
|
> .subscribe {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .toggle {
|
|
|
|
top: 0;
|
|
|
|
right: 0;
|
|
|
|
height: 100%;
|
|
|
|
background: transparent;
|
|
|
|
}
|
|
|
|
|
|
|
|
> .banner {
|
|
|
|
height: 42px;
|
|
|
|
filter: blur(8px);
|
|
|
|
|
|
|
|
> * {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
> .description {
|
|
|
|
display: none;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|