filter out uncategorized when not included in search

This commit is contained in:
chainchompa 2024-07-09 14:52:03 -04:00 committed by Kent Keirsey
parent cdacf2ecd0
commit 8826adad24
2 changed files with 12 additions and 1 deletions

View File

@ -83,7 +83,7 @@ const BoardsList = (props: Props) => {
options={overlayScrollbarsParams.options}
>
<Flex direction="column" maxH={346} gap={1}>
{allowPrivateBoards && <NoBoardBoard isSelected={selectedBoardId === 'none'} />}
<NoBoardBoard isSelected={selectedBoardId === 'none'} />
{filteredPrivateBoards.map((board) => (
<GalleryBoard
board={board}

View File

@ -29,6 +29,7 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
});
const autoAddBoardId = useAppSelector((s) => s.gallery.autoAddBoardId);
const autoAssignBoardOnClick = useAppSelector((s) => s.gallery.autoAssignBoardOnClick);
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
const boardName = useBoardName('none');
const handleSelectBoard = useCallback(() => {
dispatch(boardIdSelected({ boardId: 'none' }));
@ -44,7 +45,17 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
}),
[]
);
const filteredOut = useMemo(() => {
return boardSearchText ? !boardName.toLowerCase().includes(boardSearchText.toLowerCase()) : false;
}, [boardName, boardSearchText]);
const { t } = useTranslation();
if (filteredOut) {
return null;
}
return (
<NoBoardBoardContextMenu>
{(ref) => (