feat(ui): make isPrivate required on BoardsList

This commit is contained in:
psychedelicious 2024-07-24 12:35:30 +10:00
parent ca8441a32f
commit 4e49689d46
2 changed files with 8 additions and 6 deletions

View File

@ -13,7 +13,11 @@ import AddBoardButton from './AddBoardButton';
import GalleryBoard from './GalleryBoard';
import NoBoardBoard from './NoBoardBoard';
export const BoardsList = ({ isPrivate }: { isPrivate?: boolean }) => {
type Props = {
isPrivate: boolean;
};
export const BoardsList = ({ isPrivate }: Props) => {
const { t } = useTranslation();
const selectedBoardId = useAppSelector((s) => s.gallery.selectedBoardId);
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
@ -30,11 +34,9 @@ export const BoardsList = ({ isPrivate }: { isPrivate?: boolean }) => {
return boards.filter((board) => {
if (boardSearchText.length) {
return (
board.is_private === !!isPrivate && board.board_name.toLowerCase().includes(boardSearchText.toLowerCase())
);
return board.is_private === isPrivate && board.board_name.toLowerCase().includes(boardSearchText.toLowerCase());
} else {
return board.is_private === !!isPrivate;
return board.is_private === isPrivate;
}
});
}, [boardSearchText, boards, isPrivate]);

View File

@ -20,7 +20,7 @@ const BoardsListWrapper = () => {
<Box position="absolute" top={0} right={0} bottom={0} left={0}>
<OverlayScrollbarsComponent defer style={overlayScrollbarsStyles} options={overlayScrollbarsParams.options}>
{allowPrivateBoards && <BoardsList isPrivate={true} />}
<BoardsList />
<BoardsList isPrivate={false} />
</OverlayScrollbarsComponent>
</Box>
</Box>