Spaces:
Configuration error
Configuration error
Commit
•
111d106
1
Parent(s):
8cfbb4d
Update Modal
Browse files
frontend/src/components/Modal/importer.js
CHANGED
@@ -10,6 +10,7 @@ export default function Import(props){
|
|
10 |
const [tab, setTab] = useState("gradio")
|
11 |
const [subTab, setSubTab] = useState(0)
|
12 |
|
|
|
13 |
return (<div>
|
14 |
<Modal
|
15 |
basic
|
@@ -37,17 +38,17 @@ export default function Import(props){
|
|
37 |
<div className='w-full bg-white'>
|
38 |
<ul class="flex flex-wrap text-sm font-medium text-center text-gray-500 bg-gray-200 border-gray-200 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800" id="defaultTab" data-tabs-toggle="#defaultTabContent" role="tablist">
|
39 |
<li class="" onClick={()=>{setSubTab(0)}}>
|
40 |
-
<button id="local-sub-tab" data-tabs-target="#local" type="button" role="tab" aria-controls="local-gradio" aria-selected={tab === "gradio" ? "true" : "false"} className={`inline-block p-4 px-6 text-base font-sans font-bold ${subTab === 0 ? 'bg-gray-300' : '' } hover:bg-gray-300
|
41 |
</li>
|
42 |
<li class="" onClick={()=>{setSubTab(1)}}>
|
43 |
-
<button id="shared-sub-tab" data-tabs-target="#Gradio" type="button" role="tab" aria-controls="shared-gradio" aria-selected={tab === "gradio" ? "true" : "false"} className={`inline-block p-4 px-6 text-base font-sans font-bold ${subTab === 1 ? 'bg-gray-300' : '' } hover:bg-gray-300
|
44 |
</li>
|
45 |
</ul>
|
46 |
-
{subTab === 0 &&
|
47 |
{subTab === 1 && <Shared textHandler={props.textHandler} appendHandler={props.appendHandler} />}
|
48 |
|
49 |
-
{props.catch &&
|
50 |
-
<Message negative
|
51 |
<Message.Header className=" text-lg text-center">🚫 Something went wrong...</Message.Header>
|
52 |
<br/>
|
53 |
<h1 className=" underline pb-3 font-bold text-lg">🤔 Possible Things That could of happen <br/></h1>
|
@@ -64,7 +65,8 @@ export default function Import(props){
|
|
64 |
<li>- link already exist within the menu</li>
|
65 |
</ul>
|
66 |
|
67 |
-
</Message>
|
|
|
68 |
</div>
|
69 |
}
|
70 |
</Modal>
|
@@ -72,6 +74,23 @@ export default function Import(props){
|
|
72 |
}
|
73 |
|
74 |
function Shared(props){
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
75 |
return (
|
76 |
<div className='w-full shadow-lg'>
|
77 |
|
@@ -85,10 +104,18 @@ function Shared(props){
|
|
85 |
type="text" name="search"
|
86 |
onChange={(e) => {
|
87 |
props.textHandler(e, "text")
|
88 |
-
|
|
|
|
|
89 |
/>
|
90 |
</label>
|
91 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
92 |
<div className={`flex items-center rounded-md bg-light-white mt-6 border-dashed`}>
|
93 |
<label className="relative block p-5 w-full focus:shadow-xl">
|
94 |
<span className={`absolute inset-y-0 left-0 flex items-center pl-7`}>
|
@@ -104,8 +131,8 @@ function Shared(props){
|
|
104 |
/>
|
105 |
</label>
|
106 |
</div>
|
107 |
-
<div className='
|
108 |
-
<button className="relative p-0.5 mb-2 mr-2 overflow-hidden text-sm font-sans font-bold text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 dark:focus:ring-blue-800"
|
109 |
onClick={()=>{props.appendHandler()}}>
|
110 |
<span className="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">
|
111 |
Enter
|
|
|
10 |
const [tab, setTab] = useState("gradio")
|
11 |
const [subTab, setSubTab] = useState(0)
|
12 |
|
13 |
+
|
14 |
return (<div>
|
15 |
<Modal
|
16 |
basic
|
|
|
38 |
<div className='w-full bg-white'>
|
39 |
<ul class="flex flex-wrap text-sm font-medium text-center text-gray-500 bg-gray-200 border-gray-200 dark:border-gray-700 dark:text-gray-400 dark:bg-gray-800" id="defaultTab" data-tabs-toggle="#defaultTabContent" role="tablist">
|
40 |
<li class="" onClick={()=>{setSubTab(0)}}>
|
41 |
+
<button id="local-sub-tab" data-tabs-target="#local" type="button" role="tab" aria-controls="local-gradio" aria-selected={tab === "gradio" ? "true" : "false"} className={`inline-block p-4 px-6 text-base font-sans font-bold ${subTab === 0 ? 'bg-gray-300' : '' } hover:bg-gray-300 `}>Local</button>
|
42 |
</li>
|
43 |
<li class="" onClick={()=>{setSubTab(1)}}>
|
44 |
+
<button id="shared-sub-tab" data-tabs-target="#Gradio" type="button" role="tab" aria-controls="shared-gradio" aria-selected={tab === "gradio" ? "true" : "false"} className={`inline-block p-4 px-6 text-base font-sans font-bold ${subTab === 1 ? 'bg-gray-300' : '' } hover:bg-gray-300 `}>Shared</button>
|
45 |
</li>
|
46 |
</ul>
|
47 |
+
{subTab === 0 && <div className='p-5 text-black'> Coming soon ....</div>}
|
48 |
{subTab === 1 && <Shared textHandler={props.textHandler} appendHandler={props.appendHandler} />}
|
49 |
|
50 |
+
{props.catch && <div className='p-5'>
|
51 |
+
<Message negative>
|
52 |
<Message.Header className=" text-lg text-center">🚫 Something went wrong...</Message.Header>
|
53 |
<br/>
|
54 |
<h1 className=" underline pb-3 font-bold text-lg">🤔 Possible Things That could of happen <br/></h1>
|
|
|
65 |
<li>- link already exist within the menu</li>
|
66 |
</ul>
|
67 |
|
68 |
+
</Message>
|
69 |
+
</div>}
|
70 |
</div>
|
71 |
}
|
72 |
</Modal>
|
|
|
74 |
}
|
75 |
|
76 |
function Shared(props){
|
77 |
+
const [preview, setPreview] = useState("")
|
78 |
+
const [fetchable, setFetch] = useState(false)
|
79 |
+
|
80 |
+
const isFetchable = async (url) => {
|
81 |
+
console.log(url)
|
82 |
+
fetch(url, {mode : "no-cors"}).then((re) => {
|
83 |
+
console.log(re)
|
84 |
+
if(re.url.includes("http://localhost:3000")){
|
85 |
+
setFetch(false)
|
86 |
+
} else { setFetch(true) }
|
87 |
+
|
88 |
+
}).catch((err)=>{
|
89 |
+
setFetch(false)
|
90 |
+
})
|
91 |
+
setFetch(false)
|
92 |
+
}
|
93 |
+
|
94 |
return (
|
95 |
<div className='w-full shadow-lg'>
|
96 |
|
|
|
104 |
type="text" name="search"
|
105 |
onChange={(e) => {
|
106 |
props.textHandler(e, "text")
|
107 |
+
setPreview(e.target.value)
|
108 |
+
setFetch(isFetchable(e.target.value))
|
109 |
+
}}
|
110 |
/>
|
111 |
</label>
|
112 |
</div>
|
113 |
+
{ fetchable === true && <div className=' w-full'>
|
114 |
+
<h1 className=' text-xl font-sans font-bold text-center text-black mb-2'> Preview </h1>
|
115 |
+
<div className='p-4 w-3/4 bg-gray-200 mr-auto ml-auto rounded-xl'>
|
116 |
+
<iframe title='Preview' src={preview} className=' w-full h-80 mr-auto ml-auto'/>
|
117 |
+
</div>
|
118 |
+
</div>}
|
119 |
<div className={`flex items-center rounded-md bg-light-white mt-6 border-dashed`}>
|
120 |
<label className="relative block p-5 w-full focus:shadow-xl">
|
121 |
<span className={`absolute inset-y-0 left-0 flex items-center pl-7`}>
|
|
|
131 |
/>
|
132 |
</label>
|
133 |
</div>
|
134 |
+
<div className=' ml-4'>
|
135 |
+
<button className="relative inline-flex justify-center p-0.5 mb-2 mr-2 overflow-hidden text-sm font-sans font-bold text-gray-900 rounded-lg group bg-gradient-to-br from-purple-600 to-blue-500 group-hover:from-purple-600 group-hover:to-blue-500 hover:text-white dark:text-white focus:ring-4 focus:outline-none focus:ring-blue-300 dark:focus:ring-blue-800"
|
136 |
onClick={()=>{props.appendHandler()}}>
|
137 |
<span className="relative px-5 py-2.5 transition-all ease-in duration-75 bg-white dark:bg-gray-900 rounded-md group-hover:bg-opacity-0">
|
138 |
Enter
|
frontend/src/components/Navagation/navbar.js
CHANGED
@@ -1,9 +1,9 @@
|
|
1 |
import React, { Component } from "react";
|
2 |
-
import {BsArrowLeftShort
|
3 |
import "../../css/dist/output.css"
|
4 |
import {ReactComponent as ReactLogo} from '../../images/logo.svg'
|
5 |
import { random_colour, random_emoji } from "../../helper/visual";
|
6 |
-
import {
|
7 |
import Import from '../Modal/importer'
|
8 |
export default class Navbar extends Component{
|
9 |
constructor(props){
|
@@ -199,7 +199,8 @@ export default class Navbar extends Component{
|
|
199 |
* @param {*} e : event type to get the target value of the current input
|
200 |
* @param {*} type : text | name string that set the changed value of the input to the current value
|
201 |
*/
|
202 |
-
updateText(e, type){
|
|
|
203 |
this.setState({open : this.state.open, menu : this.state.menu, text: type === "text" ? e.target.value : this.state.text, name: type === "name" ? e.target.value : this.state.name, colour : this.state.colour, emoji : this.state.emoji, error : this.state.error, modal : this.state.modal })
|
204 |
}
|
205 |
|
|
|
1 |
import React, { Component } from "react";
|
2 |
+
import {BsArrowLeftShort} from 'react-icons/bs';
|
3 |
import "../../css/dist/output.css"
|
4 |
import {ReactComponent as ReactLogo} from '../../images/logo.svg'
|
5 |
import { random_colour, random_emoji } from "../../helper/visual";
|
6 |
+
import { Icon } from 'semantic-ui-react'
|
7 |
import Import from '../Modal/importer'
|
8 |
export default class Navbar extends Component{
|
9 |
constructor(props){
|
|
|
199 |
* @param {*} e : event type to get the target value of the current input
|
200 |
* @param {*} type : text | name string that set the changed value of the input to the current value
|
201 |
*/
|
202 |
+
updateText = (e, type) => {
|
203 |
+
console.log(this.state.open)
|
204 |
this.setState({open : this.state.open, menu : this.state.menu, text: type === "text" ? e.target.value : this.state.text, name: type === "name" ? e.target.value : this.state.name, colour : this.state.colour, emoji : this.state.emoji, error : this.state.error, modal : this.state.modal })
|
205 |
}
|
206 |
|
frontend/src/css/dist/output.css
CHANGED
@@ -664,10 +664,6 @@ video {
|
|
664 |
z-index: 50;
|
665 |
}
|
666 |
|
667 |
-
.float-right {
|
668 |
-
float: right;
|
669 |
-
}
|
670 |
-
|
671 |
.float-left {
|
672 |
float: left;
|
673 |
}
|
@@ -680,6 +676,18 @@ video {
|
|
680 |
margin: 0px;
|
681 |
}
|
682 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
683 |
.mr-2 {
|
684 |
margin-right: 0.5rem;
|
685 |
}
|
@@ -780,6 +788,22 @@ video {
|
|
780 |
height: 41px;
|
781 |
}
|
782 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
783 |
.w-full {
|
784 |
width: 100%;
|
785 |
}
|
@@ -828,6 +852,34 @@ video {
|
|
828 |
width: 100vw;
|
829 |
}
|
830 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
831 |
.max-w-full {
|
832 |
max-width: 100%;
|
833 |
}
|
@@ -889,10 +941,6 @@ video {
|
|
889 |
flex-wrap: wrap;
|
890 |
}
|
891 |
|
892 |
-
.items-end {
|
893 |
-
align-items: flex-end;
|
894 |
-
}
|
895 |
-
|
896 |
.items-center {
|
897 |
align-items: center;
|
898 |
}
|
@@ -945,6 +993,10 @@ video {
|
|
945 |
border-radius: 0.75rem;
|
946 |
}
|
947 |
|
|
|
|
|
|
|
|
|
948 |
.rounded-t-lg {
|
949 |
border-top-left-radius: 0.5rem;
|
950 |
border-top-right-radius: 0.5rem;
|
@@ -1077,6 +1129,11 @@ video {
|
|
1077 |
background-color: rgb(254 169 89 / var(--tw-bg-opacity));
|
1078 |
}
|
1079 |
|
|
|
|
|
|
|
|
|
|
|
1080 |
.bg-gradient-to-bl {
|
1081 |
background-image: linear-gradient(to bottom left, var(--tw-gradient-stops));
|
1082 |
}
|
@@ -1295,6 +1352,10 @@ video {
|
|
1295 |
padding: 0.25rem;
|
1296 |
}
|
1297 |
|
|
|
|
|
|
|
|
|
1298 |
.px-6 {
|
1299 |
padding-left: 1.5rem;
|
1300 |
padding-right: 1.5rem;
|
|
|
664 |
z-index: 50;
|
665 |
}
|
666 |
|
|
|
|
|
|
|
|
|
667 |
.float-left {
|
668 |
float: left;
|
669 |
}
|
|
|
676 |
margin: 0px;
|
677 |
}
|
678 |
|
679 |
+
.m-3 {
|
680 |
+
margin: 0.75rem;
|
681 |
+
}
|
682 |
+
|
683 |
+
.m-1 {
|
684 |
+
margin: 0.25rem;
|
685 |
+
}
|
686 |
+
|
687 |
+
.m-0\.5 {
|
688 |
+
margin: 0.125rem;
|
689 |
+
}
|
690 |
+
|
691 |
.mr-2 {
|
692 |
margin-right: 0.5rem;
|
693 |
}
|
|
|
788 |
height: 41px;
|
789 |
}
|
790 |
|
791 |
+
.h-60 {
|
792 |
+
height: 15rem;
|
793 |
+
}
|
794 |
+
|
795 |
+
.h-80 {
|
796 |
+
height: 20rem;
|
797 |
+
}
|
798 |
+
|
799 |
+
.h-\[10px\] {
|
800 |
+
height: 10px;
|
801 |
+
}
|
802 |
+
|
803 |
+
.h-\[30px\] {
|
804 |
+
height: 30px;
|
805 |
+
}
|
806 |
+
|
807 |
.w-full {
|
808 |
width: 100%;
|
809 |
}
|
|
|
852 |
width: 100vw;
|
853 |
}
|
854 |
|
855 |
+
.w-1\/2 {
|
856 |
+
width: 50%;
|
857 |
+
}
|
858 |
+
|
859 |
+
.w-3\/4 {
|
860 |
+
width: 75%;
|
861 |
+
}
|
862 |
+
|
863 |
+
.w-\[90\%\] {
|
864 |
+
width: 90%;
|
865 |
+
}
|
866 |
+
|
867 |
+
.w-\[98\%\] {
|
868 |
+
width: 98%;
|
869 |
+
}
|
870 |
+
|
871 |
+
.w-\[100\%\] {
|
872 |
+
width: 100%;
|
873 |
+
}
|
874 |
+
|
875 |
+
.w-\[10px\] {
|
876 |
+
width: 10px;
|
877 |
+
}
|
878 |
+
|
879 |
+
.w-\[30px\] {
|
880 |
+
width: 30px;
|
881 |
+
}
|
882 |
+
|
883 |
.max-w-full {
|
884 |
max-width: 100%;
|
885 |
}
|
|
|
941 |
flex-wrap: wrap;
|
942 |
}
|
943 |
|
|
|
|
|
|
|
|
|
944 |
.items-center {
|
945 |
align-items: center;
|
946 |
}
|
|
|
993 |
border-radius: 0.75rem;
|
994 |
}
|
995 |
|
996 |
+
.rounded-3xl {
|
997 |
+
border-radius: 1.5rem;
|
998 |
+
}
|
999 |
+
|
1000 |
.rounded-t-lg {
|
1001 |
border-top-left-radius: 0.5rem;
|
1002 |
border-top-right-radius: 0.5rem;
|
|
|
1129 |
background-color: rgb(254 169 89 / var(--tw-bg-opacity));
|
1130 |
}
|
1131 |
|
1132 |
+
.bg-gray-400 {
|
1133 |
+
--tw-bg-opacity: 1;
|
1134 |
+
background-color: rgb(156 163 175 / var(--tw-bg-opacity));
|
1135 |
+
}
|
1136 |
+
|
1137 |
.bg-gradient-to-bl {
|
1138 |
background-image: linear-gradient(to bottom left, var(--tw-gradient-stops));
|
1139 |
}
|
|
|
1352 |
padding: 0.25rem;
|
1353 |
}
|
1354 |
|
1355 |
+
.p-3 {
|
1356 |
+
padding: 0.75rem;
|
1357 |
+
}
|
1358 |
+
|
1359 |
.px-6 {
|
1360 |
padding-left: 1.5rem;
|
1361 |
padding-right: 1.5rem;
|