2020-01-29 11:37:25 -08: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-07-01 07:33:47 -07:00
|
|
|
<div class="lznhrdub">
|
|
|
|
<div v-if="tab === 'featured'">
|
|
|
|
<XFeatured/>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'localUsers'">
|
|
|
|
<XUsers origin="local"/>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'remoteUsers'">
|
|
|
|
<XUsers origin="remote"/>
|
|
|
|
</div>
|
|
|
|
<div v-else-if="tab === 'search'">
|
|
|
|
<div class="_isolated">
|
|
|
|
<MkInput v-model="searchQuery" :debounce="true" type="search">
|
|
|
|
<template #prefix><i class="fas fa-search"></i></template>
|
|
|
|
<template #label>{{ $ts.searchUser }}</template>
|
|
|
|
</MkInput>
|
|
|
|
<MkRadios v-model="searchOrigin">
|
|
|
|
<option value="combined">{{ $ts.all }}</option>
|
|
|
|
<option value="local">{{ $ts.local }}</option>
|
|
|
|
<option value="remote">{{ $ts.remote }}</option>
|
|
|
|
</MkRadios>
|
2021-10-09 23:19:16 -07:00
|
|
|
</div>
|
|
|
|
|
2022-07-01 07:33:47 -07:00
|
|
|
<XUserList v-if="searchQuery" ref="searchEl" class="_gap" :pagination="searchPagination"/>
|
2021-10-09 23:19:16 -07:00
|
|
|
</div>
|
2022-07-01 07:33:47 -07:00
|
|
|
</div>
|
2022-06-20 01:38:49 -07:00
|
|
|
</MkStickyContainer>
|
2020-01-29 11:37:25 -08:00
|
|
|
</template>
|
|
|
|
|
2022-06-20 01:38:49 -07:00
|
|
|
<script lang="ts" setup>
|
2022-07-01 07:33:47 -07:00
|
|
|
import { computed, watch } from 'vue';
|
|
|
|
import XFeatured from './explore.featured.vue';
|
|
|
|
import XUsers from './explore.users.vue';
|
2021-11-11 09:02:25 -08:00
|
|
|
import MkFolder from '@/components/ui/folder.vue';
|
|
|
|
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 01:38:49 -07:00
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata';
|
|
|
|
import { i18n } from '@/i18n';
|
|
|
|
import { instance } from '@/instance';
|
|
|
|
|
|
|
|
const props = defineProps<{
|
|
|
|
tag?: string;
|
|
|
|
}>();
|
|
|
|
|
2022-07-01 07:33:47 -07:00
|
|
|
let tab = $ref('featured');
|
2022-06-20 01:38:49 -07:00
|
|
|
let tagsEl = $ref<InstanceType<typeof MkFolder>>();
|
|
|
|
let searchQuery = $ref(null);
|
|
|
|
let searchOrigin = $ref('combined');
|
|
|
|
|
|
|
|
watch(() => props.tag, () => {
|
|
|
|
if (tagsEl) tagsEl.toggleContent(props.tag == null);
|
|
|
|
});
|
2020-01-29 11:37:25 -08:00
|
|
|
|
2022-06-20 01:38:49 -07: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 07:33:47 -07:00
|
|
|
key: 'featured',
|
|
|
|
icon: 'fas fa-bolt',
|
|
|
|
title: i18n.ts.featured,
|
2022-06-20 01:38:49 -07:00
|
|
|
}, {
|
2022-07-01 07:33:47 -07:00
|
|
|
key: 'localUsers',
|
|
|
|
icon: 'fas fa-users',
|
|
|
|
title: i18n.ts.users,
|
|
|
|
}, {
|
|
|
|
key: 'remoteUsers',
|
|
|
|
icon: 'fas fa-users',
|
2022-06-20 01:38:49 -07:00
|
|
|
title: i18n.ts.remote,
|
|
|
|
}, {
|
2022-06-22 00:29:21 -07:00
|
|
|
key: 'search',
|
2022-06-20 01:38:49 -07:00
|
|
|
title: i18n.ts.search,
|
|
|
|
}]);
|
|
|
|
|
|
|
|
definePageMetadata(computed(() => ({
|
|
|
|
title: i18n.ts.explore,
|
|
|
|
icon: 'fas fa-hashtag',
|
|
|
|
})));
|
2020-01-29 11:37:25 -08:00
|
|
|
</script>
|