2023-07-27 07:31:52 +02:00
|
|
|
<!--
|
2024-02-13 16:59:27 +01:00
|
|
|
SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 07:31:52 +02:00
|
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
-->
|
|
|
|
|
2020-01-29 20:37:25 +01:00
|
|
|
<template>
|
2022-06-20 10:38:49 +02:00
|
|
|
<MkStickyContainer>
|
2023-03-16 03:56:20 +01:00
|
|
|
<template #header><MkPageHeader v-model:tab="tab" :actions="headerActions" :tabs="headerTabs"/></template>
|
|
|
|
|
2024-01-18 10:21:33 +01:00
|
|
|
<MkHorizontalSwipe v-model:tab="tab" :tabs="headerTabs">
|
|
|
|
<MkSpacer v-if="tab === 'note'" key="note" :contentMax="800">
|
2024-07-30 08:51:08 +02:00
|
|
|
<div v-if="notesSearchAvailable || ignoreNotesSearchAvailable">
|
|
|
|
<XNote v-bind="props"/>
|
2024-01-18 10:21:33 +01:00
|
|
|
</div>
|
|
|
|
<div v-else>
|
|
|
|
<MkInfo warn>{{ i18n.ts.notesSearchNotAvailable }}</MkInfo>
|
|
|
|
</div>
|
|
|
|
</MkSpacer>
|
|
|
|
|
|
|
|
<MkSpacer v-else-if="tab === 'user'" key="user" :contentMax="800">
|
2024-07-30 08:51:08 +02:00
|
|
|
<XUser v-bind="props"/>
|
2024-01-18 10:21:33 +01:00
|
|
|
</MkSpacer>
|
|
|
|
</MkHorizontalSwipe>
|
2022-06-20 10:38:49 +02:00
|
|
|
</MkStickyContainer>
|
2020-01-29 20:37:25 +01:00
|
|
|
</template>
|
|
|
|
|
2022-01-12 18:21:43 +01:00
|
|
|
<script lang="ts" setup>
|
2024-07-30 08:51:08 +02:00
|
|
|
import { computed, defineAsyncComponent, ref, toRef } from 'vue';
|
2023-09-19 09:37:43 +02:00
|
|
|
import { i18n } from '@/i18n.js';
|
|
|
|
import { definePageMetadata } from '@/scripts/page-metadata.js';
|
2024-07-30 08:51:08 +02:00
|
|
|
import { notesSearchAvailable } from '@/scripts/check-permissions.js';
|
2023-03-16 03:56:20 +01:00
|
|
|
import MkInfo from '@/components/MkInfo.vue';
|
2024-01-18 10:21:33 +01:00
|
|
|
import MkHorizontalSwipe from '@/components/MkHorizontalSwipe.vue';
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2024-07-30 08:51:08 +02:00
|
|
|
const props = withDefaults(defineProps<{
|
|
|
|
query?: string,
|
|
|
|
userId?: string,
|
|
|
|
username?: string,
|
|
|
|
host?: string | null,
|
|
|
|
type?: 'note' | 'user',
|
|
|
|
origin?: 'combined' | 'local' | 'remote',
|
|
|
|
// For storybook only
|
|
|
|
ignoreNotesSearchAvailable?: boolean,
|
|
|
|
}>(), {
|
|
|
|
query: '',
|
|
|
|
userId: undefined,
|
|
|
|
username: undefined,
|
|
|
|
host: undefined,
|
|
|
|
type: 'note',
|
|
|
|
origin: 'combined',
|
|
|
|
ignoreNotesSearchAvailable: false,
|
|
|
|
});
|
|
|
|
|
2023-05-11 11:10:34 +02:00
|
|
|
const XNote = defineAsyncComponent(() => import('./search.note.vue'));
|
|
|
|
const XUser = defineAsyncComponent(() => import('./search.user.vue'));
|
2020-01-29 20:37:25 +01:00
|
|
|
|
2024-07-30 08:51:08 +02:00
|
|
|
const tab = ref(toRef(props, 'type').value);
|
2023-02-25 01:01:21 +01:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerActions = computed(() => []);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2023-12-07 06:42:09 +01:00
|
|
|
const headerTabs = computed(() => [{
|
2023-03-16 03:56:20 +01:00
|
|
|
key: 'note',
|
|
|
|
title: i18n.ts.notes,
|
|
|
|
icon: 'ti ti-pencil',
|
|
|
|
}, {
|
|
|
|
key: 'user',
|
|
|
|
title: i18n.ts.users,
|
|
|
|
icon: 'ti ti-users',
|
|
|
|
}]);
|
2022-06-20 10:38:49 +02:00
|
|
|
|
2024-02-16 08:17:09 +01:00
|
|
|
definePageMetadata(() => ({
|
2023-05-11 11:10:34 +02:00
|
|
|
title: i18n.ts.search,
|
2022-12-19 11:01:30 +01:00
|
|
|
icon: 'ti ti-search',
|
2024-02-16 08:17:09 +01:00
|
|
|
}));
|
2020-01-29 20:37:25 +01:00
|
|
|
</script>
|