enhance(frontend): ノート検索ページのデザイン調整 (#14780)
* enhance(frontend): 検索ページのホスト指定とユーザー指定を統合する (#273) (cherry picked from commit c79392c88d6bf58ede39d8bba9ca2778c58521ef) * fix * 🎨 * Update Changelog * Update Changelog * refactor --------- Co-authored-by: taiy <53635909+taiyme@users.noreply.github.com>
This commit is contained in:
@@ -19,7 +19,7 @@ SPDX-License-Identifier: AGPL-3.0-only
|
||||
|
||||
<MkFoldableSection v-if="userPagination">
|
||||
<template #header>{{ i18n.ts.searchResult }}</template>
|
||||
<MkUserList :key="key" :pagination="userPagination"/>
|
||||
<MkUserList :key="`searchUsers:${key}`" :pagination="userPagination"/>
|
||||
</MkFoldableSection>
|
||||
</div>
|
||||
</template>
|
||||
@@ -49,14 +49,16 @@ const props = withDefaults(defineProps<{
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
const key = ref('');
|
||||
const key = ref(0);
|
||||
const userPagination = ref<Paging<'users/search'>>();
|
||||
|
||||
const searchQuery = ref(toRef(props, 'query').value);
|
||||
const searchOrigin = ref(toRef(props, 'origin').value);
|
||||
const userPagination = ref<Paging>();
|
||||
|
||||
async function search() {
|
||||
const query = searchQuery.value.toString().trim();
|
||||
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
if (query == null || query === '') return;
|
||||
|
||||
//#region AP lookup
|
||||
@@ -76,6 +78,7 @@ async function search() {
|
||||
|
||||
if (res.type === 'User') {
|
||||
router.push(`/@${res.object.username}@${res.object.host}`);
|
||||
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition
|
||||
} else if (res.type === 'Note') {
|
||||
router.push(`/notes/${res.object.id}`);
|
||||
}
|
||||
@@ -118,6 +121,6 @@ async function search() {
|
||||
},
|
||||
};
|
||||
|
||||
key.value = query;
|
||||
key.value++;
|
||||
}
|
||||
</script>
|
||||
|
Reference in New Issue
Block a user