Skip to content

Commit

Permalink
Merge pull request #10421 from DestinyItemManager/range-inloadout
Browse files Browse the repository at this point in the history
Add range search to `inloadout:`
  • Loading branch information
bhollis authored May 20, 2024
2 parents 89e46a2 + a4a66a9 commit 00a061f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion config/i18n.json
Original file line number Diff line number Diff line change
Expand Up @@ -250,7 +250,7 @@
"HasShader": "Shows items that have a shader applied.",
"HasOrnament": "Shows items that have an ornament applied.",
"Harrowed": "\\(Harrowed\\)",
"InLoadout": "is:inloadout shows items that are included in any loadout. Searching with inloadout: shows items that are included in loadouts with matching titles. When used with a hashtag, inloadout: shows items whose loadouts have the hashtag in the title or notes.",
"InLoadout": "is:inloadout shows items that are included in any loadout. Searching with inloadout: shows items that are included in loadouts with matching titles. When used with a hashtag, inloadout: shows items whose loadouts have the hashtag in the title or notes. When used with a range, it shows items that are in that many loadouts.",
"InInGameLoadout": "is:iningameloadout shows items that are included in any in-game loadout.",
"InDimLoadout": "is:indimloadout shows items that are included in any DIM loadout.",
"Infusable": "Shows items that can be infused.",
Expand Down
12 changes: 8 additions & 4 deletions src/app/search/search-filters/loadouts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ export function loadoutToSuggestions(loadout: Loadout) {
const loadoutFilters: FilterDefinition[] = [
{
keywords: 'inloadout',
format: ['simple', 'freeform'],

format: ['simple', 'range', 'freeform'],
suggestionsGenerator: ({ loadouts }) => loadouts?.flatMap(loadoutToSuggestions),

description: tl('Filter.InLoadout'),
filter: ({ lhs, filterValue, loadoutsByItem }) => {
filter: ({ lhs, filterValue, loadoutsByItem, compare }) => {
// the range search for how many loadouts an item is in:
// inloadout:>=3
if (compare) {
return (item) => compare(loadoutsByItem[item.id]?.length ?? 0);
}

// the default search:
// is:inloadout
if (lhs === 'is') {
Expand Down
2 changes: 1 addition & 1 deletion src/locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@
"HoldsMod": "Shows armor compatible with a specific type of Seasonal Mod.",
"InDimLoadout": "is:indimloadout shows items that are included in any DIM loadout.",
"InInGameLoadout": "is:iningameloadout shows items that are included in any in-game loadout.",
"InLoadout": "is:inloadout shows items that are included in any loadout. Searching with inloadout: shows items that are included in loadouts with matching titles. When used with a hashtag, inloadout: shows items whose loadouts have the hashtag in the title or notes.",
"InLoadout": "is:inloadout shows items that are included in any loadout. Searching with inloadout: shows items that are included in loadouts with matching titles. When used with a hashtag, inloadout: shows items whose loadouts have the hashtag in the title or notes. When used with a range, it shows items that are in that many loadouts.",
"Infusable": "Shows items that can be infused.",
"InfusionFodder": "Shows items that could be infused into lower-power versions of the same item for only glimmer.",
"IsAdept": "Shows weapons compatible with Adept mods.",
Expand Down

0 comments on commit 00a061f

Please sign in to comment.