mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
exclude uncategorized from search and make sure list is always correct
This commit is contained in:
parent
c2f6b80246
commit
0d40a7d865
@ -39,6 +39,30 @@ export const BoardsList = ({ isPrivate }: { isPrivate?: boolean }) => {
|
||||
});
|
||||
}, [boardSearchText, boards, isPrivate]);
|
||||
|
||||
const boardElements = useMemo(() => {
|
||||
const elements = [];
|
||||
if (allowPrivateBoards && isPrivate && !boardSearchText.length) {
|
||||
elements.push(<NoBoardBoard isSelected={selectedBoardId === 'none'} />);
|
||||
}
|
||||
|
||||
if (!allowPrivateBoards && !boardSearchText.length) {
|
||||
elements.push(<NoBoardBoard isSelected={selectedBoardId === 'none'} />);
|
||||
}
|
||||
|
||||
filteredBoards.forEach((board) => {
|
||||
elements.push(
|
||||
<GalleryBoard
|
||||
board={board}
|
||||
isSelected={selectedBoardId === board.board_id}
|
||||
setBoardToDelete={setBoardToDelete}
|
||||
key={board.board_id}
|
||||
/>
|
||||
);
|
||||
});
|
||||
|
||||
return elements;
|
||||
}, [filteredBoards, isPrivate, allowPrivateBoards, boardSearchText, selectedBoardId]);
|
||||
|
||||
const boardListTitle = useMemo(() => {
|
||||
if (allowPrivateBoards) {
|
||||
return isPrivate ? t('boards.private') : t('boards.shared');
|
||||
@ -80,24 +104,13 @@ export const BoardsList = ({ isPrivate }: { isPrivate?: boolean }) => {
|
||||
</Flex>
|
||||
<Collapse in={isOpen}>
|
||||
<Flex direction="column" gap={1}>
|
||||
{(allowPrivateBoards && isPrivate) || !allowPrivateBoards ? (
|
||||
<NoBoardBoard isSelected={selectedBoardId === 'none'} />
|
||||
) : !filteredBoards.length ? (
|
||||
<Text variant="subtext" textAlign="center">
|
||||
{t('boards.noBoards', { boardType: isPrivate ? 'Private' : '' })}
|
||||
</Text>
|
||||
{boardElements.length ? (
|
||||
<>{boardElements}</>
|
||||
) : (
|
||||
<></>
|
||||
<Text variant="subtext" textAlign="center">
|
||||
{t('boards.noBoards', { boardType: boardSearchText.length ? 'Matching' : '' })}
|
||||
</Text>
|
||||
)}
|
||||
|
||||
{filteredBoards.map((board) => (
|
||||
<GalleryBoard
|
||||
board={board}
|
||||
isSelected={selectedBoardId === board.board_id}
|
||||
setBoardToDelete={setBoardToDelete}
|
||||
key={board.board_id}
|
||||
/>
|
||||
))}
|
||||
</Flex>
|
||||
</Collapse>
|
||||
</Flex>
|
||||
|
@ -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' }));
|
||||
@ -47,6 +48,10 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
|
||||
|
||||
const { t } = useTranslation();
|
||||
|
||||
if (boardSearchText.length) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return (
|
||||
<NoBoardBoardContextMenu>
|
||||
{(ref) => (
|
||||
|
Loading…
Reference in New Issue
Block a user