2021-04-24 22:38:24 +09:00
|
|
|
<template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header><MkPageHeader :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
<MkSpacer :content-max="1400">
|
|
|
|
<div class="_root">
|
|
|
|
<MkTab v-if="$i" v-model="tab">
|
|
|
|
<option value="explore"><i class="fas fa-icons"></i> {{ $ts.gallery }}</option>
|
|
|
|
<option value="liked"><i class="fas fa-heart"></i> {{ $ts._gallery.liked }}</option>
|
|
|
|
<option value="my"><i class="fas fa-edit"></i> {{ $ts._gallery.my }}</option>
|
|
|
|
</MkTab>
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<div v-if="tab === 'explore'">
|
|
|
|
<MkFolder class="_gap">
|
|
|
|
<template #header><i class="fas fa-clock"></i>{{ $ts.recentPosts }}</template>
|
|
|
|
<MkPagination v-slot="{items}" :pagination="recentPostsPagination" :disable-auto-load="true">
|
|
|
|
<div class="vfpdbgtk">
|
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</MkFolder>
|
|
|
|
<MkFolder class="_gap">
|
|
|
|
<template #header><i class="fas fa-fire-alt"></i>{{ $ts.popularPosts }}</template>
|
|
|
|
<MkPagination v-slot="{items}" :pagination="popularPostsPagination" :disable-auto-load="true">
|
|
|
|
<div class="vfpdbgtk">
|
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</MkFolder>
|
2021-04-24 22:38:24 +09:00
|
|
|
</div>
|
2022-06-20 17:38:49 +09:00
|
|
|
<div v-else-if="tab === 'liked'">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="likedPostsPagination">
|
|
|
|
<div class="vfpdbgtk">
|
|
|
|
<MkGalleryPostPreview v-for="like in items" :key="like.id" :post="like.post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
2021-04-24 22:38:24 +09:00
|
|
|
</div>
|
2022-06-20 17:38:49 +09:00
|
|
|
<div v-else-if="tab === 'my'">
|
|
|
|
<MkA to="/gallery/new" class="_link" style="margin: 16px;"><i class="fas fa-plus"></i> {{ $ts.postToGallery }}</MkA>
|
|
|
|
<MkPagination v-slot="{items}" :pagination="myPostsPagination">
|
|
|
|
<div class="vfpdbgtk">
|
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-24 22:38:24 +09:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
|
|
|
import { computed, defineComponent, watch } from 'vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import XUserList from '@/components/user-list.vue';
|
|
|
|
import MkFolder from '@/components/ui/folder.vue';
|
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import MkButton from '@/components/ui/button.vue';
|
|
|
|
import MkTab from '@/components/tab.vue';
|
|
|
|
import MkPagination from '@/components/ui/pagination.vue';
|
|
|
|
import MkGalleryPostPreview from '@/components/gallery-post-preview.vue';
|
|
|
|
import number from '@/filters/number';
|
|
|
|
import * as os from '@/os';
|
2022-06-20 17:38:49 +09:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
|
|
import { i18n } from '@/i18n';
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const props = defineProps<{
|
|
|
|
tag?: string;
|
|
|
|
}>();
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
let tab = $ref('explore');
|
|
|
|
let tags = $ref([]);
|
|
|
|
let tagsRef = $ref();
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const recentPostsPagination = {
|
|
|
|
endpoint: 'gallery/posts' as const,
|
|
|
|
limit: 6,
|
|
|
|
};
|
|
|
|
const popularPostsPagination = {
|
|
|
|
endpoint: 'gallery/featured' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
|
|
|
const myPostsPagination = {
|
|
|
|
endpoint: 'i/gallery/posts' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
|
|
|
const likedPostsPagination = {
|
|
|
|
endpoint: 'i/gallery/likes' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const tagUsersPagination = $computed(() => ({
|
|
|
|
endpoint: 'hashtags/users' as const,
|
|
|
|
limit: 30,
|
|
|
|
params: {
|
|
|
|
tag: this.tag,
|
|
|
|
origin: 'combined',
|
|
|
|
sort: '+follower',
|
2021-04-24 22:38:24 +09:00
|
|
|
},
|
2022-06-20 17:38:49 +09:00
|
|
|
}));
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
watch(() => props.tag, () => {
|
|
|
|
if (tagsRef) tagsRef.tags.toggleContent(props.tag == null);
|
|
|
|
});
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerActions = $computed(() => []);
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const headerTabs = $computed(() => []);
|
2021-04-24 22:38:24 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.gallery,
|
|
|
|
icon: 'fas fa-icons',
|
|
|
|
bg: 'var(--bg)',
|
2021-04-24 22:38:24 +09:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
|
|
|
<style lang="scss" scoped>
|
|
|
|
.vfpdbgtk {
|
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
grid-gap: 12px;
|
|
|
|
margin: 0 var(--margin);
|
|
|
|
|
|
|
|
> .post {
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
</style>
|