Spaces:
Configuration error
Configuration error
zack
commited on
Commit
•
651209c
1
Parent(s):
afc4c05
🔧 Update docker-compose for better port management
Browse files
docker-compose.yml
CHANGED
@@ -20,7 +20,7 @@ services:
|
|
20 |
context : ./frontend
|
21 |
dockerfile : Dockerfile
|
22 |
ports:
|
23 |
-
- "
|
24 |
volumes:
|
25 |
- './frontend/src:/app/src'
|
26 |
- './frontend/public:/app/public'
|
|
|
20 |
context : ./frontend
|
21 |
dockerfile : Dockerfile
|
22 |
ports:
|
23 |
+
- "3001:3000"
|
24 |
volumes:
|
25 |
- './frontend/src:/app/src'
|
26 |
- './frontend/public:/app/public'
|
frontend/src/components/Nodes/Custom.js
CHANGED
@@ -15,7 +15,7 @@ import { useSpring, animated } from 'react-spring'
|
|
15 |
const MINIMUM_HEIGHT = 600;
|
16 |
const MINIMUM_WIDTH = 540;
|
17 |
|
18 |
-
export default function CustomNodeIframe({id, data}){
|
19 |
const [collapsed, setCollapsible] = useState(true)
|
20 |
const [{width, height}, api] = useSpring(() => ({width: MINIMUM_WIDTH, height: MINIMUM_HEIGHT }))
|
21 |
const [sizeAdjuster, setSizeAdjuster] = useState(false)
|
@@ -106,3 +106,4 @@ const addIframeNode = () => {
|
|
106 |
}
|
107 |
</div>)
|
108 |
}
|
|
|
|
15 |
const MINIMUM_HEIGHT = 600;
|
16 |
const MINIMUM_WIDTH = 540;
|
17 |
|
18 |
+
export default function CustomNodeIframe({id, data, handleAddEmbed}){
|
19 |
const [collapsed, setCollapsible] = useState(true)
|
20 |
const [{width, height}, api] = useSpring(() => ({width: MINIMUM_WIDTH, height: MINIMUM_HEIGHT }))
|
21 |
const [sizeAdjuster, setSizeAdjuster] = useState(false)
|
|
|
106 |
}
|
107 |
</div>)
|
108 |
}
|
109 |
+
|
frontend/src/components/ReactFlow/ReactFlowEnv.js
CHANGED
@@ -1,3 +1,4 @@
|
|
|
|
1 |
import CustomNodeIframe from "../Nodes/Custom.js";
|
2 |
import '../../css/dist/output.css'
|
3 |
import ReactFlow, { Background,
|
@@ -73,15 +74,16 @@ export default function ReactEnviorment() {
|
|
73 |
setNodes((nds) => nds.concat(newNode));
|
74 |
};
|
75 |
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
}
|
|
|
85 |
|
86 |
const onNodesChange = useCallback(
|
87 |
(changes) => setNodes((nds) => applyNodeChanges(changes, nds)),
|
|
|
1 |
+
import Custom from "../Nodes/Custom.js";
|
2 |
import CustomNodeIframe from "../Nodes/Custom.js";
|
3 |
import '../../css/dist/output.css'
|
4 |
import ReactFlow, { Background,
|
|
|
74 |
setNodes((nds) => nds.concat(newNode));
|
75 |
};
|
76 |
|
77 |
+
const handleAddEmbed = useCallback((embedData) => {
|
78 |
+
const newNode = {
|
79 |
+
id: `embed-${nodes.length + 1}`,
|
80 |
+
type: 'embed',
|
81 |
+
position: reactFlowInstance.project({ x: 0, y: 0 }), // Adjust position as needed
|
82 |
+
data: { url: embedData.url, width: embedData.width || '100%', height: embedData.height || '400px' },
|
83 |
+
};
|
84 |
+
setNodes((nds) => nds.concat(newNode));
|
85 |
+
console.log(`Adding embed with URL: ${embedData.url} and Label: ${embedData.label}`);
|
86 |
+
}, [nodes, reactFlowInstance]);
|
87 |
|
88 |
const onNodesChange = useCallback(
|
89 |
(changes) => setNodes((nds) => applyNodeChanges(changes, nds)),
|