From 534a95761b1a2a83c3ccb431646f8b7744838357 Mon Sep 17 00:00:00 2001 From: syuilo <4439005+syuilo@users.noreply.github.com> Date: Sun, 16 Feb 2025 12:55:56 +0900 Subject: [PATCH] wip --- .../frontend/src/components/MkSuperMenu.vue | 25 +++--------------- .../frontend/src/pages/settings/index.vue | 7 ++--- .../frontend/src/scripts/settings-index.ts | 26 +++++++++++++++++++ 3 files changed, 33 insertions(+), 25 deletions(-) create mode 100644 packages/frontend/src/scripts/settings-index.ts diff --git a/packages/frontend/src/components/MkSuperMenu.vue b/packages/frontend/src/components/MkSuperMenu.vue index 7648ba310e..181597242c 100644 --- a/packages/frontend/src/components/MkSuperMenu.vue +++ b/packages/frontend/src/components/MkSuperMenu.vue @@ -76,41 +76,22 @@ import { ref, watch } from 'vue'; import MkInput from '@/components/MkInput.vue'; import { i18n } from '@/i18n.js'; -defineProps<{ +const props = defineProps<{ def: SuperMenuDef[]; grid?: boolean; + searchIndex: { id: string; path: string; locationLabel: string[]; keywords: string[]; icon?: string; }[]; }>(); const search = ref(''); const searchResult = ref([]); -const INDEX = [{ - id: '727cc9e8-ad67-474a-9241-b5a9a6475e47', - locationLabel: [i18n.ts.profile, i18n.ts._profile.name], - icon: 'ti ti-user', - keywords: ['name'], - path: '/settings/profile', -}, { - id: '1a06c7f9-e85e-46cb-bf5f-b3efa8e71b93', - locationLabel: [i18n.ts.profile, i18n.ts._profile.description], - icon: 'ti ti-user', - keywords: ['bio'], - path: '/settings/profile', -}, { - id: 'acbfe8cb-c3c9-4d90-8c62-713025814b2e', - locationLabel: [i18n.ts.privacy, i18n.ts.makeFollowManuallyApprove], - icon: 'ti ti-lock-open', - keywords: ['follow', 'lock', i18n.ts.lockedAccountInfo], - path: '/settings/privacy', -}]; - watch(search, (value) => { if (value === '') { searchResult.value = []; return; } - searchResult.value = INDEX.filter((item) => { + searchResult.value = props.searchIndex.filter((item) => { // TODO: 日本語でひらがなカタカナの区別をしない return item.locationLabel.some((x) => x.toLowerCase().includes(value.toLowerCase())) || item.keywords.some((x) => x.toLowerCase().includes(value.toLowerCase())); }); diff --git a/packages/frontend/src/pages/settings/index.vue b/packages/frontend/src/pages/settings/index.vue index bc6d6d0261..44e726cbc7 100644 --- a/packages/frontend/src/pages/settings/index.vue +++ b/packages/frontend/src/pages/settings/index.vue @@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
@@ -29,6 +29,8 @@ SPDX-License-Identifier: AGPL-3.0-only