Spaces:
Configuration error
Configuration error
zack
commited on
Commit
•
47fefa6
1
Parent(s):
f96cac1
:sparkles: Update modal and navbar components
Browse files
frontend/src/components/Modal/importer.js
CHANGED
@@ -7,20 +7,18 @@ import { useState } from 'react'
|
|
7 |
import { BsSearch } from 'react-icons/bs';
|
8 |
|
9 |
export default function Import(props) {
|
10 |
-
// const [tab, setTab] = useState("gradio")
|
11 |
const [subTab, setSubTab] = useState(0)
|
12 |
const [embedUrl, setEmbedUrl] = useState("");
|
13 |
const [vmid, setVmid] = useState('');
|
14 |
const [node, setNode] = useState('');
|
15 |
const [iframeSrc, setIframeSrc] = useState("");
|
16 |
const [tab, setTab] = useState('')
|
17 |
-
|
18 |
|
19 |
const handleSubmit = async (e) => {
|
20 |
e.preventDefault();
|
21 |
-
// Assuming iframeSrc is already bound to an input field where users can paste any iframe link
|
22 |
console.debug("Embed submit:", iframeSrc);
|
23 |
-
props.onAddEmbed({ url: iframeSrc, type: 'embed' });
|
24 |
};
|
25 |
|
26 |
const handleProxmoxSubmit = async (e) => {
|
@@ -131,7 +129,6 @@ export default function Import(props) {
|
|
131 |
</div>
|
132 |
}
|
133 |
|
134 |
-
// Update the form to include a title input
|
135 |
{tab === "IframeURL" && (
|
136 |
<form onSubmit={handleSubmit}>
|
137 |
<input
|
@@ -152,7 +149,6 @@ export default function Import(props) {
|
|
152 |
</form>
|
153 |
)}
|
154 |
|
155 |
-
// Ensure this conditional rendering block is correctly placed within your component's return statement
|
156 |
{iframeSrc && (
|
157 |
<div className='p-5 flex flex-col items-start'>
|
158 |
<iframe src={iframeSrc} frameBorder="0" style={{ width: "100%", height: "400px" }} allowFullScreen></iframe>
|
|
|
7 |
import { BsSearch } from 'react-icons/bs';
|
8 |
|
9 |
export default function Import(props) {
|
|
|
10 |
const [subTab, setSubTab] = useState(0)
|
11 |
const [embedUrl, setEmbedUrl] = useState("");
|
12 |
const [vmid, setVmid] = useState('');
|
13 |
const [node, setNode] = useState('');
|
14 |
const [iframeSrc, setIframeSrc] = useState("");
|
15 |
const [tab, setTab] = useState('')
|
16 |
+
const [iframeTitle, setIframeTitle] = useState(""); // Added state for iframeTitle
|
17 |
|
18 |
const handleSubmit = async (e) => {
|
19 |
e.preventDefault();
|
|
|
20 |
console.debug("Embed submit:", iframeSrc);
|
21 |
+
props.onAddEmbed({ url: iframeSrc, title: iframeTitle, type: 'embed' }); // Modified to include title
|
22 |
};
|
23 |
|
24 |
const handleProxmoxSubmit = async (e) => {
|
|
|
129 |
</div>
|
130 |
}
|
131 |
|
|
|
132 |
{tab === "IframeURL" && (
|
133 |
<form onSubmit={handleSubmit}>
|
134 |
<input
|
|
|
149 |
</form>
|
150 |
)}
|
151 |
|
|
|
152 |
{iframeSrc && (
|
153 |
<div className='p-5 flex flex-col items-start'>
|
154 |
<iframe src={iframeSrc} frameBorder="0" style={{ width: "100%", height: "400px" }} allowFullScreen></iframe>
|
frontend/src/components/Navagation/navbar.js
CHANGED
@@ -152,10 +152,21 @@ export default class Navbar extends Component{
|
|
152 |
this.setState({'open' : !this.state.open})
|
153 |
}
|
154 |
|
|
|
|
|
|
|
|
|
|
|
155 |
updateText = (e, type) => {
|
156 |
this.setState({[`${type}`] : e.target.value })
|
157 |
}
|
158 |
|
|
|
|
|
|
|
|
|
|
|
|
|
159 |
subComponents(item, index){
|
160 |
|
161 |
return(<>
|
@@ -212,3 +223,4 @@ export default class Navbar extends Component{
|
|
212 |
</div>)
|
213 |
}
|
214 |
}
|
|
|
|
152 |
this.setState({'open' : !this.state.open})
|
153 |
}
|
154 |
|
155 |
+
/**
|
156 |
+
*
|
157 |
+
* @param {*} e : event type to get the target value of the current input
|
158 |
+
* @param {*} type : text | name string that set the changed value of the input to the current value
|
159 |
+
*/
|
160 |
updateText = (e, type) => {
|
161 |
this.setState({[`${type}`] : e.target.value })
|
162 |
}
|
163 |
|
164 |
+
/**
|
165 |
+
*
|
166 |
+
* @param {*} item : object infomation from the flask api
|
167 |
+
* @param {*} index : current index with in the list
|
168 |
+
* @returns div component that contians infomation of gradio
|
169 |
+
*/
|
170 |
subComponents(item, index){
|
171 |
|
172 |
return(<>
|
|
|
223 |
</div>)
|
224 |
}
|
225 |
}
|
226 |
+
|