egirlskey/packages/frontend/src/pages/explore.vue

67 lines
1.5 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
2023-04-12 02:40:08 +00:00
<div>
<div v-if="tab === 'featured'">
<XFeatured/>
</div>
2022-07-13 09:09:41 +00:00
<div v-else-if="tab === 'users'">
<XUsers/>
</div>
<div v-else-if="tab === 'roles'">
<XRoles/>
</div>
</div>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { computed, watch } from 'vue';
import XFeatured from './explore.featured.vue';
import XUsers from './explore.users.vue';
import XRoles from './explore.roles.vue';
2023-01-09 00:41:25 +00:00
import MkFoldableSection from '@/components/MkFoldableSection.vue';
2023-09-19 07:37:43 +00:00
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { i18n } from '@/i18n.js';
const props = withDefaults(defineProps<{
tag?: string;
initialTab?: string;
}>(), {
initialTab: 'featured',
});
let tab = $ref(props.initialTab);
2023-01-09 00:41:25 +00:00
let tagsEl = $shallowRef<InstanceType<typeof MkFoldableSection>>();
watch(() => props.tag, () => {
if (tagsEl) tagsEl.toggleContent(props.tag == null);
});
const headerActions = $computed(() => []);
const headerTabs = $computed(() => [{
key: 'featured',
icon: 'ti ti-bolt',
title: i18n.ts.featured,
}, {
2022-07-13 09:09:41 +00:00
key: 'users',
icon: 'ti ti-users',
title: i18n.ts.users,
}, {
key: 'roles',
icon: 'ti ti-badges',
title: i18n.ts.roles,
}]);
definePageMetadata(computed(() => ({
title: i18n.ts.explore,
icon: 'ti ti-hash',
})));
</script>