From bff813042e670dcb59a6b0dcc334ca44f880752b Mon Sep 17 00:00:00 2001
From: taichan <40626578+tai-cha@users.noreply.github.com>
Date: Tue, 30 Jul 2024 15:51:08 +0900
Subject: feat: このユーザーのノートを検索, クエリに基づく検索の初期値 &
ノート検索のUI改善 (#14128)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
* refactor(frontend): noteSearchAvailableをaccountsに移動
* feat: searchページでのクエリの受取りとtypeによる表示タブの変更
* user検索でsearchの親から受け取った値を基に入力値を初期化
* feat(frontend): ノート検索で親(search)からの情報を基にユーザー情報を取得
* feat(frontend): ユーザーのノートを検索するページに遷移するボタン
* feat(frontend): ノート検索にホスト名指定のオプション追加
also :art:
* style: ただ照会部分を囲っただけ(可読性確保のために)
* refactor: remove unneed import
defineProps and withDefaults are compiler micro when using `
+
diff --git a/packages/frontend/src/pages/search.stories.impl.ts b/packages/frontend/src/pages/search.stories.impl.ts
new file mode 100644
index 0000000000..0110a7ab8e
--- /dev/null
+++ b/packages/frontend/src/pages/search.stories.impl.ts
@@ -0,0 +1,88 @@
+/*
+ * SPDX-FileCopyrightText: syuilo and misskey-project
+ * SPDX-License-Identifier: AGPL-3.0-only
+ */
+
+import { StoryObj } from '@storybook/vue3';
+import { HttpResponse, http } from 'msw';
+import search_ from './search.vue';
+import { userDetailed } from '@/../.storybook/fakes.js';
+import { commonHandlers } from '@/../.storybook/mocks.js';
+
+const localUser = userDetailed('someuserid', 'miskist', null, 'Local Misskey User');
+
+export const Default = {
+ render(args) {
+ return {
+ components: {
+ search_,
+ },
+ setup() {
+ return {
+ args,
+ };
+ },
+ computed: {
+ props() {
+ return {
+ ...this.args,
+ };
+ },
+ },
+ template: '',
+ };
+ },
+ args: {
+ ignoreNotesSearchAvailable: true,
+ },
+ parameters: {
+ layout: 'fullscreen',
+ msw: {
+ handlers: [
+ ...commonHandlers,
+ http.post('/api/users/show', () => {
+ return HttpResponse.json(userDetailed());
+ }),
+ http.post('/api/users/search', () => {
+ return HttpResponse.json([userDetailed(), localUser]);
+ }),
+ ],
+ },
+ },
+} satisfies StoryObj;
+
+export const NoteSearchDisabled = {
+ ...Default,
+ args: {},
+} satisfies StoryObj;
+
+export const WithUsernameLocal = {
+ ...Default,
+
+ args: {
+ ...Default.args,
+ username: localUser.username,
+ host: localUser.host,
+ },
+ parameters: {
+ layout: 'fullscreen',
+ msw: {
+ handlers: [
+ ...commonHandlers,
+ http.post('/api/users/show', () => {
+ return HttpResponse.json(localUser);
+ }),
+ http.post('/api/users/search', () => {
+ return HttpResponse.json([userDetailed(), localUser]);
+ }),
+ ],
+ },
+ },
+} satisfies StoryObj;
+
+export const WithUserType = {
+ ...Default,
+ args: {
+ type: 'user',
+ },
+} satisfies StoryObj;
diff --git a/packages/frontend/src/pages/search.user.vue b/packages/frontend/src/pages/search.user.vue
index b9c2704bc7..85d869d9cb 100644
--- a/packages/frontend/src/pages/search.user.vue
+++ b/packages/frontend/src/pages/search.user.vue
@@ -25,7 +25,9 @@ SPDX-License-Identifier: AGPL-3.0-only