2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2023-04-08 02:01:42 +02:00
|
|
|
<MkStickyContainer>
|
|
|
|
<template #header
|
|
|
|
><MkPageHeader
|
|
|
|
v-model:tab="tab"
|
|
|
|
:actions="headerActions"
|
|
|
|
:tabs="headerTabs"
|
|
|
|
/></template>
|
|
|
|
<div class="lznhrdub">
|
|
|
|
<MkSpacer :content-max="1200">
|
2023-05-26 04:47:10 +02:00
|
|
|
<swiper
|
2023-05-26 23:02:17 +02:00
|
|
|
:round-lengths="true"
|
2023-05-26 04:47:10 +02:00
|
|
|
:touch-angle="25"
|
|
|
|
:threshold="10"
|
2023-09-02 01:27:33 +02:00
|
|
|
:centered-slides="true"
|
2023-04-08 02:01:42 +02:00
|
|
|
:modules="[Virtual]"
|
|
|
|
:space-between="20"
|
|
|
|
:virtual="true"
|
2023-06-26 21:47:05 +02:00
|
|
|
:allow-touch-move="
|
|
|
|
defaultStore.state.swipeOnMobile &&
|
|
|
|
(deviceKind !== 'desktop' ||
|
|
|
|
defaultStore.state.swipeOnDesktop)
|
|
|
|
"
|
2023-04-08 02:01:42 +02:00
|
|
|
@swiper="setSwiperRef"
|
|
|
|
@slide-change="onSlideChange"
|
|
|
|
>
|
|
|
|
<swiper-slide>
|
2023-05-02 05:54:02 +02:00
|
|
|
<XUsers />
|
2023-04-08 02:01:42 +02:00
|
|
|
</swiper-slide>
|
|
|
|
<swiper-slide>
|
2023-05-02 05:54:02 +02:00
|
|
|
<XFeatured />
|
2023-04-08 02:01:42 +02:00
|
|
|
</swiper-slide>
|
|
|
|
</swiper>
|
|
|
|
</MkSpacer>
|
|
|
|
</div>
|
|
|
|
</MkStickyContainer>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 10:38:49 +02:00
|
|
|
<script lang="ts" setup>
|
2023-09-02 01:27:33 +02:00
|
|
|
import { computed, onMounted, ref, watch } from "vue";
|
2023-07-11 06:16:56 +02:00
|
|
|
import { Virtual } from "swiper/modules";
|
2023-04-08 02:01:42 +02:00
|
|
|
import { Swiper, SwiperSlide } from "swiper/vue";
|
|
|
|
import XFeatured from "./explore.featured.vue";
|
|
|
|
import XUsers from "./explore.users.vue";
|
|
|
|
import { definePageMetadata } from "@/scripts/page-metadata";
|
|
|
|
import { deviceKind } from "@/scripts/device-kind";
|
|
|
|
import { i18n } from "@/i18n";
|
|
|
|
import { defaultStore } from "@/store";
|
|
|
|
import "swiper/scss";
|
|
|
|
import "swiper/scss/virtual";
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-04-20 06:02:12 +02:00
|
|
|
const tabs = ["users", "featured"];
|
2023-09-02 01:16:23 +02:00
|
|
|
const tab = ref(tabs[0]);
|
2023-08-12 02:44:46 +02:00
|
|
|
watch(tab, () => syncSlide(tabs.indexOf(tab.value)));
|
2022-09-09 21:09:12 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-08-12 02:44:46 +02:00
|
|
|
const headerTabs = computed(() => [
|
2023-04-08 02:01:42 +02:00
|
|
|
{
|
|
|
|
key: "users",
|
|
|
|
icon: "ph-users ph-bold ph-lg",
|
|
|
|
title: i18n.ts.users,
|
|
|
|
},
|
2023-05-02 05:54:02 +02:00
|
|
|
{
|
|
|
|
key: "featured",
|
|
|
|
icon: "ph-lightning ph-bold ph-lg",
|
|
|
|
title: i18n.ts.featured,
|
|
|
|
},
|
2023-04-08 02:01:42 +02:00
|
|
|
]);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-04-08 02:01:42 +02:00
|
|
|
definePageMetadata(
|
|
|
|
computed(() => ({
|
|
|
|
title: i18n.ts.explore,
|
|
|
|
icon: "ph-compass ph-bold ph-lg",
|
2023-07-06 03:28:27 +02:00
|
|
|
})),
|
2023-04-08 02:01:42 +02:00
|
|
|
);
|
2022-09-09 21:09:12 +02:00
|
|
|
|
|
|
|
let swiperRef = null;
|
|
|
|
|
|
|
|
function setSwiperRef(swiper) {
|
|
|
|
swiperRef = swiper;
|
2023-08-12 02:44:46 +02:00
|
|
|
syncSlide(tabs.indexOf(tab.value));
|
2022-09-09 21:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function onSlideChange() {
|
2023-08-12 02:44:46 +02:00
|
|
|
tab.value = tabs[swiperRef.activeIndex];
|
2022-09-09 21:09:12 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
function syncSlide(index) {
|
|
|
|
swiperRef.slideTo(index);
|
|
|
|
}
|
|
|
|
|
2022-11-12 22:38:28 +01:00
|
|
|
onMounted(() => {
|
|
|
|
syncSlide(tabs.indexOf(swiperRef.activeIndex));
|
|
|
|
});
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|