-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f49397b
commit a665a59
Showing
21 changed files
with
229 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
2 changes: 1 addition & 1 deletion
2
...mponents/NodeComponent/NodeImgPreview.tsx → ...s/NodeComponent/SdNode/NodeImgPreview.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/NodeComponent/NodeInputs.tsx → ...nents/NodeComponent/SdNode/NodeInputs.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/NodeComponent/NodeOutpus.tsx → ...nents/NodeComponent/SdNode/NodeOutpus.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
src/components/NodeComponent/NodeParams.tsx → ...nents/NodeComponent/SdNode/NodeParams.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { SpaceGrid } from '@/components/NodeComponent/style' | ||
import { useAppStore } from '@/store' | ||
import { Widget } from '@/types' | ||
import { checkInput } from '@/utils' | ||
import React from 'react' | ||
import { NodeProps } from 'reactflow' | ||
import { shallow } from 'zustand/shallow' | ||
import NodeImgPreview from './NodeImgPreview' | ||
import NodeInputs from './NodeInputs' | ||
import NodeOutpus from './NodeOutpus' | ||
import NodeParams from './NodeParams' | ||
|
||
const SdNode: React.FC<NodeProps<Widget>> = (node) => { | ||
const { imagePreviews, inputImgPreviews } = useAppStore( | ||
(st) => ({ | ||
imagePreviews: st.graph?.[node.id]?.images | ||
?.map((image, index) => { | ||
return { | ||
image, | ||
index, | ||
} | ||
}) | ||
.filter(Boolean), | ||
inputImgPreviews: [ | ||
{ | ||
image: { | ||
filename: st.onGetNodeFieldsData(node.id, 'image'), | ||
type: 'input', | ||
}, | ||
index: 0, | ||
}, | ||
].filter((i) => i.image.filename), | ||
onPropChange: st.onPropChange, | ||
}), | ||
shallow | ||
) | ||
|
||
const params: any[] = [] | ||
const inputs: any[] = [] | ||
const outputs: any[] = node.data.output | ||
|
||
for (const [property, input] of Object.entries(node.data.input.required)) { | ||
if (checkInput.isParameterOrList(input)) { | ||
params.push({ name: property, type: input[0], input }) | ||
} else { | ||
inputs.push({ name: property, type: input[0] }) | ||
} | ||
} | ||
|
||
return ( | ||
<> | ||
<SpaceGrid> | ||
<NodeInputs data={inputs} /> | ||
<NodeOutpus data={outputs} /> | ||
</SpaceGrid> | ||
<NodeParams data={params} nodeId={node.id} /> | ||
<NodeImgPreview data={imagePreviews || inputImgPreviews} /> | ||
</> | ||
) | ||
} | ||
|
||
export default React.memo(SdNode) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.