mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-15 13:43:08 +02:00
406b4bdbe7
* refactor(frontend): 非推奨となったReactivity Transformを使わないように * refactor: 不要な括弧を除去 * fix: 不要なアノテーションを除去 * fix: Refの配列をrefしている部分の対応 * refactor: 不要な括弧を除去 * fix: lint * refactor: Ref、ShallowRef、ComputedRefの変数の宣言をletからconstに置換 * fix: type error * chore: drop reactivity transform from eslint configuration * refactor: remove unnecessary import * fix: 対応漏れ
82 lines
2.2 KiB
Vue
82 lines
2.2 KiB
Vue
<!--
|
|
SPDX-FileCopyrightText: syuilo and other misskey contributors
|
|
SPDX-License-Identifier: AGPL-3.0-only
|
|
-->
|
|
|
|
<template>
|
|
<div class="_gaps">
|
|
<div class="_gaps">
|
|
<MkInput v-model="searchQuery" :large="true" :autofocus="true" type="search">
|
|
<template #prefix><i class="ti ti-search"></i></template>
|
|
</MkInput>
|
|
<MkRadios v-model="searchOrigin" @update:modelValue="search()">
|
|
<option value="combined">{{ i18n.ts.all }}</option>
|
|
<option value="local">{{ i18n.ts.local }}</option>
|
|
<option value="remote">{{ i18n.ts.remote }}</option>
|
|
</MkRadios>
|
|
<MkButton large primary gradate rounded @click="search">{{ i18n.ts.search }}</MkButton>
|
|
</div>
|
|
|
|
<MkFoldableSection v-if="userPagination">
|
|
<template #header>{{ i18n.ts.searchResult }}</template>
|
|
<MkUserList :key="key" :pagination="userPagination"/>
|
|
</MkFoldableSection>
|
|
</div>
|
|
</template>
|
|
|
|
<script lang="ts" setup>
|
|
import { computed, defineAsyncComponent, onMounted, ref } from 'vue';
|
|
import MkUserList from '@/components/MkUserList.vue';
|
|
import MkInput from '@/components/MkInput.vue';
|
|
import MkRadios from '@/components/MkRadios.vue';
|
|
import MkButton from '@/components/MkButton.vue';
|
|
import { i18n } from '@/i18n.js';
|
|
import * as os from '@/os.js';
|
|
import MkFoldableSection from '@/components/MkFoldableSection.vue';
|
|
import { $i } from '@/account.js';
|
|
import { instance } from '@/instance.js';
|
|
import MkInfo from '@/components/MkInfo.vue';
|
|
import { useRouter } from '@/router.js';
|
|
|
|
const router = useRouter();
|
|
|
|
const key = ref('');
|
|
const searchQuery = ref('');
|
|
const searchOrigin = ref('combined');
|
|
const userPagination = ref();
|
|
|
|
async function search() {
|
|
const query = searchQuery.value.toString().trim();
|
|
|
|
if (query == null || query === '') return;
|
|
|
|
if (query.startsWith('https://')) {
|
|
const promise = os.api('ap/show', {
|
|
uri: query,
|
|
});
|
|
|
|
os.promiseDialog(promise, null, null, i18n.ts.fetchingAsApObject);
|
|
|
|
const res = await promise;
|
|
|
|
if (res.type === 'User') {
|
|
router.push(`/@${res.object.username}@${res.object.host}`);
|
|
} else if (res.type === 'Note') {
|
|
router.push(`/notes/${res.object.id}`);
|
|
}
|
|
|
|
return;
|
|
}
|
|
|
|
userPagination.value = {
|
|
endpoint: 'users/search',
|
|
limit: 10,
|
|
params: {
|
|
query: query,
|
|
origin: searchOrigin.value,
|
|
},
|
|
};
|
|
|
|
key.value = query;
|
|
}
|
|
</script>
|