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]);
|
}, [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(() => {
|
const boardListTitle = useMemo(() => {
|
||||||
if (allowPrivateBoards) {
|
if (allowPrivateBoards) {
|
||||||
return isPrivate ? t('boards.private') : t('boards.shared');
|
return isPrivate ? t('boards.private') : t('boards.shared');
|
||||||
@ -80,24 +104,13 @@ export const BoardsList = ({ isPrivate }: { isPrivate?: boolean }) => {
|
|||||||
</Flex>
|
</Flex>
|
||||||
<Collapse in={isOpen}>
|
<Collapse in={isOpen}>
|
||||||
<Flex direction="column" gap={1}>
|
<Flex direction="column" gap={1}>
|
||||||
{(allowPrivateBoards && isPrivate) || !allowPrivateBoards ? (
|
{boardElements.length ? (
|
||||||
<NoBoardBoard isSelected={selectedBoardId === 'none'} />
|
<>{boardElements}</>
|
||||||
) : !filteredBoards.length ? (
|
|
||||||
<Text variant="subtext" textAlign="center">
|
|
||||||
{t('boards.noBoards', { boardType: isPrivate ? 'Private' : '' })}
|
|
||||||
</Text>
|
|
||||||
) : (
|
) : (
|
||||||
<></>
|
<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>
|
</Flex>
|
||||||
</Collapse>
|
</Collapse>
|
||||||
</Flex>
|
</Flex>
|
||||||
|
@ -29,6 +29,7 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
|
|||||||
});
|
});
|
||||||
const autoAddBoardId = useAppSelector((s) => s.gallery.autoAddBoardId);
|
const autoAddBoardId = useAppSelector((s) => s.gallery.autoAddBoardId);
|
||||||
const autoAssignBoardOnClick = useAppSelector((s) => s.gallery.autoAssignBoardOnClick);
|
const autoAssignBoardOnClick = useAppSelector((s) => s.gallery.autoAssignBoardOnClick);
|
||||||
|
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
|
||||||
const boardName = useBoardName('none');
|
const boardName = useBoardName('none');
|
||||||
const handleSelectBoard = useCallback(() => {
|
const handleSelectBoard = useCallback(() => {
|
||||||
dispatch(boardIdSelected({ boardId: 'none' }));
|
dispatch(boardIdSelected({ boardId: 'none' }));
|
||||||
@ -47,6 +48,10 @@ const NoBoardBoard = memo(({ isSelected }: Props) => {
|
|||||||
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
|
if (boardSearchText.length) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NoBoardBoardContextMenu>
|
<NoBoardBoardContextMenu>
|
||||||
{(ref) => (
|
{(ref) => (
|
||||||
|
Loading…
Reference in New Issue
Block a user