1
1
mirror of https://github.com/kokonect-link/cherrypick synced 2024-12-17 16:18:27 +09:00
cherrypick/packages/frontend/src/pages/search.vue

61 lines
1.6 KiB
Vue
Raw Normal View History

<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>
2023-04-24 02:37:42 +09:00
<MkSpacer v-else-if="tab === 'event'" :contentMax="800">
<XEvent/>
2023-04-24 02:37:42 +09:00
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent } from 'vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
2023-03-16 11:56:20 +09:00
import { $i } from '@/account';
import { instance } from '@/instance';
import MkInfo from '@/components/MkInfo.vue';
const XNote = defineAsyncComponent(() => import('./search.note.vue'));
const XUser = defineAsyncComponent(() => import('./search.user.vue'));
const XEvent = defineAsyncComponent(() => import('./search.event.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,
icon: 'ti ti-pencil',
}, {
key: 'user',
title: i18n.ts.users,
icon: 'ti ti-users',
2023-04-24 02:37:42 +09:00
}, {
key: 'event',
title: i18n.ts.events,
2023-04-24 02:37:42 +09:00
icon: 'ti ti-calendar',
2023-03-16 11:56:20 +09:00
}]);
definePageMetadata(computed(() => ({
title: i18n.ts.search,
icon: 'ti ti-search',
})));
</script>