chore(ui): lint

This commit is contained in:
psychedelicious 2024-05-08 10:15:16 +10:00 committed by Kent Keirsey
parent 8b25c1a62e
commit e36e5871a1
5 changed files with 11 additions and 16 deletions

View File

@ -34,9 +34,7 @@ export const IPAdapterImagePreview = memo(
const optimalDimension = useAppSelector(selectOptimalDimension); const optimalDimension = useAppSelector(selectOptimalDimension);
const shift = useShiftModifier(); const shift = useShiftModifier();
const { currentData: controlImage, isError: isErrorControlImage } = useGetImageDTOQuery( const { currentData: controlImage, isError: isErrorControlImage } = useGetImageDTOQuery(image?.name ?? skipToken);
image?.name ?? skipToken
);
const handleResetControlImage = useCallback(() => { const handleResetControlImage = useCallback(() => {
onChangeImage(null); onChangeImage(null);
}, [onChangeImage]); }, [onChangeImage]);

View File

@ -19,15 +19,15 @@ import {
} from 'features/parameters/types/parameterSchemas'; } from 'features/parameters/types/parameterSchemas';
import { z } from 'zod'; import { z } from 'zod';
export const zTool = z.enum(['brush', 'eraser', 'move', 'rect']); const zTool = z.enum(['brush', 'eraser', 'move', 'rect']);
export type Tool = z.infer<typeof zTool>; export type Tool = z.infer<typeof zTool>;
export const zDrawingTool = zTool.extract(['brush', 'eraser']); const zDrawingTool = zTool.extract(['brush', 'eraser']);
export type DrawingTool = z.infer<typeof zDrawingTool>; export type DrawingTool = z.infer<typeof zDrawingTool>;
const zPoints = z.array(z.number()).refine((points) => points.length % 2 === 0, { const zPoints = z.array(z.number()).refine((points) => points.length % 2 === 0, {
message: 'Must have an even number of points', message: 'Must have an even number of points',
}); });
export const zVectorMaskLine = z.object({ const zVectorMaskLine = z.object({
id: z.string(), id: z.string(),
type: z.literal('vector_mask_line'), type: z.literal('vector_mask_line'),
tool: zDrawingTool, tool: zDrawingTool,
@ -36,7 +36,7 @@ export const zVectorMaskLine = z.object({
}); });
export type VectorMaskLine = z.infer<typeof zVectorMaskLine>; export type VectorMaskLine = z.infer<typeof zVectorMaskLine>;
export const zVectorMaskRect = z.object({ const zVectorMaskRect = z.object({
id: z.string(), id: z.string(),
type: z.literal('vector_mask_rect'), type: z.literal('vector_mask_rect'),
x: z.number(), x: z.number(),
@ -116,7 +116,6 @@ export const zLayer = z.discriminatedUnion('type', [
zInitialImageLayer, zInitialImageLayer,
]); ]);
export type Layer = z.infer<typeof zLayer>; export type Layer = z.infer<typeof zLayer>;
export const zLayers = z.array(zLayer);
export type ControlLayersState = { export type ControlLayersState = {
_version: 2; _version: 2;

View File

@ -162,7 +162,7 @@ const zZoeDepthProcessorConfig = z.object({
export type _ZoeDepthProcessorConfig = Required<Pick<ZoeDepthImageProcessorInvocation, 'id' | 'type'>>; export type _ZoeDepthProcessorConfig = Required<Pick<ZoeDepthImageProcessorInvocation, 'id' | 'type'>>;
export type ZoeDepthProcessorConfig = z.infer<typeof zZoeDepthProcessorConfig>; export type ZoeDepthProcessorConfig = z.infer<typeof zZoeDepthProcessorConfig>;
export const zProcessorConfig = z.discriminatedUnion('type', [ const zProcessorConfig = z.discriminatedUnion('type', [
zCannyProcessorConfig, zCannyProcessorConfig,
zColorMapProcessorConfig, zColorMapProcessorConfig,
zContentShuffleProcessorConfig, zContentShuffleProcessorConfig,
@ -519,7 +519,7 @@ export const CA_PROCESSOR_DATA: CAProcessorsData = {
}, },
}; };
export const initialControlNetV2: Omit<ControlNetConfigV2, 'id'> = { const initialControlNetV2: Omit<ControlNetConfigV2, 'id'> = {
type: 'controlnet', type: 'controlnet',
model: null, model: null,
weight: 1, weight: 1,
@ -531,7 +531,7 @@ export const initialControlNetV2: Omit<ControlNetConfigV2, 'id'> = {
processorConfig: CA_PROCESSOR_DATA.canny_image_processor.buildDefaults(), processorConfig: CA_PROCESSOR_DATA.canny_image_processor.buildDefaults(),
}; };
export const initialT2IAdapterV2: Omit<T2IAdapterConfigV2, 'id'> = { const initialT2IAdapterV2: Omit<T2IAdapterConfigV2, 'id'> = {
type: 't2i_adapter', type: 't2i_adapter',
model: null, model: null,
weight: 1, weight: 1,
@ -542,7 +542,7 @@ export const initialT2IAdapterV2: Omit<T2IAdapterConfigV2, 'id'> = {
processorConfig: CA_PROCESSOR_DATA.canny_image_processor.buildDefaults(), processorConfig: CA_PROCESSOR_DATA.canny_image_processor.buildDefaults(),
}; };
export const initialIPAdapterV2: Omit<IPAdapterConfigV2, 'id'> = { const initialIPAdapterV2: Omit<IPAdapterConfigV2, 'id'> = {
type: 'ip_adapter', type: 'ip_adapter',
image: null, image: null,
model: null, model: null,

View File

@ -49,9 +49,7 @@ export const getImageUsage = (
return l.ipAdapters.some((ipa) => ipa.image?.name === image_name); return l.ipAdapters.some((ipa) => ipa.image?.name === image_name);
} }
if (isControlAdapterLayer(l)) { if (isControlAdapterLayer(l)) {
return ( return l.controlAdapter.image?.name === image_name || l.controlAdapter.processedImage?.name === image_name;
l.controlAdapter.image?.name === image_name || l.controlAdapter.processedImage?.name === image_name
);
} }
if (isIPAdapterLayer(l)) { if (isIPAdapterLayer(l)) {
return l.ipAdapter.image?.name === image_name; return l.ipAdapter.image?.name === image_name;

View File

@ -51,7 +51,7 @@ export type MetadataValidateFunc<T> = (value: T) => Promise<T>;
* @param value The value to check. * @param value The value to check.
* @returns True if the item should be visible, false otherwise. * @returns True if the item should be visible, false otherwise.
*/ */
export type MetadataGetIsVisibleFunc<T> = (value: T) => boolean; type MetadataGetIsVisibleFunc<T> = (value: T) => boolean;
export type MetadataHandlers<TValue = unknown, TItem = unknown> = { export type MetadataHandlers<TValue = unknown, TItem = unknown> = {
/** /**