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

60 lines
1.7 KiB
Vue
Raw Normal View History

<!--
SPDX-FileCopyrightText: syuilo and other misskey contributors
SPDX-License-Identifier: AGPL-3.0-only
-->
<template>
<MkStickyContainer>
2023-03-16 02:56:20 +00:00
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkHorizontalSwipe v-model:tab="tab" :tabs="headerTabs">
<MkSpacer v-if="tab === 'note'" key="note" :contentMax="800">
<div v-if="notesSearchAvailable">
<XNote/>
</div>
<div v-else>
<MkInfo warn>{{ i18n.ts.notesSearchNotAvailable }}</MkInfo>
</div>
</MkSpacer>
<MkSpacer v-else-if="tab === 'user'" key="user" :contentMax="800">
<XUser/>
</MkSpacer>
</MkHorizontalSwipe>
</MkStickyContainer>
</template>
<script lang="ts" setup>
2023-12-21 02:36:45 +00:00
import { computed, defineAsyncComponent, ref } from 'vue';
2023-09-19 07:37:43 +00:00
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';
2023-03-16 02:56:20 +00:00
import MkInfo from '@/components/MkInfo.vue';
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
const XNote = defineAsyncComponent(() => import('./search.note.vue'));
const XUser = defineAsyncComponent(() => import('./search.user.vue'));
const tab = ref('note');
2023-03-16 02:56:20 +00:00
const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes));
const headerActions = computed(() => []);
const headerTabs = computed(() => [{
2023-03-16 02:56:20 +00:00
key: 'note',
title: i18n.ts.notes,
2023-09-30 19:53:52 +00:00
icon: 'ph-pencil ph-bold ph-lg',
2023-03-16 02:56:20 +00:00
}, {
key: 'user',
title: i18n.ts.users,
icon: 'ph-users ph-bold ph-lg',
2023-03-16 02:56:20 +00:00
}]);
definePageMetadata(computed(() => ({
title: i18n.ts.search,
2023-09-30 19:53:52 +00:00
icon: 'ph-magnifying-glass ph-bold ph-lg',
})));
</script>