2023-07-27 05:31:52 +00:00
|
|
|
<!--
|
|
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2021-04-24 13:38:24 +00:00
|
|
|
<template>
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkStickyContainer>
|
2022-06-30 12:38:34 +00:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2023-05-29 08:13:12 +00:00
|
|
|
<MkSpacer :contentMax="1400">
|
2022-06-20 08:38:49 +00:00
|
|
|
<div class="_root">
|
|
|
|
<div v-if="tab === 'explore'">
|
2023-01-09 00:41:25 +00:00
|
|
|
<MkFoldableSection class="_margin">
|
2023-09-30 19:53:52 +00:00
|
|
|
<template #header><i class="ph-clock ph-bold ph-lg"></i>{{ i18n.ts.recentPosts }}</template>
|
2023-05-29 08:13:12 +00:00
|
|
|
<MkPagination v-slot="{items}" :pagination="recentPostsPagination" :disableAutoLoad="true">
|
2023-05-14 01:21:56 +00:00
|
|
|
<div :class="$style.items">
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
2023-01-09 00:41:25 +00:00
|
|
|
</MkFoldableSection>
|
|
|
|
<MkFoldableSection class="_margin">
|
2022-12-19 23:35:49 +00:00
|
|
|
<template #header><i class="ti ti-comet"></i>{{ i18n.ts.popularPosts }}</template>
|
2023-05-29 08:13:12 +00:00
|
|
|
<MkPagination v-slot="{items}" :pagination="popularPostsPagination" :disableAutoLoad="true">
|
2023-05-14 01:21:56 +00:00
|
|
|
<div :class="$style.items">
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
2023-01-09 00:41:25 +00:00
|
|
|
</MkFoldableSection>
|
2021-04-24 13:38:24 +00:00
|
|
|
</div>
|
2022-06-20 08:38:49 +00:00
|
|
|
<div v-else-if="tab === 'liked'">
|
|
|
|
<MkPagination v-slot="{items}" :pagination="likedPostsPagination">
|
2023-05-14 01:21:56 +00:00
|
|
|
<div :class="$style.items">
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkGalleryPostPreview v-for="like in items" :key="like.id" :post="like.post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
2021-04-24 13:38:24 +00:00
|
|
|
</div>
|
2022-06-20 08:38:49 +00:00
|
|
|
<div v-else-if="tab === 'my'">
|
2023-09-30 19:53:52 +00:00
|
|
|
<MkA to="/gallery/new" class="_link" style="margin: 16px;"><i class="ph-plus ph-bold ph-lg"></i> {{ i18n.ts.postToGallery }}</MkA>
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkPagination v-slot="{items}" :pagination="myPostsPagination">
|
2023-05-14 01:21:56 +00:00
|
|
|
<div :class="$style.items">
|
2022-06-20 08:38:49 +00:00
|
|
|
<MkGalleryPostPreview v-for="post in items" :key="post.id" :post="post" class="post"/>
|
|
|
|
</div>
|
|
|
|
</MkPagination>
|
|
|
|
</div>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
</MkStickyContainer>
|
2021-04-24 13:38:24 +00:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
<script lang="ts" setup>
|
2023-02-16 14:09:41 +00:00
|
|
|
import { watch } from 'vue';
|
2023-01-09 00:41:25 +00:00
|
|
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
2022-09-06 09:21:49 +00:00
|
|
|
import MkPagination from '@/components/MkPagination.vue';
|
2022-08-30 15:24:33 +00:00
|
|
|
import MkGalleryPostPreview from '@/components/MkGalleryPostPreview.vue';
|
2023-09-19 07:37:43 +00:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { useRouter } from '@/router.js';
|
2022-06-30 12:38:34 +00:00
|
|
|
|
|
|
|
const router = useRouter();
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const props = defineProps<{
|
|
|
|
tag?: string;
|
|
|
|
}>();
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
let tab = $ref('explore');
|
|
|
|
let tags = $ref([]);
|
|
|
|
let tagsRef = $ref();
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const recentPostsPagination = {
|
|
|
|
endpoint: 'gallery/posts' as const,
|
|
|
|
limit: 6,
|
|
|
|
};
|
|
|
|
const popularPostsPagination = {
|
|
|
|
endpoint: 'gallery/featured' as const,
|
2023-04-11 06:49:19 +00:00
|
|
|
noPaging: true,
|
2022-06-20 08:38:49 +00:00
|
|
|
};
|
|
|
|
const myPostsPagination = {
|
|
|
|
endpoint: 'i/gallery/posts' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
|
|
|
const likedPostsPagination = {
|
|
|
|
endpoint: 'i/gallery/likes' as const,
|
|
|
|
limit: 5,
|
|
|
|
};
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
const tagUsersPagination = $computed(() => ({
|
|
|
|
endpoint: 'hashtags/users' as const,
|
|
|
|
limit: 30,
|
|
|
|
params: {
|
2023-08-13 11:12:29 +00:00
|
|
|
tag: props.tag,
|
2022-06-20 08:38:49 +00:00
|
|
|
origin: 'combined',
|
|
|
|
sort: '+follower',
|
2021-04-24 13:38:24 +00:00
|
|
|
},
|
2022-06-20 08:38:49 +00:00
|
|
|
}));
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
watch(() => props.tag, () => {
|
|
|
|
if (tagsRef) tagsRef.tags.toggleContent(props.tag == null);
|
|
|
|
});
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-30 12:38:34 +00:00
|
|
|
const headerActions = $computed(() => [{
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-plus ph-bold ph-lg',
|
2022-06-30 12:38:34 +00:00
|
|
|
text: i18n.ts.create,
|
|
|
|
handler: () => {
|
|
|
|
router.push('/gallery/new');
|
|
|
|
},
|
|
|
|
}]);
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-30 12:38:34 +00:00
|
|
|
const headerTabs = $computed(() => [{
|
|
|
|
key: 'explore',
|
|
|
|
title: i18n.ts.gallery,
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-images-square ph-bold pg-lg',
|
2022-06-30 12:38:34 +00:00
|
|
|
}, {
|
|
|
|
key: 'liked',
|
|
|
|
title: i18n.ts._gallery.liked,
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-heart ph-bold ph-lg',
|
2022-06-30 12:38:34 +00:00
|
|
|
}, {
|
|
|
|
key: 'my',
|
|
|
|
title: i18n.ts._gallery.my,
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-pencil-line ph-bold pg-lg',
|
2022-06-30 12:38:34 +00:00
|
|
|
}]);
|
2021-04-24 13:38:24 +00:00
|
|
|
|
2022-06-20 08:38:49 +00:00
|
|
|
definePageMetadata({
|
|
|
|
title: i18n.ts.gallery,
|
2023-09-30 19:53:52 +00:00
|
|
|
icon: 'ph-images-square ph-bold pg-lg',
|
2021-04-24 13:38:24 +00:00
|
|
|
});
|
|
|
|
</script>
|
|
|
|
|
2023-05-14 01:21:56 +00:00
|
|
|
<style lang="scss" module>
|
|
|
|
.items {
|
2021-04-24 13:38:24 +00:00
|
|
|
display: grid;
|
|
|
|
grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
|
|
|
|
grid-gap: 12px;
|
|
|
|
margin: 0 var(--margin);
|
|
|
|
}
|
|
|
|
</style>
|