mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): remove refs to BoardRecord in UI
UI should only work w/ BoardDTO
This commit is contained in:
parent
48193b7fa7
commit
163ef2c941
@ -6,7 +6,7 @@ import { ContextMenu } from 'chakra-ui-contextmenu';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ExternalLinkIcon } from '@chakra-ui/icons';
|
||||
import { useAppToaster } from 'app/components/Toaster';
|
||||
import { BoardRecord } from 'services/api';
|
||||
import { BoardDTO } from 'services/api';
|
||||
import { EntityId, createSelector } from '@reduxjs/toolkit';
|
||||
import {
|
||||
selectFilteredImagesIds,
|
||||
@ -17,7 +17,7 @@ import { defaultSelectorOptions } from '../../../app/store/util/defaultMemoizeOp
|
||||
import { useSelector } from 'react-redux';
|
||||
|
||||
interface HoverableBoardProps {
|
||||
board: BoardRecord;
|
||||
board: BoardDTO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -55,8 +55,8 @@ import {
|
||||
} from '../store/imagesSlice';
|
||||
import { receivedPageOfImages } from 'services/thunks/image';
|
||||
import { boardSelector } from '../store/boardSelectors';
|
||||
import { BoardRecord, ImageDTO } from '../../../services/api';
|
||||
import { isBoardRecord, isImageDTO } from '../../../services/types/guards';
|
||||
import { BoardDTO, ImageDTO } from '../../../services/api';
|
||||
import { isBoardDTO, isImageDTO } from '../../../services/types/guards';
|
||||
import HoverableBoard from './HoverableBoard';
|
||||
import IAIInput from '../../../common/components/IAIInput';
|
||||
import { boardCreated } from '../../../services/thunks/board';
|
||||
@ -66,7 +66,7 @@ const itemSelector = createSelector(
|
||||
(state) => {
|
||||
const { images, boards, gallery } = state;
|
||||
|
||||
let items: Array<ImageDTO | BoardRecord> = [];
|
||||
let items: Array<ImageDTO | BoardDTO> = [];
|
||||
let areMoreAvailable = false;
|
||||
let isLoading = true;
|
||||
|
||||
@ -78,7 +78,7 @@ const itemSelector = createSelector(
|
||||
areMoreAvailable = items.length < images.total;
|
||||
isLoading = images.isLoading;
|
||||
} else if (gallery.galleryView === 'boards') {
|
||||
items = Object.values(boards.entities) as BoardRecord[];
|
||||
items = Object.values(boards.entities) as BoardDTO[];
|
||||
areMoreAvailable = items.length < boards.total;
|
||||
isLoading = boards.isLoading;
|
||||
}
|
||||
@ -365,7 +365,7 @@ const ImageGalleryContent = () => {
|
||||
/>
|
||||
</Flex>
|
||||
);
|
||||
} else if (isBoardRecord(item)) {
|
||||
} else if (isBoardDTO(item)) {
|
||||
return (
|
||||
<Flex sx={{ pb: 2 }}>
|
||||
<HoverableBoard key={item.board_id} board={item} />
|
||||
@ -395,7 +395,7 @@ const ImageGalleryContent = () => {
|
||||
}
|
||||
/>
|
||||
);
|
||||
} else if (isBoardRecord(item)) {
|
||||
} else if (isBoardDTO(item)) {
|
||||
return (
|
||||
<HoverableBoard key={item.board_id} board={item} />
|
||||
);
|
||||
|
@ -5,11 +5,11 @@ import {
|
||||
createSlice,
|
||||
} from '@reduxjs/toolkit';
|
||||
import { RootState } from 'app/store/store';
|
||||
import { BoardRecord } from 'services/api';
|
||||
import { BoardDTO } from 'services/api';
|
||||
import { dateComparator } from 'common/util/dateComparator';
|
||||
import { receivedBoards } from '../../../services/thunks/board';
|
||||
|
||||
export const boardsAdapter = createEntityAdapter<BoardRecord>({
|
||||
export const boardsAdapter = createEntityAdapter<BoardDTO>({
|
||||
selectId: (board) => board.board_id,
|
||||
sortComparer: (a, b) => dateComparator(b.updated_at, a.updated_at),
|
||||
});
|
||||
@ -35,10 +35,10 @@ const boardsSlice = createSlice({
|
||||
name: 'boards',
|
||||
initialState: initialBoardsState,
|
||||
reducers: {
|
||||
boardUpserted: (state, action: PayloadAction<BoardRecord>) => {
|
||||
boardUpserted: (state, action: PayloadAction<BoardDTO>) => {
|
||||
boardsAdapter.upsertOne(state, action.payload);
|
||||
},
|
||||
boardUpdatedOne: (state, action: PayloadAction<Update<BoardRecord>>) => {
|
||||
boardUpdatedOne: (state, action: PayloadAction<Update<BoardDTO>>) => {
|
||||
boardsAdapter.updateOne(state, action.payload);
|
||||
},
|
||||
boardRemoved: (state, action: PayloadAction<string>) => {
|
||||
|
Loading…
Reference in New Issue
Block a user