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

53 lines
1.4 KiB
Vue
Raw Normal View History

<template>
<MkStickyContainer>
2023-03-16 03:56:20 +01:00
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
<MkSpacer v-if="tab === 'note'" :content-max="800">
<div v-if="notesSearchAvailable">
<XNote/>
</div>
<div v-else>
2023-03-16 03:56:20 +01:00
<MkInfo warn>{{ i18n.ts.notesSearchNotAvailable }}</MkInfo>
</div>
</MkSpacer>
<MkSpacer v-else-if="tab === 'user'" :content-max="800">
<XUser/>
</MkSpacer>
</MkStickyContainer>
</template>
<script lang="ts" setup>
import { computed, defineAsyncComponent, onMounted } from 'vue';
import { i18n } from '@/i18n';
import { definePageMetadata } from '@/scripts/page-metadata';
import * as os from '@/os';
2023-03-16 03:56:20 +01: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'));
2023-03-16 03:56:20 +01:00
let tab = $ref('note');
const notesSearchAvailable = (($i == null && instance.policies.canSearchNotes) || ($i != null && $i.policies.canSearchNotes));
const headerActions = $computed(() => []);
2023-03-16 03:56:20 +01:00
const headerTabs = $computed(() => [{
key: 'note',
title: i18n.ts.notes,
icon: 'ti ti-pencil',
}, {
key: 'user',
title: i18n.ts.users,
icon: 'ti ti-users',
}]);
definePageMetadata(computed(() => ({
title: i18n.ts.search,
icon: 'ti ti-search',
})));
</script>