zack commited on
Commit
0146adb
1 Parent(s): 2d704d0

:sparkles: Update Custom component

Browse files
frontend/src/components/Nodes/Custom.js CHANGED
@@ -1,42 +1,10 @@
1
  import React, { useCallback, useEffect, useRef, useState } from "react"
2
- import { Modal, Message } from 'semantic-ui-react';
3
- import { useFetch } from '../../hooks/useFetch';
4
- import Debug from '../../utilities/Debug';
5
 
6
  /**
7
  * Custom hook to check iframe reachability.
8
  * @param {string} url - The URL to check for reachability.
9
  * @returns {boolean} - True if reachable, false otherwise.
10
  */
11
- const useCheckReachability = (url) => {
12
- const { data, error } = useFetch(url);
13
- Debug.log('Checking reachability for:', url);
14
- return { isReachable: !!data, error };
15
- };
16
-
17
- /**
18
- * A component to render a debug message.
19
- * @param {string} message - The debug message to display.
20
- */
21
- const DebugMessage = ({ message }) => {
22
- useEffect(() => {
23
- Debug.log(message);
24
- }, [message]);
25
-
26
- return null; // This component does not render anything.
27
- };
28
-
29
- /**
30
- * A function to create a one-purpose utility.
31
- * @param {Function} fn - The function to execute.
32
- * @param {Array} args - The arguments to pass to the function.
33
- * @returns {any} - The result of the function execution.
34
- */
35
- const executeUtility = (fn, ...args) => {
36
- Debug.log('Executing utility function with args:', args);
37
- return fn(...args);
38
- };
39
-
40
  import {TbResize} from 'react-icons/tb'
41
  import {BiCube, BiRefresh} from 'react-icons/bi'
42
  import {BsTrash} from 'react-icons/bs'
@@ -81,6 +49,23 @@ export default function CustomNodeIframe({id, data}){
81
  },1000)
82
  },[])
83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
84
 
85
  return (
86
  <div className="w-10 h-10">
 
1
  import React, { useCallback, useEffect, useRef, useState } from "react"
 
 
 
2
 
3
  /**
4
  * Custom hook to check iframe reachability.
5
  * @param {string} url - The URL to check for reachability.
6
  * @returns {boolean} - True if reachable, false otherwise.
7
  */
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
  import {TbResize} from 'react-icons/tb'
9
  import {BiCube, BiRefresh} from 'react-icons/bi'
10
  import {BsTrash} from 'react-icons/bs'
 
49
  },1000)
50
  },[])
51
 
52
+ const [iframeUrl, setIframeUrl] = useState('');
53
+ const [iframeLabel, setIframeLabel] = useState('');
54
+
55
+ const handleIframeUrlChange = (e) => {
56
+ setIframeUrl(e.target.value);
57
+ };
58
+
59
+ const handleIframeLabelChange = (e) => {
60
+ setIframeLabel(e.target.value);
61
+ };
62
+
63
+ const addIframeNode = () => {
64
+ handleAddEmbed({ url: iframeUrl, label: iframeLabel || 'Embedded Content' });
65
+ setIframeUrl(''); // Reset the input field after adding
66
+ setIframeLabel('');
67
+ };
68
+
69
 
70
  return (
71
  <div className="w-10 h-10">