2020-01-30 04:37:25 +09:00
|
|
|
<template>
|
2022-06-20 17:38:49 +09:00
|
|
|
<MkStickyContainer>
|
2022-06-22 16:29:21 +09:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
2022-07-01 23:33:47 +09:00
|
|
|
<div class="lznhrdub">
|
|
|
|
<div v-if="tab === 'featured'">
|
|
|
|
<XFeatured/>
|
|
|
|
</div>
|
2022-07-13 18:09:41 +09:00
|
|
|
<div v-else-if="tab === 'users'">
|
|
|
|
<XUsers/>
|
2022-07-01 23:33:47 +09:00
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'search'">
|
2022-07-05 22:40:15 +09:00
|
|
|
<MkSpacer :content-max="1200">
|
|
|
|
<div>
|
2023-01-05 21:04:56 +09:00
|
|
|
<MkInput v-model="searchQuery" :debounce="true" type="search">
|
2022-12-19 19:01:30 +09:00
|
|
|
<template #prefix><i class="ti ti-search"></i></template>
|
2022-07-20 22:24:26 +09:00
|
|
|
<template #label>{{ i18n.ts.searchUser }}</template>
|
2022-07-05 22:40:15 +09:00
|
|
|
</MkInput>
|
2023-01-05 21:04:56 +09:00
|
|
|
<MkRadios v-model="searchOrigin">
|
2022-07-20 22:24:26 +09:00
|
|
|
<option value="combined">{{ i18n.ts.all }}</option>
|
|
|
|
<option value="local">{{ i18n.ts.local }}</option>
|
|
|
|
<option value="remote">{{ i18n.ts.remote }}</option>
|
2022-07-05 22:40:15 +09:00
|
|
|
</MkRadios>
|
|
|
|
</div>
|
2021-10-10 15:19:16 +09:00
|
|
|
|
2023-01-05 21:04:56 +09:00
|
|
|
<XUserList v-if="searchQuery" ref="searchEl" class="_margin" :pagination="searchPagination"/>
|
2022-07-05 22:40:15 +09:00
|
|
|
</MkSpacer>
|
2021-10-10 15:19:16 +09:00
|
|
|
</div>
|
2022-07-01 23:33:47 +09:00
|
|
|
</div>
|
2022-06-20 17:38:49 +09:00
|
|
|
</MkStickyContainer>
|
2020-01-30 04:37:25 +09:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
<script lang="ts" setup>
|
2022-07-01 23:33:47 +09:00
|
|
|
import { computed, watch } from 'vue';
|
|
|
|
import XFeatured from './explore.featured.vue';
|
|
|
|
import XUsers from './explore.users.vue';
|
2022-09-06 18:21:49 +09:00
|
|
|
import MkFolder from '@/components/MkFolder.vue';
|
2021-11-12 02:02:25 +09:00
|
|
|
import MkInput from '@/components/form/input.vue';
|
|
|
|
import MkRadios from '@/components/form/radios.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';
|
|
|
|
import { instance } from '@/instance';
|
2022-08-31 00:24:33 +09:00
|
|
|
import XUserList from '@/components/MkUserList.vue';
|
2022-06-20 17:38:49 +09:00
|
|
|
|
2023-01-02 13:19:32 +09:00
|
|
|
const props = withDefaults(defineProps<{
|
2022-06-20 17:38:49 +09:00
|
|
|
tag?: string;
|
2023-01-02 13:19:32 +09:00
|
|
|
initialTab?: string;
|
|
|
|
}>(), {
|
|
|
|
initialTab: 'featured',
|
|
|
|
});
|
2022-06-20 17:38:49 +09:00
|
|
|
|
2023-01-02 13:19:32 +09:00
|
|
|
let tab = $ref(props.initialTab);
|
2023-01-03 13:37:32 +09:00
|
|
|
let tagsEl = $shallowRef<InstanceType<typeof MkFolder>>();
|
2022-06-20 17:38:49 +09:00
|
|
|
let searchQuery = $ref(null);
|
|
|
|
let searchOrigin = $ref('combined');
|
|
|
|
|
|
|
|
watch(() => props.tag, () => {
|
|
|
|
if (tagsEl) tagsEl.toggleContent(props.tag == null);
|
|
|
|
});
|
2020-01-30 04:37:25 +09:00
|
|
|
|
2022-06-20 17:38:49 +09:00
|
|
|
const searchPagination = {
|
|
|
|
endpoint: 'users/search' as const,
|
|
|
|
limit: 10,
|
|
|
|
params: computed(() => (searchQuery && searchQuery !== '') ? {
|
|
|
|
query: searchQuery,
|
|
|
|
origin: searchOrigin,
|
|
|
|
} : null),
|
|
|
|
};
|
|
|
|
|
|
|
|
const headerActions = $computed(() => []);
|
|
|
|
|
|
|
|
const headerTabs = $computed(() => [{
|
2022-07-01 23:33:47 +09:00
|
|
|
key: 'featured',
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-bolt',
|
2022-07-01 23:33:47 +09:00
|
|
|
title: i18n.ts.featured,
|
2022-06-20 17:38:49 +09:00
|
|
|
}, {
|
2022-07-13 18:09:41 +09:00
|
|
|
key: 'users',
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-users',
|
2022-07-01 23:33:47 +09:00
|
|
|
title: i18n.ts.users,
|
2022-06-20 17:38:49 +09:00
|
|
|
}, {
|
2022-06-22 16:29:21 +09:00
|
|
|
key: 'search',
|
2022-06-20 17:38:49 +09:00
|
|
|
title: i18n.ts.search,
|
|
|
|
}]);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.explore,
|
2022-12-19 19:01:30 +09:00
|
|
|
icon: 'ti ti-hash',
|
2022-06-20 17:38:49 +09:00
|
|
|
})));
|
2020-01-30 04:37:25 +09:00
|
|
|
</script>
|