mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
remove collapsibles and update board title
This commit is contained in:
parent
8826adad24
commit
a96e34d2d1
@ -1,4 +1,4 @@
|
|||||||
import { Collapse, Flex, Icon, Text, useDisclosure } from '@invoke-ai/ui-library';
|
import { Flex, Icon, Text, useDisclosure } from '@invoke-ai/ui-library';
|
||||||
import { EMPTY_ARRAY } from 'app/store/constants';
|
import { EMPTY_ARRAY } from 'app/store/constants';
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants';
|
import { overlayScrollbarsParams } from 'common/components/OverlayScrollbars/constants';
|
||||||
@ -22,20 +22,13 @@ const overlayScrollbarsStyles: CSSProperties = {
|
|||||||
width: '100%',
|
width: '100%',
|
||||||
};
|
};
|
||||||
|
|
||||||
type Props = {
|
const BoardsList = () => {
|
||||||
isOpen: boolean;
|
|
||||||
};
|
|
||||||
|
|
||||||
const BoardsList = (props: Props) => {
|
|
||||||
const { isOpen } = props;
|
|
||||||
const selectedBoardId = useAppSelector((s) => s.gallery.selectedBoardId);
|
const selectedBoardId = useAppSelector((s) => s.gallery.selectedBoardId);
|
||||||
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
|
const boardSearchText = useAppSelector((s) => s.gallery.boardSearchText);
|
||||||
const allowPrivateBoards = useAppSelector((s) => s.config.allowPrivateBoards);
|
const allowPrivateBoards = useAppSelector((s) => s.config.allowPrivateBoards);
|
||||||
const queryArgs = useAppSelector(selectListBoardsQueryArgs);
|
const queryArgs = useAppSelector(selectListBoardsQueryArgs);
|
||||||
const { data: boards } = useListAllBoardsQuery(queryArgs);
|
const { data: boards } = useListAllBoardsQuery(queryArgs);
|
||||||
const [boardToDelete, setBoardToDelete] = useState<BoardDTO>();
|
const [boardToDelete, setBoardToDelete] = useState<BoardDTO>();
|
||||||
const privateBoardsDisclosure = useDisclosure({ defaultIsOpen: false });
|
|
||||||
const sharedBoardsDisclosure = useDisclosure({ defaultIsOpen: false });
|
|
||||||
const { t } = useTranslation();
|
const { t } = useTranslation();
|
||||||
|
|
||||||
const { filteredPrivateBoards, filteredSharedBoards } = useMemo(() => {
|
const { filteredPrivateBoards, filteredSharedBoards } = useMemo(() => {
|
||||||
@ -49,39 +42,17 @@ const BoardsList = (props: Props) => {
|
|||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
<Collapse in={isOpen} animateOpacity>
|
|
||||||
<Flex layerStyle="first" flexDir="column" gap={2} p={2} my={2} borderRadius="base">
|
<Flex layerStyle="first" flexDir="column" gap={2} p={2} my={2} borderRadius="base">
|
||||||
<BoardsSearch />
|
<BoardsSearch />
|
||||||
|
<OverlayScrollbarsComponent defer style={overlayScrollbarsStyles} options={overlayScrollbarsParams.options}>
|
||||||
{allowPrivateBoards && (
|
{allowPrivateBoards && (
|
||||||
<>
|
<>
|
||||||
<Flex w="full" gap={2}>
|
<Flex w="full" justifyContent="space-between" alignItems="center">
|
||||||
<Flex
|
|
||||||
flexGrow={1}
|
|
||||||
onClick={privateBoardsDisclosure.onToggle}
|
|
||||||
gap={2}
|
|
||||||
alignItems="center"
|
|
||||||
cursor="pointer"
|
|
||||||
>
|
|
||||||
<Icon
|
|
||||||
as={PiCaretUpBold}
|
|
||||||
boxSize={4}
|
|
||||||
transform={privateBoardsDisclosure.isOpen ? 'rotate(0deg)' : 'rotate(180deg)'}
|
|
||||||
transitionProperty="common"
|
|
||||||
transitionDuration="normal"
|
|
||||||
color="base.400"
|
|
||||||
/>
|
|
||||||
<Text fontSize="md" fontWeight="medium" userSelect="none">
|
<Text fontSize="md" fontWeight="medium" userSelect="none">
|
||||||
{t('boards.private')}
|
{t('boards.private')}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
|
||||||
<AddBoardButton isPrivateBoard={true} />
|
<AddBoardButton isPrivateBoard={true} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Collapse in={privateBoardsDisclosure.isOpen} animateOpacity>
|
|
||||||
<OverlayScrollbarsComponent
|
|
||||||
defer
|
|
||||||
style={overlayScrollbarsStyles}
|
|
||||||
options={overlayScrollbarsParams.options}
|
|
||||||
>
|
|
||||||
<Flex direction="column" maxH={346} gap={1}>
|
<Flex direction="column" maxH={346} gap={1}>
|
||||||
<NoBoardBoard isSelected={selectedBoardId === 'none'} />
|
<NoBoardBoard isSelected={selectedBoardId === 'none'} />
|
||||||
{filteredPrivateBoards.map((board) => (
|
{filteredPrivateBoards.map((board) => (
|
||||||
@ -93,28 +64,14 @@ const BoardsList = (props: Props) => {
|
|||||||
/>
|
/>
|
||||||
))}
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
</OverlayScrollbarsComponent>
|
|
||||||
</Collapse>
|
|
||||||
</>
|
</>
|
||||||
)}
|
)}
|
||||||
<Flex h="full" w="full" gap={2}>
|
<Flex w="full" justifyContent="space-between" alignItems="center">
|
||||||
<Flex onClick={sharedBoardsDisclosure.onToggle} gap={2} alignItems="center" cursor="pointer" flexGrow={1}>
|
|
||||||
<Icon
|
|
||||||
as={PiCaretUpBold}
|
|
||||||
boxSize={4}
|
|
||||||
transform={sharedBoardsDisclosure.isOpen ? 'rotate(0deg)' : 'rotate(180deg)'}
|
|
||||||
transitionProperty="common"
|
|
||||||
transitionDuration="normal"
|
|
||||||
color="base.400"
|
|
||||||
/>
|
|
||||||
<Text fontSize="md" fontWeight="medium" userSelect="none">
|
<Text fontSize="md" fontWeight="medium" userSelect="none">
|
||||||
{allowPrivateBoards ? t('boards.shared') : t('boards.boards')}
|
{allowPrivateBoards ? t('boards.shared') : t('boards.boards')}
|
||||||
</Text>
|
</Text>
|
||||||
</Flex>
|
|
||||||
<AddBoardButton isPrivateBoard={false} />
|
<AddBoardButton isPrivateBoard={false} />
|
||||||
</Flex>
|
</Flex>
|
||||||
<Collapse in={sharedBoardsDisclosure.isOpen} animateOpacity>
|
|
||||||
<OverlayScrollbarsComponent defer style={overlayScrollbarsStyles} options={overlayScrollbarsParams.options}>
|
|
||||||
<Flex direction="column" gap={1}>
|
<Flex direction="column" gap={1}>
|
||||||
{!allowPrivateBoards && <NoBoardBoard isSelected={selectedBoardId === 'none'} />}
|
{!allowPrivateBoards && <NoBoardBoard isSelected={selectedBoardId === 'none'} />}
|
||||||
{filteredSharedBoards.map((board) => (
|
{filteredSharedBoards.map((board) => (
|
||||||
@ -127,9 +84,7 @@ const BoardsList = (props: Props) => {
|
|||||||
))}
|
))}
|
||||||
</Flex>
|
</Flex>
|
||||||
</OverlayScrollbarsComponent>
|
</OverlayScrollbarsComponent>
|
||||||
</Collapse>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
</Collapse>
|
|
||||||
<DeleteBoardModal boardToDelete={boardToDelete} setBoardToDelete={setBoardToDelete} />
|
<DeleteBoardModal boardToDelete={boardToDelete} setBoardToDelete={setBoardToDelete} />
|
||||||
</>
|
</>
|
||||||
);
|
);
|
||||||
|
@ -1,50 +1,17 @@
|
|||||||
import { Button, Flex, Icon, Spacer } from '@invoke-ai/ui-library';
|
import { Flex, Text } from '@invoke-ai/ui-library';
|
||||||
import { useAppSelector } from 'app/store/storeHooks';
|
import { useAppSelector } from 'app/store/storeHooks';
|
||||||
import { memo, useMemo } from 'react';
|
import { memo } from 'react';
|
||||||
import { PiCaretUpBold } from 'react-icons/pi';
|
|
||||||
import { useBoardName } from 'services/api/hooks/useBoardName';
|
import { useBoardName } from 'services/api/hooks/useBoardName';
|
||||||
|
|
||||||
type Props = {
|
const GalleryBoardName = () => {
|
||||||
isOpen: boolean;
|
|
||||||
onToggle: () => void;
|
|
||||||
};
|
|
||||||
|
|
||||||
const GalleryBoardName = (props: Props) => {
|
|
||||||
const { isOpen, onToggle } = props;
|
|
||||||
const selectedBoardId = useAppSelector((s) => s.gallery.selectedBoardId);
|
const selectedBoardId = useAppSelector((s) => s.gallery.selectedBoardId);
|
||||||
const boardName = useBoardName(selectedBoardId);
|
const boardName = useBoardName(selectedBoardId);
|
||||||
|
|
||||||
const formattedBoardName = useMemo(() => {
|
|
||||||
if (boardName.length > 20) {
|
|
||||||
return `${boardName.substring(0, 20)}...`;
|
|
||||||
}
|
|
||||||
return boardName;
|
|
||||||
}, [boardName]);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Flex
|
<Flex as="button" w="full" borderWidth={1} borderRadius="base" alignItems="center" justifyContent="center" px={2}>
|
||||||
as={Button}
|
<Text fontWeight="semibold" fontSize="md" noOfLines={1} wordBreak="break-all" color="base.200">
|
||||||
onClick={onToggle}
|
{boardName}
|
||||||
size="sm"
|
</Text>
|
||||||
position="relative"
|
|
||||||
gap={2}
|
|
||||||
variant="outline"
|
|
||||||
w="full"
|
|
||||||
justifyContent="center"
|
|
||||||
alignItems="center"
|
|
||||||
fontSize="md"
|
|
||||||
color="base.50"
|
|
||||||
>
|
|
||||||
<Spacer />
|
|
||||||
{formattedBoardName}
|
|
||||||
<Spacer />
|
|
||||||
<Icon
|
|
||||||
as={PiCaretUpBold}
|
|
||||||
boxSize={4}
|
|
||||||
transform={isOpen ? 'rotate(0deg)' : 'rotate(180deg)'}
|
|
||||||
transitionProperty="common"
|
|
||||||
transitionDuration="normal"
|
|
||||||
/>
|
|
||||||
</Flex>
|
</Flex>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
@ -41,7 +41,6 @@ const ImageGalleryContent = () => {
|
|||||||
const dispatch = useAppDispatch();
|
const dispatch = useAppDispatch();
|
||||||
const galleryHeader = useStore($galleryHeader);
|
const galleryHeader = useStore($galleryHeader);
|
||||||
const searchDisclosure = useDisclosure({ defaultIsOpen: false });
|
const searchDisclosure = useDisclosure({ defaultIsOpen: false });
|
||||||
const { isOpen: isBoardListOpen, onToggle: onToggleBoardList } = useDisclosure({ defaultIsOpen: true });
|
|
||||||
|
|
||||||
const handleClickImages = useCallback(() => {
|
const handleClickImages = useCallback(() => {
|
||||||
dispatch(galleryViewChanged('images'));
|
dispatch(galleryViewChanged('images'));
|
||||||
@ -55,10 +54,10 @@ const ImageGalleryContent = () => {
|
|||||||
<Flex layerStyle="first" position="relative" flexDirection="column" h="full" w="full" p={2} gap={2}>
|
<Flex layerStyle="first" position="relative" flexDirection="column" h="full" w="full" p={2} gap={2}>
|
||||||
{galleryHeader}
|
{galleryHeader}
|
||||||
<Flex alignItems="center" justifyContent="space-between" gap={2}>
|
<Flex alignItems="center" justifyContent="space-between" gap={2}>
|
||||||
<GalleryBoardName isOpen={isBoardListOpen} onToggle={onToggleBoardList} />
|
<GalleryBoardName />
|
||||||
<GallerySettingsPopover />
|
<GallerySettingsPopover />
|
||||||
</Flex>
|
</Flex>
|
||||||
<BoardsList isOpen={isBoardListOpen}/>
|
<BoardsList />
|
||||||
<Flex alignItems="center" justifyContent="space-between" gap={2}>
|
<Flex alignItems="center" justifyContent="space-between" gap={2}>
|
||||||
<Tabs isFitted index={galleryView === 'images' ? 0 : 1} variant="enclosed" size="sm" w="full" mb="2">
|
<Tabs isFitted index={galleryView === 'images' ? 0 : 1} variant="enclosed" size="sm" w="full" mb="2">
|
||||||
<TabList fontSize="sm" borderBottom="none">
|
<TabList fontSize="sm" borderBottom="none">
|
||||||
|
Loading…
Reference in New Issue
Block a user