mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): handle new image origin/category setup
- Update all thunks & network related things - Update gallery What I have not done yet is rename the gallery tabs and the relevant slices, but I believe the functionality is all there. Also I fixed several bugs along the way but couldn't really commit them separately bc I was refactoring. Can't remember what they were, but related to the gallery image switching.
This commit is contained in:
committed by
Kent Keirsey
parent
d78e3572e3
commit
29fcc92da9
@ -5,7 +5,7 @@ import { useGetUrl } from 'common/util/getUrl';
|
||||
import { clearInitialImage } from 'features/parameters/store/generationSlice';
|
||||
import { DragEvent, useCallback } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import { ImageType } from 'services/api';
|
||||
import { ResourceOrigin } from 'services/api';
|
||||
import ImageMetadataOverlay from 'common/components/ImageMetadataOverlay';
|
||||
import { generationSelector } from 'features/parameters/store/generationSelectors';
|
||||
import { initialImageSelected } from 'features/parameters/store/actions';
|
||||
@ -55,9 +55,11 @@ const InitialImagePreview = () => {
|
||||
const handleDrop = useCallback(
|
||||
(e: DragEvent<HTMLDivElement>) => {
|
||||
const name = e.dataTransfer.getData('invokeai/imageName');
|
||||
const type = e.dataTransfer.getData('invokeai/imageType') as ImageType;
|
||||
const type = e.dataTransfer.getData(
|
||||
'invokeai/imageOrigin'
|
||||
) as ResourceOrigin;
|
||||
|
||||
dispatch(initialImageSelected({ image_name: name, image_type: type }));
|
||||
dispatch(initialImageSelected({ image_name: name, image_origin: type }));
|
||||
},
|
||||
[dispatch]
|
||||
);
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { createAction } from '@reduxjs/toolkit';
|
||||
import { isObject } from 'lodash-es';
|
||||
import { ImageDTO, ImageType } from 'services/api';
|
||||
import { ImageDTO, ResourceOrigin } from 'services/api';
|
||||
|
||||
export type ImageNameAndType = {
|
||||
export type ImageNameAndOrigin = {
|
||||
image_name: string;
|
||||
image_type: ImageType;
|
||||
image_origin: ResourceOrigin;
|
||||
};
|
||||
|
||||
export const isImageDTO = (image: any): image is ImageDTO => {
|
||||
@ -13,8 +13,8 @@ export const isImageDTO = (image: any): image is ImageDTO => {
|
||||
isObject(image) &&
|
||||
'image_name' in image &&
|
||||
image?.image_name !== undefined &&
|
||||
'image_type' in image &&
|
||||
image?.image_type !== undefined &&
|
||||
'image_origin' in image &&
|
||||
image?.image_origin !== undefined &&
|
||||
'image_url' in image &&
|
||||
image?.image_url !== undefined &&
|
||||
'thumbnail_url' in image &&
|
||||
@ -27,5 +27,5 @@ export const isImageDTO = (image: any): image is ImageDTO => {
|
||||
};
|
||||
|
||||
export const initialImageSelected = createAction<
|
||||
ImageDTO | ImageNameAndType | undefined
|
||||
ImageDTO | ImageNameAndOrigin | undefined
|
||||
>('generation/initialImageSelected');
|
||||
|
Reference in New Issue
Block a user