mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): make archiving and auto-add mutually exclusive
This commit is contained in:
parent
68c0aa898f
commit
071e8bcee4
@ -1,5 +1,5 @@
|
||||
import type { ContextMenuProps } from '@invoke-ai/ui-library';
|
||||
import { ContextMenu, MenuGroup, MenuItem, MenuList } from '@invoke-ai/ui-library';
|
||||
import { ContextMenu, MenuGroup, MenuItem, MenuList, Tooltip } from '@invoke-ai/ui-library';
|
||||
import { createSelector } from '@reduxjs/toolkit';
|
||||
import { useAppDispatch, useAppSelector } from 'app/store/storeHooks';
|
||||
import { autoAddBoardIdChanged, selectGallerySlice } from 'features/gallery/store/gallerySlice';
|
||||
@ -88,9 +88,11 @@ const BoardContextMenu = ({ board, board_id, setBoardToDelete, children }: Props
|
||||
{t('boards.unarchiveBoard')}
|
||||
</MenuItem>
|
||||
) : (
|
||||
<MenuItem icon={<PiArchiveFill />} onClick={handleArchive}>
|
||||
<Tooltip label={isSelectedForAutoAdd && 'testing'}>
|
||||
<MenuItem icon={<PiArchiveFill />} onClick={handleArchive} isDisabled={isSelectedForAutoAdd}>
|
||||
{t('boards.archiveBoard')}
|
||||
</MenuItem>
|
||||
</Tooltip>
|
||||
))}
|
||||
|
||||
{board && <GalleryBoardContextMenuItems board={board} setBoardToDelete={setBoardToDelete} />}
|
||||
|
@ -56,10 +56,10 @@ const GalleryBoard = ({ board, isSelected, setBoardToDelete }: GalleryBoardProps
|
||||
|
||||
const handleSelectBoard = useCallback(() => {
|
||||
dispatch(boardIdSelected({ boardId: board_id }));
|
||||
if (autoAssignBoardOnClick) {
|
||||
if (autoAssignBoardOnClick && !board.archived) {
|
||||
dispatch(autoAddBoardIdChanged(board_id));
|
||||
}
|
||||
}, [board_id, autoAssignBoardOnClick, dispatch]);
|
||||
}, [board_id, autoAssignBoardOnClick, dispatch, board.archived]);
|
||||
|
||||
const [updateBoard, { isLoading: isUpdateBoardLoading }] = useUpdateBoardMutation();
|
||||
|
||||
|
@ -2,9 +2,11 @@ import type { BoardId } from 'features/gallery/store/types';
|
||||
import { t } from 'i18next';
|
||||
import { useListAllBoardsQuery } from 'services/api/endpoints/boards';
|
||||
import { selectListBoardsQueryArgs } from '../../../features/gallery/store/gallerySelectors';
|
||||
import { useAppSelector } from '../../../app/store/storeHooks';
|
||||
|
||||
export const useBoardName = (board_id: BoardId) => {
|
||||
const { boardName } = useListAllBoardsQuery({}, {
|
||||
const queryArgs = useAppSelector(selectListBoardsQueryArgs);
|
||||
const { boardName } = useListAllBoardsQuery(queryArgs, {
|
||||
selectFromResult: ({ data }) => {
|
||||
const selectedBoard = data?.find((b) => b.board_id === board_id);
|
||||
const boardName = selectedBoard?.board_name || t('boards.uncategorized');
|
||||
|
Loading…
Reference in New Issue
Block a user