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 Dec 21, 2024
1 parent 6b7b04c commit 795cdee
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 @@ -373,6 +373,7 @@ const PuzzleListView = ({
const renderList = useCallback(
(
retainedPuzzles: PuzzleType[],
retainedDeletedPuzzles: PuzzleType[] | undefined,
solvedOverConstrains: boolean,
allPuzzlesCount: number,
) => {
Expand Down Expand Up @@ -475,11 +476,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 @@ -496,7 +497,6 @@ const PuzzleListView = ({
huntId,
displayMode,
allPuzzles,
deletedPuzzles,
allTags,
canUpdate,
searchString,
Expand Down Expand Up @@ -560,6 +560,8 @@ const PuzzleListView = ({
const retainedPuzzles = solvedOverConstrains
? matchingSearch
: matchingSearchAndSolved;
const retainedDeletedPuzzles =
deletedPuzzles && puzzlesMatchingSearchString(deletedPuzzles);

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

0 comments on commit 795cdee

Please sign in to comment.