mirror of
https://github.com/hazemKrimi/crimson-quirks-ui.git
synced 2026-05-01 18:20:28 +00:00
Fix prototype editing to connect nodes correctly
This commit is contained in:
@@ -118,7 +118,7 @@ const Prototype = () => {
|
|||||||
}, [id]);
|
}, [id]);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
// if (template && template.features) {
|
if (template && template.features) {
|
||||||
const initialNodes = template?.features?.map((feature, index) => ({
|
const initialNodes = template?.features?.map((feature, index) => ({
|
||||||
id: feature.id,
|
id: feature.id,
|
||||||
type: 'featureCard',
|
type: 'featureCard',
|
||||||
@@ -131,7 +131,7 @@ const Prototype = () => {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
if (initialNodes) setNodes(initialNodes);
|
if (initialNodes) setNodes(initialNodes);
|
||||||
// }
|
}
|
||||||
|
|
||||||
if (prototype) {
|
if (prototype) {
|
||||||
const initialEdges: Array<Edge> = [];
|
const initialEdges: Array<Edge> = [];
|
||||||
@@ -159,12 +159,12 @@ const Prototype = () => {
|
|||||||
|
|
||||||
const handleEditPrototype = () => {
|
const handleEditPrototype = () => {
|
||||||
if (editing) {
|
if (editing) {
|
||||||
const prototypeInput = nodes
|
const prototypeInput = edges
|
||||||
.map((node) => ({
|
.map((edge) => ({
|
||||||
featureId: node.id,
|
featureId: edge.source,
|
||||||
connections: [
|
connections: [
|
||||||
{
|
{
|
||||||
to: node.id,
|
to: edge.target,
|
||||||
releations: { back: false, forword: true },
|
releations: { back: false, forword: true },
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in New Issue
Block a user