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

58 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>
2023-03-16 11:56:20 +09:00
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
2023-05-19 16:20:53 +09:00
<MkSpacer v-if="tab === 'note'" :contentMax="800">
<div v-if="notesSearchAvailable">
<XNote/>
</div>
<div v-else>
2023-03-16 11:56:20 +09:00
<MkInfo warn>{{ i18n.ts.notesSearchNotAvailable }}</MkInfo>
</div>
</MkSpacer>
2023-05-19 16:20:53 +09:00
<MkSpacer v-else-if="tab === 'user'" :contentMax="800">
<XUser/>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted } from 'vue';
2023-09-19 16:37:43 +09:00
import { i18n } from '@/i18n.js';
import { definePageMetadata } from '@/scripts/page-metadata.js';
import * as os from '@/os.js';
import { $i } from '@/account.js';
import { instance } from '@/instance.js';
2023-03-16 11:56:20 +09:00
import MkInfo from '@/components/MkInfo.vue';
const XNote = defineAsyncComponent(() => import('./search.note.vue'));
const XUser = defineAsyncComponent(() => import('./search.user.vue'));
2023-03-16 11:56:20 +09:00
let tab = $ref('note');
const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes));
const headerActions = $computed(() => []);
2023-03-16 11:56:20 +09:00
const headerTabs = $computed(() => [{
key: 'note',
title: i18n.ts.notes,
2023-10-01 04:53:52 +09:00
icon: 'ph-pencil ph-bold ph-lg',
2023-03-16 11:56:20 +09:00
}, {
key: 'user',
title: i18n.ts.users,
2023-10-01 04:53:52 +09:00
icon: 'ph-users ph-bold pg-lg',
2023-03-16 11:56:20 +09:00
}]);
definePageMetadata(computed(() => ({
title: i18n.ts.search,
2023-10-01 04:53:52 +09:00
icon: 'ph-magnifying-glass ph-bold ph-lg',
})));
</script>