This commit is contained in:
syuilo
2025-02-16 12:55:56 +09:00
parent a37a945f95
commit 534a95761b
3 changed files with 33 additions and 25 deletions

View File

@@ -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<any[]>([]);
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()));
});

View File

@@ -12,7 +12,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div v-if="!narrow || currentPage?.route.name == null" class="nav">
<div class="baaadecd">
<MkInfo v-if="emailNotConfigured" warn class="info">{{ i18n.ts.emailNotConfiguredWarning }} <MkA to="/settings/email" class="_link">{{ i18n.ts.configure }}</MkA></MkInfo>
<MkSuperMenu :def="menuDef" :grid="narrow"></MkSuperMenu>
<MkSuperMenu :def="menuDef" :grid="narrow" :searchIndex="SETTING_INDEX"></MkSuperMenu>
</div>
</div>
<div v-if="!(narrow && currentPage?.route.name == null)" class="main">
@@ -29,6 +29,8 @@ SPDX-License-Identifier: AGPL-3.0-only
<script setup lang="ts">
import { computed, onActivated, onMounted, onUnmounted, ref, shallowRef, watch } from 'vue';
import type { PageMetadata } from '@/scripts/page-metadata.js';
import type { SuperMenuDef } from '@/components/MkSuperMenu.vue';
import { i18n } from '@/i18n.js';
import MkInfo from '@/components/MkInfo.vue';
import MkSuperMenu from '@/components/MkSuperMenu.vue';
@@ -38,8 +40,7 @@ import { instance } from '@/instance.js';
import { definePageMetadata, provideMetadataReceiver, provideReactiveMetadata } from '@/scripts/page-metadata.js';
import * as os from '@/os.js';
import { useRouter } from '@/router/supplier.js';
import type { PageMetadata } from '@/scripts/page-metadata.js';
import type { SuperMenuDef } from '@/components/MkSuperMenu.vue';
import { SETTING_INDEX } from '@/scripts/settings-index.js';
const indexInfo = {
title: i18n.ts.settings,

View File

@@ -0,0 +1,26 @@
/*
* SPDX-FileCopyrightText: syuilo and misskey-project
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { i18n } from '@/i18n.js';
export const SETTING_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',
}];