summaryrefslogtreecommitdiff
path: root/packages/frontend/src/utility
diff options
context:
space:
mode:
authorHazelnoot <acomputerdog@gmail.com>2025-04-01 09:58:59 -0400
committerHazelnoot <acomputerdog@gmail.com>2025-04-01 09:59:46 -0400
commit7ff15816d1cc23ca89c89de0f9be84cbb3cf6abb (patch)
tree4c03b36b9bfe78469bf94017edeebe2357378eaf /packages/frontend/src/utility
parentMerge branch 'misskey-develop' into merge/2025-03-24 (diff)
parentBump version to 2025.4.0-beta.0 (diff)
downloadsharkey-7ff15816d1cc23ca89c89de0f9be84cbb3cf6abb.tar.gz
sharkey-7ff15816d1cc23ca89c89de0f9be84cbb3cf6abb.tar.bz2
sharkey-7ff15816d1cc23ca89c89de0f9be84cbb3cf6abb.zip
Merge branch 'misskey-develop' into merge/2025-03-24
# Conflicts: # .github/workflows/api-misskey-js.yml # .github/workflows/changelog-check.yml # .github/workflows/check-misskey-js-autogen.yml # .github/workflows/get-api-diff.yml # .github/workflows/lint.yml # .github/workflows/locale.yml # .github/workflows/on-release-created.yml # .github/workflows/storybook.yml # .github/workflows/test-backend.yml # .github/workflows/test-federation.yml # .github/workflows/test-frontend.yml # .github/workflows/test-misskey-js.yml # .github/workflows/test-production.yml # .github/workflows/validate-api-json.yml # locales/index.d.ts # package.json # packages/misskey-js/generator/package.json # packages/misskey-js/package.json # pnpm-lock.yaml # scripts/changelog-checker/package-lock.json # scripts/changelog-checker/package.json
Diffstat (limited to 'packages/frontend/src/utility')
-rw-r--r--packages/frontend/src/utility/autogen/settings-search-index.ts24
-rw-r--r--packages/frontend/src/utility/intl-string.ts21
2 files changed, 23 insertions, 22 deletions
diff --git a/packages/frontend/src/utility/autogen/settings-search-index.ts b/packages/frontend/src/utility/autogen/settings-search-index.ts
index 1563f19c34..08ab0d8811 100644
--- a/packages/frontend/src/utility/autogen/settings-search-index.ts
+++ b/packages/frontend/src/utility/autogen/settings-search-index.ts
@@ -37,11 +37,6 @@ export const searchIndexes: SearchIndexItem[] = [
label: i18n.ts.themeForDarkMode,
keywords: ['dark', 'theme'],
},
- {
- id: '8wcoRp76b',
- label: i18n.ts.setWallpaper,
- keywords: ['wallpaper'],
- },
],
label: i18n.ts.theme,
keywords: ['theme'],
@@ -861,40 +856,45 @@ export const searchIndexes: SearchIndexItem[] = [
keywords: ['sync', 'profiles', 'devices'],
},
{
- id: 'iEF0gqNAo',
+ id: 'wWH4pxMQN',
label: i18n.ts._deck.useSimpleUiForNonRootPages,
keywords: ['ui', 'root', 'page'],
},
{
- id: 'BNdSeWxZn',
+ id: '3LR509BvD',
label: i18n.ts.defaultNavigationBehaviour,
keywords: ['default', 'navigation', 'behaviour', 'window'],
},
{
- id: 'zT9pGm8DF',
+ id: 'ybU8RLXgm',
label: i18n.ts._deck.alwaysShowMainColumn,
keywords: ['always', 'show', 'main', 'column'],
},
{
- id: '5dk2xv1vc',
+ id: 'xRasZyAVl',
label: i18n.ts._deck.columnAlign,
keywords: ['column', 'align'],
},
{
- id: 'gtdEA4FTa',
+ id: '6qcyPd0oJ',
label: i18n.ts._deck.deckMenuPosition,
keywords: ['menu', 'position'],
},
{
- id: 'DHVFdPBT6',
+ id: '4zk2Now4S',
label: i18n.ts._deck.navbarPosition,
keywords: ['navbar', 'position'],
},
{
- id: '3UQ8rUssZ',
+ id: 'CGNtJ2I3n',
label: i18n.ts._deck.columnGap,
keywords: ['column', 'gap', 'margin'],
},
+ {
+ id: 'rxPDMo7bE',
+ label: i18n.ts.setWallpaper,
+ keywords: ['wallpaper'],
+ },
],
label: i18n.ts.deck,
keywords: ['deck', 'ui'],
diff --git a/packages/frontend/src/utility/intl-string.ts b/packages/frontend/src/utility/intl-string.ts
index a5b5bbb592..4bc51e2cb0 100644
--- a/packages/frontend/src/utility/intl-string.ts
+++ b/packages/frontend/src/utility/intl-string.ts
@@ -9,9 +9,9 @@ import type { toHiragana as toHiraganaType } from 'wanakana';
let toHiragana: typeof toHiraganaType = (str?: string) => str ?? '';
let isWanakanaLoaded = false;
-/**
+/**
* ローマ字変換のセットアップ(日本語以外の環境で読み込まないのでlazy-loading)
- *
+ *
* ここの比較系関数を使う際は事前に呼び出す必要がある
*/
export async function initIntlString(forceWanakana = false) {
@@ -82,16 +82,17 @@ export function normalizeStringWithHiragana(str: string) {
/** aとbが同じかどうか */
export function compareStringEquals(a: string, b: string) {
- return (
- normalizeString(a) === normalizeString(b) ||
- normalizeStringWithHiragana(a) === normalizeStringWithHiragana(b)
- );
+ if (a === b) return true; // まったく同じ場合はtrue。なお、ノーマライズ前後で文字数が変化することがあるため、文字数が違うからといってfalseにはできない
+ if (normalizeString(a) === normalizeString(b)) return true;
+ if (normalizeStringWithHiragana(a) === normalizeStringWithHiragana(b)) return true;
+ return false;
}
/** baseにqueryが含まれているかどうか */
export function compareStringIncludes(base: string, query: string) {
- return (
- normalizeString(base).includes(normalizeString(query)) ||
- normalizeStringWithHiragana(base).includes(normalizeStringWithHiragana(query))
- );
+ if (base === query) return true; // まったく同じ場合は含まれていると考えてよいのでtrue
+ if (base.includes(query)) return true;
+ if (normalizeString(base).includes(normalizeString(query))) return true;
+ if (normalizeStringWithHiragana(base).includes(normalizeStringWithHiragana(query))) return true;
+ return false;
}