11import { Flex , Image } from '@chakra-ui/react' ;
2- import { NodeProps } from 'reactflow' ;
3- import { InvocationValue } from '../types/types' ;
4-
5- import { useAppSelector } from 'app/store/storeHooks' ;
2+ import { RootState } from 'app/store/store' ;
63import { IAINoContentFallback } from 'common/components/IAIImageFallback' ;
74import { memo } from 'react' ;
5+ import { useDispatch , useSelector } from 'react-redux' ;
6+ import { NodeProps , OnResize } from 'reactflow' ;
7+ import { setProgressNodeSize } from '../store/nodesSlice' ;
88import IAINodeHeader from './IAINode/IAINodeHeader' ;
99import IAINodeResizer from './IAINode/IAINodeResizer' ;
1010import NodeWrapper from './NodeWrapper' ;
1111
12- const ProgressImageNode = ( props : NodeProps < InvocationValue > ) => {
13- const progressImage = useAppSelector ( ( state ) => state . system . progressImage ) ;
12+ const ProgressImageNode = ( props : NodeProps ) => {
13+ const progressImage = useSelector (
14+ ( state : RootState ) => state . system . progressImage
15+ ) ;
16+ const progressNodeSize = useSelector (
17+ ( state : RootState ) => state . nodes . progressNodeSize
18+ ) ;
19+ const dispatch = useDispatch ( ) ;
1420 const { selected } = props ;
1521
22+ const handleResize : OnResize = ( _ , newSize ) => {
23+ dispatch ( setProgressNodeSize ( newSize ) ) ;
24+ } ;
25+
1626 return (
1727 < NodeWrapper selected = { selected } >
1828 < IAINodeHeader
1929 title = "Progress Image"
2030 description = "Displays the progress image in the Node Editor"
2131 />
22-
2332 < Flex
24- className = "nopan"
2533 sx = { {
2634 flexDirection : 'column' ,
35+ flexShrink : 0 ,
2736 borderBottomRadius : 'md' ,
28- p : 2 ,
2937 bg : 'base.200' ,
3038 _dark : { bg : 'base.800' } ,
39+ width : progressNodeSize . width - 2 ,
40+ height : progressNodeSize . height - 2 ,
41+ minW : 250 ,
42+ minH : 250 ,
43+ overflow : 'hidden' ,
3144 } }
3245 >
3346 { progressImage ? (
@@ -42,22 +55,17 @@ const ProgressImageNode = (props: NodeProps<InvocationValue>) => {
4255 ) : (
4356 < Flex
4457 sx = { {
45- w : 'full' ,
46- h : 'full' ,
47- minW : 32 ,
48- minH : 32 ,
49- alignItems : 'center' ,
50- justifyContent : 'center' ,
58+ minW : 250 ,
59+ minH : 250 ,
60+ width : progressNodeSize . width - 2 ,
61+ height : progressNodeSize . height - 2 ,
5162 } }
5263 >
5364 < IAINoContentFallback />
5465 </ Flex >
5566 ) }
5667 </ Flex >
57- < IAINodeResizer
58- maxHeight = { progressImage ?. height ?? 512 }
59- maxWidth = { progressImage ?. width ?? 512 }
60- />
68+ < IAINodeResizer onResize = { handleResize } />
6169 </ NodeWrapper >
6270 ) ;
6371} ;
0 commit comments