zack commited on
Commit
7736a4b
Β·
1 Parent(s): 8770e78

πŸ› fix: remove unnecessary escape characters in navbar.js

Browse files
frontend/src/components/Navagation/navbar.js CHANGED
@@ -1,10 +1,12 @@
1
  import React, { Component } from "react";
2
  import { Icon } from 'semantic-ui-react'
3
  import Import from '../Modal/importer'
4
- import { random_colour, random_emoji } from "../../src/helper/visual";
 
 
5
 
6
  import {BsArrowLeftShort} from 'react-icons/bs';
7
- import {ReactComponent as ReactLogo} from '../../src/images/logo.svg'
8
 
9
  export default class Navbar extends Component{
10
  constructor(props){
@@ -56,9 +58,9 @@ export default class Navbar extends Component{
56
  */
57
  appendStreamNode = async (type) => {
58
  const pattern = {
59
- local : new RegExp("^https?:\/\/localhost(:[0-9]+)?(\/)?$"),
60
- share : new RegExp("^https?:\/\/[0-9a-zA-Z-]+\.gradio\.live(\/)?$"),
61
- hugginFace : new RegExp("^https?:\/\/[a-zA-Z0-9-]+\-gradio\.hf\.space(\/)?$")
62
  }
63
 
64
  if (this.state.name.length > 20 ||
@@ -75,8 +77,7 @@ export default class Navbar extends Component{
75
  'error': true})
76
  return
77
  }
78
-
79
- fetch(this.state.text, {method : "GET", mode: 'no-cors'}).then((re) => {
80
  fetch("http://localhost:2000/api/append/port", {method: 'POST', mode : 'cors', headers : { 'Content-Type' : 'application/json' }, body: JSON.stringify({file : "", kwargs : { type : type }, name : this.state.name === "" ?`temp_class_${this.temp_host++}` : `${this.state.name}`, port: 0 , host : this.state.text}) }).then(resp => {
81
  this.setState({'text': "",'name' : "",'error' : false,'modal' : false })
82
 
 
1
  import React, { Component } from "react";
2
  import { Icon } from 'semantic-ui-react'
3
  import Import from '../Modal/importer'
4
+ import { random_colour, random_emoji } from "../../helper/visual";
5
+
6
+ import "../../css/dist/output.css"
7
 
8
  import {BsArrowLeftShort} from 'react-icons/bs';
9
+ import {ReactComponent as ReactLogo} from '../../images/logo.svg'
10
 
11
  export default class Navbar extends Component{
12
  constructor(props){
 
58
  */
59
  appendStreamNode = async (type) => {
60
  const pattern = {
61
+ local : new RegExp('^https?://(localhost)(:[0-9]+)?(/)?$'),
62
+ share : new RegExp('^https?://(?:[a-zA-Z0-9]+\\.gradio\\.live)/?$'),
63
+ huggingFace: new RegExp('^https?://([a-zA-Z0-9-]+\\.hf\\.space)/?$')
64
  }
65
 
66
  if (this.state.name.length > 20 ||
 
77
  'error': true})
78
  return
79
  }
80
+ fetch(this.state.text, {method: "GET", mode: 'no-cors'}).then((re) => {
 
81
  fetch("http://localhost:2000/api/append/port", {method: 'POST', mode : 'cors', headers : { 'Content-Type' : 'application/json' }, body: JSON.stringify({file : "", kwargs : { type : type }, name : this.state.name === "" ?`temp_class_${this.temp_host++}` : `${this.state.name}`, port: 0 , host : this.state.text}) }).then(resp => {
82
  this.setState({'text': "",'name' : "",'error' : false,'modal' : false })
83