2020-08-18 08:44:21 -05:00
|
|
|
<template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkStickyContainer>
|
2022-06-22 02:29:21 -05:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkSpacer :content-max="700">
|
|
|
|
<div v-if="tab === 'featured'" class="_content grwlizim featured">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="featuredPagination">
|
|
|
|
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_gap" :channel="channel"/>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'following'" class="_content grwlizim following">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="followingPagination">
|
|
|
|
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_gap" :channel="channel"/>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'owned'" class="_content grwlizim owned">
|
2022-12-19 04:01:30 -06:00
|
|
|
<MkButton class="new" @click="create()"><i class="ti ti-plus"></i></MkButton>
|
2022-06-20 03:38:49 -05:00
|
|
|
<MkPagination v-slot="{items}" :pagination="ownedPagination">
|
|
|
|
<MkChannelPreview v-for="channel in items" :key="channel.id" class="_gap" :channel="channel"/>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2020-08-18 08:44:21 -05:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, defineComponent, inject } from 'vue';
|
2022-08-30 10:24:33 -05:00
|
|
|
import MkChannelPreview from '@/components/MkChannelPreview.vue';
|
2022-09-06 04:21:49 -05:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
|
|
|
import MkButton from '@/components/MkButton.vue';
|
2022-06-20 03:38:49 -05:00
|
|
|
import { useRouter } from '@/router';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
|
|
import { i18n } from '@/i18n';
|
2020-08-18 08:44:21 -05:00
|
|
|
|
2022-06-20 03:38:49 -05:00
|
|
|
const router = useRouter();
|
|
|
|
|
|
|
|
let tab = $ref('featured');
|
|
|
|
|
|
|
|
const featuredPagination = {
|
|
|
|
endpoint: 'channels/featured' as const,
|
|
|
|
noPaging: true,
|
|
|
|
};
|
|
|
|
const followingPagination = {
|
|
|
|
endpoint: 'channels/followed' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
|
|
|
const ownedPagination = {
|
|
|
|
endpoint: 'channels/owned' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
|
|
|
|
|
|
|
function create() {
|
|
|
|
router.push('/channels/new');
|
|
|
|
}
|
|
|
|
|
|
|
|
const headerActions = $computed(() => [{
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-plus',
|
2022-06-20 03:38:49 -05:00
|
|
|
text: i18n.ts.create,
|
|
|
|
handler: create,
|
|
|
|
}]);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => [{
|
2022-06-22 02:29:21 -05:00
|
|
|
key: 'featured',
|
2022-06-20 03:38:49 -05:00
|
|
|
title: i18n.ts._channel.featured,
|
|
|
|
icon: 'fas fa-fire-alt',
|
|
|
|
}, {
|
2022-06-22 02:29:21 -05:00
|
|
|
key: 'following',
|
2022-06-20 03:38:49 -05:00
|
|
|
title: i18n.ts._channel.following,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-heart',
|
2022-06-20 03:38:49 -05:00
|
|
|
}, {
|
2022-06-22 02:29:21 -05:00
|
|
|
key: 'owned',
|
2022-06-20 03:38:49 -05:00
|
|
|
title: i18n.ts._channel.owned,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-edit',
|
2022-06-20 03:38:49 -05:00
|
|
|
}]);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.channel,
|
2022-12-19 04:01:30 -06:00
|
|
|
icon: 'ti ti-device-tv',
|
2022-06-20 03:38:49 -05:00
|
|
|
})));
|
2020-08-18 08:44:21 -05:00
|
|
|
</script>
|