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