Skip to content

Commit

Permalink
Filter deleted puzzles group to match search string.
Browse files Browse the repository at this point in the history
  • Loading branch information
jpd236 committed Oct 16, 2024
1 parent c9c507b commit 64a28e9
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions imports/client/components/PuzzleListPage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -366,6 +366,7 @@ const PuzzleListView = ({
const renderList = useCallback(
(
retainedPuzzles: PuzzleType[],
retainedDeletedPuzzles: PuzzleType[] | undefined,
solvedOverConstrains: boolean,
allPuzzlesCount: number,
) => {
Expand Down Expand Up @@ -468,11 +469,11 @@ const PuzzleListView = ({
</PuzzleGroupDiv>
)}
{listComponent}
{deletedPuzzles && deletedPuzzles.length > 0 && (
{retainedDeletedPuzzles && retainedDeletedPuzzles.length > 0 && (
<RelatedPuzzleGroup
key="deleted"
huntId={huntId}
group={{ puzzles: deletedPuzzles, subgroups: [] }}
group={{ puzzles: retainedDeletedPuzzles, subgroups: [] }}
noSharedTagLabel="Deleted puzzles (operator only)"
bookmarked={bookmarked}
allTags={allTags}
Expand All @@ -489,7 +490,6 @@ const PuzzleListView = ({
huntId,
displayMode,
allPuzzles,
deletedPuzzles,
allTags,
canUpdate,
searchString,
Expand Down Expand Up @@ -553,6 +553,8 @@ const PuzzleListView = ({
const retainedPuzzles = solvedOverConstrains
? matchingSearch
: matchingSearchAndSolved;
const retainedDeletedPuzzles =
deletedPuzzles && puzzlesMatchingSearchString(deletedPuzzles);

return (
<div>
Expand Down Expand Up @@ -630,7 +632,12 @@ const PuzzleListView = ({
</InputGroup>
</SearchFormGroup>
</ViewControls>
{renderList(retainedPuzzles, solvedOverConstrains, allPuzzles.length)}
{renderList(
retainedPuzzles,
retainedDeletedPuzzles,
solvedOverConstrains,
allPuzzles.length,
)}
</div>
);
};
Expand Down

0 comments on commit 64a28e9

Please sign in to comment.