Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle shift-clicking on a whole cell full of perks in Compare #10681

Merged
merged 1 commit into from
Aug 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 15 additions & 10 deletions src/app/organizer/Columns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,16 @@ const perkStringSort: Comparator<string | undefined> = (a, b) => {
return 0;
};

const perkStringFilter = (value: string | undefined) => {
if (!value) {
return undefined;
}
return value
.split(',')
.map((perk) => `exactperk:"${perk}"`)
.join(' ');
};

/**
* This function generates the columns.
*/
Expand Down Expand Up @@ -582,8 +592,7 @@ export function getColumns(
/>
),
sort: perkStringSort,
filter: (value) =>
typeof value === 'string' ? `exactperk:${quoteFilterString(value)}` : undefined,
filter: perkStringFilter,
}),
c({
id: 'perks',
Expand All @@ -601,8 +610,7 @@ export function getColumns(
<PerksCell item={item} sockets={getSockets(item, 'all')} onPlugClicked={onPlugClicked} />
),
sort: perkStringSort,
filter: (value) =>
typeof value === 'string' ? `exactperk:${quoteFilterString(value)}` : undefined,
filter: perkStringFilter,
csv: (_value, item, { maxPerks }) => {
// This could go on any of the perks columns, since it computes a very
// different view of perks, but I just picked one.
Expand Down Expand Up @@ -635,8 +643,7 @@ export function getColumns(
/>
),
sort: perkStringSort,
filter: (value) =>
typeof value === 'string' ? `exactperk:${quoteFilterString(value)}` : undefined,
filter: perkStringFilter,
}),

destinyVersion === 2 &&
Expand All @@ -654,8 +661,7 @@ export function getColumns(
/>
),
sort: perkStringSort,
filter: (value) =>
typeof value === 'string' ? `exactperk:${quoteFilterString(value)}` : undefined,
filter: perkStringFilter,
}),
destinyVersion === 2 &&
!isSpreadsheet &&
Expand All @@ -671,8 +677,7 @@ export function getColumns(
/>
),
sort: perkStringSort,
filter: (value) =>
typeof value === 'string' ? `exactperk:${quoteFilterString(value)}` : undefined,
filter: perkStringFilter,
}),
...statColumns,
...baseStatColumns,
Expand Down
Loading