mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-27 04:29:50 +01:00
feat: legendary camo names in search
This commit is contained in:
1 parent
3058756346
commit
ea7d822420
5 files changed
+33
-24
No files matched your search
@@ -17,9 +17,9 @@ import { resolveReload } from '../../../../../core/blitzkit/resolveReload';
|
|||||||
import {
|
import {
|
||||||
TankDefinition,
|
TankDefinition,
|
||||||
tankDefinitions,
|
tankDefinitions,
|
||||||
tankNames,
|
|
||||||
tanksDefinitionsArray,
|
tanksDefinitionsArray,
|
||||||
} from '../../../../../core/blitzkit/tankDefinitions';
|
} from '../../../../../core/blitzkit/tankDefinitions';
|
||||||
|
import { tankNames } from '../../../../../core/blitzkit/tankDefinitions/tankNames';
|
||||||
import { unionBoundingBox } from '../../../../../core/blitzkit/unionBoundingBox';
|
import { unionBoundingBox } from '../../../../../core/blitzkit/unionBoundingBox';
|
||||||
import { useAdExempt } from '../../../../../hooks/useAdExempt';
|
import { useAdExempt } from '../../../../../hooks/useAdExempt';
|
||||||
import * as TankFilters from '../../../../../stores/tankFilters';
|
import * as TankFilters from '../../../../../stores/tankFilters';
|
||||||
@@ -375,7 +375,7 @@ export const TankSearch = memo<TankSearchProps>(
|
|||||||
return sort.direction === 'ascending' ? sorted : sorted.reverse();
|
return sort.direction === 'ascending' ? sorted : sorted.reverse();
|
||||||
} else {
|
} else {
|
||||||
const searchedRaw = go(filters.search, awaitedTankNames, {
|
const searchedRaw = go(filters.search, awaitedTankNames, {
|
||||||
keys: ['searchableName', 'searchableNameDeburr'],
|
keys: ['searchableName', 'searchableNameDeburr', 'camouflages'],
|
||||||
});
|
});
|
||||||
const searchedTanks = searchedRaw.map(
|
const searchedTanks = searchedRaw.map(
|
||||||
(result) => awaitedTankDefinitions[result.obj.id],
|
(result) => awaitedTankDefinitions[result.obj.id],
|
||||||
|
|||||||
@@ -2,7 +2,8 @@ import { Locale } from 'discord.js';
|
|||||||
import { go } from 'fuzzysort';
|
import { go } from 'fuzzysort';
|
||||||
import markdownEscape from 'markdown-escape';
|
import markdownEscape from 'markdown-escape';
|
||||||
import { UserError } from '../../hooks/userError';
|
import { UserError } from '../../hooks/userError';
|
||||||
import { tankDefinitions, tankNames } from '../blitzkit/tankDefinitions';
|
import { tankDefinitions } from '../blitzkit/tankDefinitions';
|
||||||
|
import { tankNames } from '../blitzkit/tankDefinitions/tankNames';
|
||||||
import { tankNamesTechTreeOnly } from '../discord/autocompleteTanks';
|
import { tankNamesTechTreeOnly } from '../discord/autocompleteTanks';
|
||||||
import { translator } from '../localization/translator';
|
import { translator } from '../localization/translator';
|
||||||
|
|
||||||
@@ -19,7 +20,7 @@ export default async function resolveTankId(
|
|||||||
`${tank}`,
|
`${tank}`,
|
||||||
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
||||||
{
|
{
|
||||||
keys: ['searchableName', 'searchableNameDeburr'],
|
keys: ['searchableName', 'searchableNameDeburr', 'camouflages'],
|
||||||
limit: 1,
|
limit: 1,
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
import { deburr } from 'lodash';
|
|
||||||
import { Vector2Tuple } from 'three';
|
import { Vector2Tuple } from 'three';
|
||||||
import { TankClass, TreeType } from '../../../components/Tanks';
|
import { TankClass, TreeType } from '../../../components/Tanks';
|
||||||
import { asset } from '../asset';
|
import { asset } from '../asset';
|
||||||
@@ -181,23 +180,6 @@ export const tanksDefinitionsArray = new Promise<TankDefinition[]>(
|
|||||||
resolve((await entries).map((entry) => entry)); // TODO: wtf?
|
resolve((await entries).map((entry) => entry)); // TODO: wtf?
|
||||||
},
|
},
|
||||||
);
|
);
|
||||||
export const tankNames = tanksDefinitionsArray.then((tanks) =>
|
|
||||||
Promise.all(
|
|
||||||
tanks.map(async (tank, index) => {
|
|
||||||
const { id } = (await tanksDefinitionsArray)[index];
|
|
||||||
|
|
||||||
return {
|
|
||||||
id,
|
|
||||||
name: tank.name,
|
|
||||||
nameFull: tank.nameFull,
|
|
||||||
searchableName: tank.nameFull ?? tank.name,
|
|
||||||
searchableNameDeburr: deburr(tank.nameFull ?? tank.name),
|
|
||||||
treeType: tank.treeType,
|
|
||||||
};
|
|
||||||
}),
|
|
||||||
),
|
|
||||||
);
|
|
||||||
|
|
||||||
export type Tier = (typeof TIERS)[number];
|
export type Tier = (typeof TIERS)[number];
|
||||||
|
|
||||||
export const flags: Record<string, string> = {
|
export const flags: Record<string, string> = {
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
import { deburr } from 'lodash';
|
||||||
|
import { tanksDefinitionsArray } from '.';
|
||||||
|
import { camouflageDefinitions } from '../camouflageDefinitions';
|
||||||
|
|
||||||
|
export const tankNames = Promise.all([
|
||||||
|
tanksDefinitionsArray,
|
||||||
|
camouflageDefinitions,
|
||||||
|
]).then(([tanks, camouflages]) =>
|
||||||
|
Promise.all(
|
||||||
|
tanks.map(async (tank, index) => {
|
||||||
|
const { id } = (await tanksDefinitionsArray)[index];
|
||||||
|
|
||||||
|
return {
|
||||||
|
id,
|
||||||
|
name: tank.name,
|
||||||
|
nameFull: tank.nameFull,
|
||||||
|
searchableName: tank.nameFull ?? tank.name,
|
||||||
|
searchableNameDeburr: deburr(tank.nameFull ?? tank.name),
|
||||||
|
camouflages: tank.camouflages
|
||||||
|
?.map((id) => camouflages[id].name)
|
||||||
|
.join(' '),
|
||||||
|
treeType: tank.treeType,
|
||||||
|
};
|
||||||
|
}),
|
||||||
|
),
|
||||||
|
);
|
||||||
@@ -4,7 +4,7 @@ import {
|
|||||||
CacheType,
|
CacheType,
|
||||||
} from 'discord.js';
|
} from 'discord.js';
|
||||||
import { go } from 'fuzzysort';
|
import { go } from 'fuzzysort';
|
||||||
import { tankNames } from '../blitzkit/tankDefinitions';
|
import { tankNames } from '../blitzkit/tankDefinitions/tankNames';
|
||||||
import {
|
import {
|
||||||
DISCORD_CHOICES_MAX_NAME_SIZE,
|
DISCORD_CHOICES_MAX_NAME_SIZE,
|
||||||
OVERFLOW_SUFFIX,
|
OVERFLOW_SUFFIX,
|
||||||
@@ -29,7 +29,7 @@ export default async function autocompleteTanks(
|
|||||||
focusedOption.value,
|
focusedOption.value,
|
||||||
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
await (techTreeOnly ? tankNamesTechTreeOnly : tankNames),
|
||||||
{
|
{
|
||||||
keys: ['searchableName', 'searchableNameDeburr'],
|
keys: ['searchableName', 'searchableNameDeburr', 'camouflages'],
|
||||||
limit: 10,
|
limit: 10,
|
||||||
},
|
},
|
||||||
).map(async (item) => {
|
).map(async (item) => {
|
||||||
|
|||||||
Reference in new issue
Block a user