feat(ui): add eslint rules

- `curly` requires conditionals to use curly braces
- `react/jsx-curly-brace-presence` requires string props to *not* have curly braces
This commit is contained in:
psychedelicious 2023-08-21 11:35:56 +10:00
parent fbff22c94b
commit 01738deb23
47 changed files with 174 additions and 92 deletions

View File

@ -23,6 +23,11 @@ module.exports = {
plugins: ['react', '@typescript-eslint', 'eslint-plugin-react-hooks'], plugins: ['react', '@typescript-eslint', 'eslint-plugin-react-hooks'],
root: true, root: true,
rules: { rules: {
curly: 'error',
'react/jsx-curly-brace-presence': [
'error',
{ props: 'never', children: 'never' },
],
'react-hooks/exhaustive-deps': 'error', 'react-hooks/exhaustive-deps': 'error',
'no-var': 'error', 'no-var': 'error',
'brace-style': 'error', 'brace-style': 'error',

View File

@ -100,14 +100,18 @@ const IAIDndImage = (props: IAIDndImageProps) => {
const [isHovered, setIsHovered] = useState(false); const [isHovered, setIsHovered] = useState(false);
const handleMouseOver = useCallback( const handleMouseOver = useCallback(
(e: MouseEvent<HTMLDivElement>) => { (e: MouseEvent<HTMLDivElement>) => {
if (onMouseOver) onMouseOver(e); if (onMouseOver) {
onMouseOver(e);
}
setIsHovered(true); setIsHovered(true);
}, },
[onMouseOver] [onMouseOver]
); );
const handleMouseOut = useCallback( const handleMouseOut = useCallback(
(e: MouseEvent<HTMLDivElement>) => { (e: MouseEvent<HTMLDivElement>) => {
if (onMouseOut) onMouseOut(e); if (onMouseOut) {
onMouseOut(e);
}
setIsHovered(false); setIsHovered(false);
}, },
[onMouseOut] [onMouseOut]

View File

@ -150,7 +150,9 @@ const ImageUploader = (props: ImageUploaderProps) => {
{...getRootProps({ style: {} })} {...getRootProps({ style: {} })}
onKeyDown={(e: KeyboardEvent) => { onKeyDown={(e: KeyboardEvent) => {
// Bail out if user hits spacebar - do not open the uploader // Bail out if user hits spacebar - do not open the uploader
if (e.key === ' ') return; if (e.key === ' ') {
return;
}
}} }}
> >
<input {...getInputProps()} /> <input {...getInputProps()} />

View File

@ -11,8 +11,14 @@ export default function useResolution():
const tabletResolutions = ['md', 'lg']; const tabletResolutions = ['md', 'lg'];
const desktopResolutions = ['xl', '2xl']; const desktopResolutions = ['xl', '2xl'];
if (mobileResolutions.includes(breakpointValue)) return 'mobile'; if (mobileResolutions.includes(breakpointValue)) {
if (tabletResolutions.includes(breakpointValue)) return 'tablet'; return 'mobile';
if (desktopResolutions.includes(breakpointValue)) return 'desktop'; }
if (tabletResolutions.includes(breakpointValue)) {
return 'tablet';
}
if (desktopResolutions.includes(breakpointValue)) {
return 'desktop';
}
return 'unknown'; return 'unknown';
} }

View File

@ -6,7 +6,11 @@ export const dateComparator = (a: string, b: string) => {
const dateB = new Date(b); const dateB = new Date(b);
// sort in ascending order // sort in ascending order
if (dateA > dateB) return 1; if (dateA > dateB) {
if (dateA < dateB) return -1; return 1;
}
if (dateA < dateB) {
return -1;
}
return 0; return 0;
}; };

View File

@ -5,7 +5,9 @@ type Base64AndCaption = {
const openBase64ImageInTab = (images: Base64AndCaption[]) => { const openBase64ImageInTab = (images: Base64AndCaption[]) => {
const w = window.open(''); const w = window.open('');
if (!w) return; if (!w) {
return;
}
images.forEach((i) => { images.forEach((i) => {
const image = new Image(); const image = new Image();

View File

@ -125,7 +125,9 @@ const IAICanvasMaskCompositer = (props: IAICanvasMaskCompositerProps) => {
}, [offset]); }, [offset]);
useEffect(() => { useEffect(() => {
if (fillPatternImage) return; if (fillPatternImage) {
return;
}
const image = new Image(); const image = new Image();
image.onload = () => { image.onload = () => {
@ -135,7 +137,9 @@ const IAICanvasMaskCompositer = (props: IAICanvasMaskCompositerProps) => {
}, [fillPatternImage, maskColorString]); }, [fillPatternImage, maskColorString]);
useEffect(() => { useEffect(() => {
if (!fillPatternImage) return; if (!fillPatternImage) {
return;
}
fillPatternImage.src = getColoredSVG(maskColorString); fillPatternImage.src = getColoredSVG(maskColorString);
}, [fillPatternImage, maskColorString]); }, [fillPatternImage, maskColorString]);
@ -151,8 +155,9 @@ const IAICanvasMaskCompositer = (props: IAICanvasMaskCompositerProps) => {
!isNumber(stageScale) || !isNumber(stageScale) ||
!isNumber(stageDimensions.width) || !isNumber(stageDimensions.width) ||
!isNumber(stageDimensions.height) !isNumber(stageDimensions.height)
) ) {
return null; return null;
}
return ( return (
<Rect <Rect

View File

@ -34,7 +34,9 @@ const selector = createSelector(
const IAICanvasObjectRenderer = () => { const IAICanvasObjectRenderer = () => {
const { objects } = useAppSelector(selector); const { objects } = useAppSelector(selector);
if (!objects) return null; if (!objects) {
return null;
}
return ( return (
<Group name="outpainting-objects" listening={false}> <Group name="outpainting-objects" listening={false}>

View File

@ -42,7 +42,9 @@ const IAICanvasResizer = () => {
useLayoutEffect(() => { useLayoutEffect(() => {
window.setTimeout(() => { window.setTimeout(() => {
if (!ref.current) return; if (!ref.current) {
return;
}
const { clientWidth, clientHeight } = ref.current; const { clientWidth, clientHeight } = ref.current;

View File

@ -129,7 +129,9 @@ const IAICanvasStagingAreaToolbar = () => {
currentStagingAreaImage?.imageName ?? skipToken currentStagingAreaImage?.imageName ?? skipToken
); );
if (!currentStagingAreaImage) return null; if (!currentStagingAreaImage) {
return null;
}
return ( return (
<Flex <Flex

View File

@ -135,7 +135,9 @@ const IAICanvasToolPreview = (props: GroupConfig) => {
clip, clip,
} = useAppSelector(canvasBrushPreviewSelector); } = useAppSelector(canvasBrushPreviewSelector);
if (!shouldDrawBrushPreview) return null; if (!shouldDrawBrushPreview) {
return null;
}
return ( return (
<Group listening={false} {...clip} {...rest}> <Group listening={false} {...clip} {...rest}>

View File

@ -85,7 +85,9 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
useState(false); useState(false);
useEffect(() => { useEffect(() => {
if (!transformerRef.current || !shapeRef.current) return; if (!transformerRef.current || !shapeRef.current) {
return;
}
transformerRef.current.nodes([shapeRef.current]); transformerRef.current.nodes([shapeRef.current]);
transformerRef.current.getLayer()?.batchDraw(); transformerRef.current.getLayer()?.batchDraw();
}, []); }, []);
@ -133,7 +135,9 @@ const IAICanvasBoundingBox = (props: IAICanvasBoundingBoxPreviewProps) => {
* not its width and height. We need to un-scale the width and height before * not its width and height. We need to un-scale the width and height before
* setting the values. * setting the values.
*/ */
if (!shapeRef.current) return; if (!shapeRef.current) {
return;
}
const rect = shapeRef.current; const rect = shapeRef.current;

View File

@ -167,7 +167,9 @@ const IAICanvasToolbar = () => {
const handleResetCanvasView = (shouldScaleTo1 = false) => { const handleResetCanvasView = (shouldScaleTo1 = false) => {
const canvasBaseLayer = getCanvasBaseLayer(); const canvasBaseLayer = getCanvasBaseLayer();
if (!canvasBaseLayer) return; if (!canvasBaseLayer) {
return;
}
const clientRect = canvasBaseLayer.getClientRect({ const clientRect = canvasBaseLayer.getClientRect({
skipTransform: true, skipTransform: true,
}); });

View File

@ -32,13 +32,17 @@ const useCanvasDrag = () => {
return { return {
handleDragStart: useCallback(() => { handleDragStart: useCallback(() => {
if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) return; if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) {
return;
}
dispatch(setIsMovingStage(true)); dispatch(setIsMovingStage(true));
}, [dispatch, isMovingBoundingBox, isStaging, tool]), }, [dispatch, isMovingBoundingBox, isStaging, tool]),
handleDragMove: useCallback( handleDragMove: useCallback(
(e: KonvaEventObject<MouseEvent>) => { (e: KonvaEventObject<MouseEvent>) => {
if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) return; if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) {
return;
}
const newCoordinates = { x: e.target.x(), y: e.target.y() }; const newCoordinates = { x: e.target.x(), y: e.target.y() };
@ -48,7 +52,9 @@ const useCanvasDrag = () => {
), ),
handleDragEnd: useCallback(() => { handleDragEnd: useCallback(() => {
if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) return; if (!((tool === 'move' || isStaging) && !isMovingBoundingBox)) {
return;
}
dispatch(setIsMovingStage(false)); dispatch(setIsMovingStage(false));
}, [dispatch, isMovingBoundingBox, isStaging, tool]), }, [dispatch, isMovingBoundingBox, isStaging, tool]),
}; };

View File

@ -134,7 +134,9 @@ const useInpaintingCanvasHotkeys = () => {
useHotkeys( useHotkeys(
['space'], ['space'],
(e: KeyboardEvent) => { (e: KeyboardEvent) => {
if (e.repeat) return; if (e.repeat) {
return;
}
canvasStage?.container().focus(); canvasStage?.container().focus();

View File

@ -38,7 +38,9 @@ const useCanvasMouseDown = (stageRef: MutableRefObject<Konva.Stage | null>) => {
return useCallback( return useCallback(
(e: KonvaEventObject<MouseEvent | TouchEvent>) => { (e: KonvaEventObject<MouseEvent | TouchEvent>) => {
if (!stageRef.current) return; if (!stageRef.current) {
return;
}
stageRef.current.container().focus(); stageRef.current.container().focus();
@ -54,7 +56,9 @@ const useCanvasMouseDown = (stageRef: MutableRefObject<Konva.Stage | null>) => {
const scaledCursorPosition = getScaledCursorPosition(stageRef.current); const scaledCursorPosition = getScaledCursorPosition(stageRef.current);
if (!scaledCursorPosition) return; if (!scaledCursorPosition) {
return;
}
e.evt.preventDefault(); e.evt.preventDefault();

View File

@ -41,11 +41,15 @@ const useCanvasMouseMove = (
const { updateColorUnderCursor } = useColorPicker(); const { updateColorUnderCursor } = useColorPicker();
return useCallback(() => { return useCallback(() => {
if (!stageRef.current) return; if (!stageRef.current) {
return;
}
const scaledCursorPosition = getScaledCursorPosition(stageRef.current); const scaledCursorPosition = getScaledCursorPosition(stageRef.current);
if (!scaledCursorPosition) return; if (!scaledCursorPosition) {
return;
}
dispatch(setCursorPosition(scaledCursorPosition)); dispatch(setCursorPosition(scaledCursorPosition));
@ -56,7 +60,9 @@ const useCanvasMouseMove = (
return; return;
} }
if (!isDrawing || tool === 'move' || isStaging) return; if (!isDrawing || tool === 'move' || isStaging) {
return;
}
didMouseMoveRef.current = true; didMouseMoveRef.current = true;
dispatch( dispatch(

View File

@ -47,7 +47,9 @@ const useCanvasMouseUp = (
if (!didMouseMoveRef.current && isDrawing && stageRef.current) { if (!didMouseMoveRef.current && isDrawing && stageRef.current) {
const scaledCursorPosition = getScaledCursorPosition(stageRef.current); const scaledCursorPosition = getScaledCursorPosition(stageRef.current);
if (!scaledCursorPosition) return; if (!scaledCursorPosition) {
return;
}
/** /**
* Extend the current line. * Extend the current line.

View File

@ -35,13 +35,17 @@ const useCanvasWheel = (stageRef: MutableRefObject<Konva.Stage | null>) => {
return useCallback( return useCallback(
(e: KonvaEventObject<WheelEvent>) => { (e: KonvaEventObject<WheelEvent>) => {
// stop default scrolling // stop default scrolling
if (!stageRef.current || isMoveStageKeyHeld) return; if (!stageRef.current || isMoveStageKeyHeld) {
return;
}
e.evt.preventDefault(); e.evt.preventDefault();
const cursorPos = stageRef.current.getPointerPosition(); const cursorPos = stageRef.current.getPointerPosition();
if (!cursorPos) return; if (!cursorPos) {
return;
}
const mousePointTo = { const mousePointTo = {
x: (cursorPos.x - stageRef.current.x()) / stageScale, x: (cursorPos.x - stageRef.current.x()) / stageScale,

View File

@ -16,11 +16,15 @@ const useColorPicker = () => {
return { return {
updateColorUnderCursor: () => { updateColorUnderCursor: () => {
if (!stage || !canvasBaseLayer) return; if (!stage || !canvasBaseLayer) {
return;
}
const position = stage.getPointerPosition(); const position = stage.getPointerPosition();
if (!position) return; if (!position) {
return;
}
const pixelRatio = Konva.pixelRatio; const pixelRatio = Konva.pixelRatio;

View File

@ -397,7 +397,9 @@ export const canvasSlice = createSlice({
const { tool, layer, brushColor, brushSize, shouldRestrictStrokesToBox } = const { tool, layer, brushColor, brushSize, shouldRestrictStrokesToBox } =
state; state;
if (tool === 'move' || tool === 'colorPicker') return; if (tool === 'move' || tool === 'colorPicker') {
return;
}
const newStrokeWidth = brushSize / 2; const newStrokeWidth = brushSize / 2;
@ -434,14 +436,18 @@ export const canvasSlice = createSlice({
addPointToCurrentLine: (state, action: PayloadAction<number[]>) => { addPointToCurrentLine: (state, action: PayloadAction<number[]>) => {
const lastLine = state.layerState.objects.findLast(isCanvasAnyLine); const lastLine = state.layerState.objects.findLast(isCanvasAnyLine);
if (!lastLine) return; if (!lastLine) {
return;
}
lastLine.points.push(...action.payload); lastLine.points.push(...action.payload);
}, },
undo: (state) => { undo: (state) => {
const targetState = state.pastLayerStates.pop(); const targetState = state.pastLayerStates.pop();
if (!targetState) return; if (!targetState) {
return;
}
state.futureLayerStates.unshift(cloneDeep(state.layerState)); state.futureLayerStates.unshift(cloneDeep(state.layerState));
@ -454,7 +460,9 @@ export const canvasSlice = createSlice({
redo: (state) => { redo: (state) => {
const targetState = state.futureLayerStates.shift(); const targetState = state.futureLayerStates.shift();
if (!targetState) return; if (!targetState) {
return;
}
state.pastLayerStates.push(cloneDeep(state.layerState)); state.pastLayerStates.push(cloneDeep(state.layerState));

View File

@ -5,7 +5,9 @@ const getScaledCursorPosition = (stage: Stage) => {
const stageTransform = stage.getAbsoluteTransform().copy(); const stageTransform = stage.getAbsoluteTransform().copy();
if (!pointerPosition || !stageTransform) return; if (!pointerPosition || !stageTransform) {
return;
}
const scaledCursorPosition = stageTransform.invert().point(pointerPosition); const scaledCursorPosition = stageTransform.invert().point(pointerPosition);

View File

@ -91,8 +91,8 @@ const ControlNet = (props: ControlNetProps) => {
> >
<Flex sx={{ gap: 2, alignItems: 'center' }}> <Flex sx={{ gap: 2, alignItems: 'center' }}>
<IAISwitch <IAISwitch
tooltip={'Toggle this ControlNet'} tooltip="Toggle this ControlNet"
aria-label={'Toggle this ControlNet'} aria-label="Toggle this ControlNet"
isChecked={isEnabled} isChecked={isEnabled}
onChange={handleToggleIsEnabled} onChange={handleToggleIsEnabled}
/> />

View File

@ -23,7 +23,7 @@ const ParamControlNetWeight = (props: ParamControlNetWeightProps) => {
return ( return (
<IAISlider <IAISlider
isDisabled={!isEnabled} isDisabled={!isEnabled}
label={'Weight'} label="Weight"
value={weight} value={weight}
onChange={handleWeightChanged} onChange={handleWeightChanged}
min={0} min={0}

View File

@ -118,7 +118,7 @@ const ParamEmbeddingPopover = (props: Props) => {
<IAIMantineSearchableSelect <IAIMantineSearchableSelect
inputRef={inputRef} inputRef={inputRef}
autoFocus autoFocus
placeholder={'Add Embedding'} placeholder="Add Embedding"
value={null} value={null}
data={data} data={data}
nothingFound="No matching Embeddings" nothingFound="No matching Embeddings"

View File

@ -66,7 +66,7 @@ const BoardAutoAddSelect = () => {
label="Auto-Add Board" label="Auto-Add Board"
inputRef={inputRef} inputRef={inputRef}
autoFocus autoFocus
placeholder={'Select a Board'} placeholder="Select a Board"
value={autoAddBoardId} value={autoAddBoardId}
data={boards} data={boards}
nothingFound="No matching Boards" nothingFound="No matching Boards"

View File

@ -41,7 +41,7 @@ const BoardsList = (props: Props) => {
<> <>
<Collapse in={isOpen} animateOpacity> <Collapse in={isOpen} animateOpacity>
<Flex <Flex
layerStyle={'first'} layerStyle="first"
sx={{ sx={{
flexDir: 'column', flexDir: 'column',
gap: 2, gap: 2,

View File

@ -136,11 +136,15 @@ const SingleSelectionMenuItems = (props: SingleSelectionMenuItemsProps) => {
}, [copyImageToClipboard, imageDTO.image_url]); }, [copyImageToClipboard, imageDTO.image_url]);
const handleStarImage = useCallback(() => { const handleStarImage = useCallback(() => {
if (imageDTO) starImages({ imageDTOs: [imageDTO] }); if (imageDTO) {
starImages({ imageDTOs: [imageDTO] });
}
}, [starImages, imageDTO]); }, [starImages, imageDTO]);
const handleUnstarImage = useCallback(() => { const handleUnstarImage = useCallback(() => {
if (imageDTO) unstarImages({ imageDTOs: [imageDTO] }); if (imageDTO) {
unstarImages({ imageDTOs: [imageDTO] });
}
}, [unstarImages, imageDTO]); }, [unstarImages, imageDTO]);
return ( return (

View File

@ -88,8 +88,12 @@ const GalleryImage = (props: HoverableImageProps) => {
}, []); }, []);
const starIcon = useMemo(() => { const starIcon = useMemo(() => {
if (imageDTO?.starred) return <MdStar size="20" />; if (imageDTO?.starred) {
if (!imageDTO?.starred && isHovered) return <MdStarBorder size="20" />; return <MdStar size="20" />;
}
if (!imageDTO?.starred && isHovered) {
return <MdStarBorder size="20" />;
}
}, [imageDTO?.starred, isHovered]); }, [imageDTO?.starred, isHovered]);
if (!imageDTO) { if (!imageDTO) {

View File

@ -34,7 +34,7 @@ const NodeEditor = () => {
/> />
<Panel id="node-editor-content"> <Panel id="node-editor-content">
<Flex <Flex
layerStyle={'first'} layerStyle="first"
sx={{ sx={{
position: 'relative', position: 'relative',
width: 'full', width: 'full',
@ -82,7 +82,7 @@ const NodeEditor = () => {
style={{ position: 'absolute', width: '100%', height: '100%' }} style={{ position: 'absolute', width: '100%', height: '100%' }}
> >
<Flex <Flex
layerStyle={'first'} layerStyle="first"
sx={{ sx={{
position: 'relative', position: 'relative',
width: 'full', width: 'full',

View File

@ -40,7 +40,7 @@ const NotesNode = (props: NodeProps<NotesNodeData>) => {
<> <>
<Flex <Flex
layerStyle="nodeBody" layerStyle="nodeBody"
className={'nopan'} className="nopan"
sx={{ sx={{
cursor: 'auto', cursor: 'auto',
flexDirection: 'column', flexDirection: 'column',

View File

@ -33,7 +33,9 @@ export const addSDXLRefinerToGraph = (
refinerStart, refinerStart,
} = state.sdxl; } = state.sdxl;
if (!refinerModel) return; if (!refinerModel) {
return;
}
const metadataAccumulator = graph.nodes[METADATA_ACCUMULATOR] as const metadataAccumulator = graph.nodes[METADATA_ACCUMULATOR] as
| MetadataAccumulatorInvocation | MetadataAccumulatorInvocation

View File

@ -28,7 +28,7 @@ export default function ParamAdvancedCollapse() {
} }
return ( return (
<IAICollapse label={'Advanced'} activeLabel={activeLabel}> <IAICollapse label="Advanced" activeLabel={activeLabel}>
<Flex sx={{ flexDir: 'column', gap: 2 }}> <Flex sx={{ flexDir: 'column', gap: 2 }}>
<ParamClipSkip /> <ParamClipSkip />
</Flex> </Flex>

View File

@ -21,7 +21,9 @@ export default function ParamMaskBlurMethod() {
const { t } = useTranslation(); const { t } = useTranslation();
const handleMaskBlurMethodChange = (v: string | null) => { const handleMaskBlurMethodChange = (v: string | null) => {
if (!v) return; if (!v) {
return;
}
dispatch(setMaskBlurMethod(v as MaskBlurMethods)); dispatch(setMaskBlurMethod(v as MaskBlurMethods));
}; };

View File

@ -40,7 +40,7 @@ const InitialImageDisplay = () => {
return ( return (
<Flex <Flex
layerStyle={'first'} layerStyle="first"
sx={{ sx={{
position: 'relative', position: 'relative',
flexDirection: 'column', flexDirection: 'column',
@ -76,14 +76,14 @@ const InitialImageDisplay = () => {
</Text> </Text>
<Spacer /> <Spacer />
<IAIIconButton <IAIIconButton
tooltip={'Upload Initial Image'} tooltip="Upload Initial Image"
aria-label={'Upload Initial Image'} aria-label="Upload Initial Image"
icon={<FaUpload />} icon={<FaUpload />}
{...getUploadButtonProps()} {...getUploadButtonProps()}
/> />
<IAIIconButton <IAIIconButton
tooltip={'Reset Initial Image'} tooltip="Reset Initial Image"
aria-label={'Reset Initial Image'} aria-label="Reset Initial Image"
icon={<FaUndo />} icon={<FaUndo />}
onClick={handleReset} onClick={handleReset}
isDisabled={isResetButtonDisabled} isDisabled={isResetButtonDisabled}

View File

@ -313,7 +313,9 @@ export const generationSlice = createSlice({
}); });
builder.addCase(setShouldShowAdvancedOptions, (state, action) => { builder.addCase(setShouldShowAdvancedOptions, (state, action) => {
const advancedOptionsStatus = action.payload; const advancedOptionsStatus = action.payload;
if (!advancedOptionsStatus) state.clipSkip = 0; if (!advancedOptionsStatus) {
state.clipSkip = 0;
}
}); });
}, },
}); });

View File

@ -32,11 +32,7 @@ const SDXLImageToImageTabCoreParameters = () => {
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse <IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}>
label={'General'}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -30,11 +30,7 @@ const SDXLUnifiedCanvasTabCoreParameters = () => {
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse <IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}>
label={'General'}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -32,11 +32,7 @@ const ImageToImageTabCoreParameters = () => {
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse <IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}>
label={'General'}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -23,7 +23,9 @@ export default function AdvancedAddModels() {
value={advancedAddMode} value={advancedAddMode}
data={advancedAddModeData} data={advancedAddModeData}
onChange={(v) => { onChange={(v) => {
if (!v) return; if (!v) {
return;
}
setAdvancedAddMode(v as ManualAddMode); setAdvancedAddMode(v as ManualAddMode);
}} }}
/> />

View File

@ -74,7 +74,9 @@ export default function ScanAdvancedAddModels() {
value={advancedAddMode} value={advancedAddMode}
data={advancedAddModeData} data={advancedAddModeData}
onChange={(v) => { onChange={(v) => {
if (!v) return; if (!v) {
return;
}
setAdvancedAddMode(v as ManualAddMode); setAdvancedAddMode(v as ManualAddMode);
if (v === 'checkpoint') { if (v === 'checkpoint') {
setIsCheckpoint(true); setIsCheckpoint(true);

View File

@ -111,7 +111,7 @@ export default function ModelConvert(props: ModelConvertProps) {
acceptButtonText={`${t('modelManager.convert')}`} acceptButtonText={`${t('modelManager.convert')}`}
triggerComponent={ triggerComponent={
<IAIButton <IAIButton
size={'sm'} size="sm"
aria-label={t('modelManager.convertToDiffusers')} aria-label={t('modelManager.convertToDiffusers')}
className=" modal-close-btn" className=" modal-close-btn"
isLoading={isLoading} isLoading={isLoading}

View File

@ -29,11 +29,7 @@ const TextToImageTabCoreParameters = () => {
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse <IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}>
label={'General'}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',

View File

@ -5,7 +5,7 @@ import { memo } from 'react';
const TextToImageTabMain = () => { const TextToImageTabMain = () => {
return ( return (
<Box <Box
layerStyle={'first'} layerStyle="first"
sx={{ sx={{
position: 'relative', position: 'relative',
width: '100%', width: '100%',

View File

@ -35,10 +35,12 @@ export default function UnifiedCanvasColorPicker() {
const { brushColor, maskColor, layer, isStaging } = useAppSelector(selector); const { brushColor, maskColor, layer, isStaging } = useAppSelector(selector);
const currentColorDisplay = () => { const currentColorDisplay = () => {
if (layer === 'base') if (layer === 'base') {
return `rgba(${brushColor.r},${brushColor.g},${brushColor.b},${brushColor.a})`; return `rgba(${brushColor.r},${brushColor.g},${brushColor.b},${brushColor.a})`;
if (layer === 'mask') }
if (layer === 'mask') {
return `rgba(${maskColor.r},${maskColor.g},${maskColor.b},${maskColor.a})`; return `rgba(${maskColor.r},${maskColor.g},${maskColor.b},${maskColor.a})`;
}
}; };
useHotkeys( useHotkeys(

View File

@ -31,7 +31,9 @@ export default function UnifiedCanvasResetView() {
const handleResetCanvasView = (shouldScaleTo1 = false) => { const handleResetCanvasView = (shouldScaleTo1 = false) => {
const canvasBaseLayer = getCanvasBaseLayer(); const canvasBaseLayer = getCanvasBaseLayer();
if (!canvasBaseLayer) return; if (!canvasBaseLayer) {
return;
}
const clientRect = canvasBaseLayer.getClientRect({ const clientRect = canvasBaseLayer.getClientRect({
skipTransform: true, skipTransform: true,
}); });

View File

@ -30,11 +30,7 @@ const UnifiedCanvasCoreParameters = () => {
const { shouldUseSliders, activeLabel } = useAppSelector(selector); const { shouldUseSliders, activeLabel } = useAppSelector(selector);
return ( return (
<IAICollapse <IAICollapse label="General" activeLabel={activeLabel} defaultIsOpen={true}>
label={'General'}
activeLabel={activeLabel}
defaultIsOpen={true}
>
<Flex <Flex
sx={{ sx={{
flexDirection: 'column', flexDirection: 'column',