From dec69cc67b060eec244eb8d2df7dcd362359514b Mon Sep 17 00:00:00 2001
From: syuilo <Syuilotan@yahoo.co.jp>
Date: Sun, 17 Oct 2021 16:26:35 +0900
Subject: enhance: ユーザー検索の精度を強化
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

---
 src/client/pages/explore.vue | 19 ++++++++++++++-----
 1 file changed, 14 insertions(+), 5 deletions(-)

(limited to 'src/client/pages/explore.vue')

diff --git a/src/client/pages/explore.vue b/src/client/pages/explore.vue
index 2ca0668611..596bc1f0ed 100644
--- a/src/client/pages/explore.vue
+++ b/src/client/pages/explore.vue
@@ -65,13 +65,18 @@
 			</div>
 			<div v-else-if="tab === 'search'">
 				<div class="_isolated">
-					<MkInput v-model="query" :debounce="true" type="search">
+					<MkInput v-model="searchQuery" :debounce="true" type="search">
 						<template #prefix><i class="fas fa-search"></i></template>
 						<template #label>{{ $ts.searchUser }}</template>
 					</MkInput>
+					<MkRadios v-model="searchScope">
+						<option value="local">{{ $ts.local }}</option>
+						<option value="remote">{{ $ts.remote }}</option>
+						<option value="both">{{ $ts.both }}</option>
+					</MkRadios>
 				</div>
 
-				<XUserList v-if="query" class="_gap" :pagination="searchPagination" ref="search"/>
+				<XUserList v-if="searchQuery" class="_gap" :pagination="searchPagination" ref="search"/>
 			</div>
 		</div>
 	</MkSpacer>
@@ -83,6 +88,7 @@ import { computed, defineComponent } from 'vue';
 import XUserList from '@client/components/user-list.vue';
 import MkFolder from '@client/components/ui/folder.vue';
 import MkInput from '@client/components/form/input.vue';
+import MkRadios from '@client/components/form/radios.vue';
 import number from '@client/filters/number';
 import * as os from '@client/os';
 import * as symbols from '@client/symbols';
@@ -92,6 +98,7 @@ export default defineComponent({
 		XUserList,
 		MkFolder,
 		MkInput,
+		MkRadios,
 	},
 
 	props: {
@@ -158,14 +165,16 @@ export default defineComponent({
 			searchPagination: {
 				endpoint: 'users/search',
 				limit: 10,
-				params: computed(() => (this.query && this.query !== '') ? {
-					query: this.query
+				params: computed(() => (this.searchQuery && this.searchQuery !== '') ? {
+					query: this.searchQuery,
+					scope: this.searchScope,
 				} : null)
 			},
 			tagsLocal: [],
 			tagsRemote: [],
 			stats: null,
-			query: null,
+			searchQuery: null,
+			searchScope: 'both',
 			num: number,
 		};
 	},
-- 
cgit v1.2.3-freya

