LucaVivona commited on
Commit
771fa31
ยท
1 Parent(s): 761c013

๐Ÿ†• frontend updates

Browse files
frontend/Makefile ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ start:
2
+ npm run start
3
+
4
+ tailwind:
5
+ npx tailwindcss -i ./src/css/input.css -o ./src/css/dist/output.css --watch
6
+
frontend/src/components/Navagation/navbar.js CHANGED
@@ -62,18 +62,12 @@ export default class Navbar extends Component{
62
  hugginFace : /^https?:\/\/*(hf.space)\/*(embed)\/*([a-zA-Z0-9+_-]+)\/*([a-zA-Z0-9+_-]+)\/*([+])?(\/)?$/
63
  }
64
 
65
- if (this.state.menu.findIndex(element => {return element.name.toLowerCase() === this.state.name.toLowerCase() || element.host.includes(this.state.host) }) !== -1 ||
66
  this.state.text.includes(" ") ||
67
  (!pattern.local.test(this.state.text) &&
68
  !pattern.share.test(this.state.text) &&
69
  !pattern.hugginFace.test(this.state.text))){
70
 
71
- console.log(this.state.menu.findIndex(element => {return element.name.toLowerCase() === this.state.name.toLowerCase() || element.host.includes(this.state.host) }) !== -1)
72
- console.log(this.state.text.includes(" ") )
73
- console.log(this.state.text.includes("") )
74
- console.log(!pattern.local.test(this.state.text) &&
75
- !pattern.share.test(this.state.text) &&
76
- !pattern.hugginFace.test(this.state.text))
77
  this.setState({open : this.state.open,
78
  menu : this.state.menu,
79
  text: '',
@@ -97,7 +91,7 @@ export default class Navbar extends Component{
97
  error : false,
98
  modal : false })
99
 
100
- }).catch((err) => this.setState({open : this.state.open,
101
  menu : this.state.menu,
102
  text: '',
103
  name : '',
@@ -226,11 +220,14 @@ export default class Navbar extends Component{
226
 
227
  return(<>
228
  <li key={`${item.name}-${item.port}`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
229
- className={` text-white text-md flex text-center items-center cursor-pointer shadow-lg
230
- p-5 px-2 mt-4 ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} rounded-md mt-2 cursor-grabbing`} draggable>
231
- <span className="text-2xl font-medium "> </span>
232
- <span className={`text-base font-medium flex-1 text-left" ${this.state.open ? "" : "hidden"}`}>{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]} ${item.name}`}</span>
 
 
233
  </li >
 
234
  </>)
235
  }
236
 
 
62
  hugginFace : /^https?:\/\/*(hf.space)\/*(embed)\/*([a-zA-Z0-9+_-]+)\/*([a-zA-Z0-9+_-]+)\/*([+])?(\/)?$/
63
  }
64
 
65
+ if (this.state.menu.findIndex(element => {return element.name.toLowerCase() === this.state.name.toLowerCase() || element.host.includes(this.state.text) }) !== -1 ||
66
  this.state.text.includes(" ") ||
67
  (!pattern.local.test(this.state.text) &&
68
  !pattern.share.test(this.state.text) &&
69
  !pattern.hugginFace.test(this.state.text))){
70
 
 
 
 
 
 
 
71
  this.setState({open : this.state.open,
72
  menu : this.state.menu,
73
  text: '',
 
91
  error : false,
92
  modal : false })
93
 
94
+ }).catch(() => this.setState({open : this.state.open,
95
  menu : this.state.menu,
96
  text: '',
97
  name : '',
 
220
 
221
  return(<>
222
  <li key={`${item.name}-${item.port}`} onDragStart={(event) => this.onDragStart(event, 'custom', item, index)}
223
+ className={` text-white text-md flex text-center items-center cursor-grab shadow-lg
224
+ p-5 px-2 mt-4 rounded-md ${ this.state.open ? `hover:animate-pulse ${this.state.colour[index] === null ? "" : this.state.colour[index]} ` : `hidden`} `} draggable>
225
+
226
+ <span className="flex-1 text-4xl opacity-70">{`${this.state.emoji[index] === null ? "" : this.state.emoji[index]}`}</span>
227
+ <div className={` absolute text-base font-bold w-[90%] h-full" ${this.state.open ? "" : "hidden"}`}>{`${item.name}`}</div>
228
+
229
  </li >
230
+
231
  </>)
232
  }
233
 
frontend/src/components/Nodes/Custom.js CHANGED
@@ -47,7 +47,7 @@ export default class CustomNodeIframe extends React.Component {
47
  }
48
 
49
  onRefresh(){
50
- if(!this.isFetchable) this.onNodeClick(this.state.id)
51
  else{
52
  this.setState({id : this.state.id, reachable : this.state.reachable, selected : this.state.selected, data : this.state.data, width : this.state.width, height : this.state.height, size : this.state.size, iframe : this.state.iframe + 1})
53
  }
@@ -81,7 +81,7 @@ export default class CustomNodeIframe extends React.Component {
81
  }
82
 
83
  render(){
84
- if (!this.state.reachable) this.onNodeClick(this.state.id)
85
  return (<>
86
  <>
87
  <div className=" flex w-full h-10 top-0 cursor-pointer" onClick={this.handelEvent}>
@@ -91,7 +91,7 @@ export default class CustomNodeIframe extends React.Component {
91
  <div className={` flex ${this.state.selected ? '' : 'w-0 hidden'}`}>
92
  <div title="Adjust Node Size" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Violet rounded-xl" onClick={this.handelSizeState}><TbResize className="h-full w-full text-white p-1"/></div>
93
  <a href={this.state.data.host} target="_blank" rel="noopener noreferrer"><div title="Gradio Host Site" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Pink rounded-xl"><BiCube className="h-full w-full text-white p-1"/></div></a>
94
- <div title="Delete Node" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Red rounded-xl" onClick={() => this.onNodeClick(this.state.id)}><BsTrash className="h-full w-full text-white p-1"/></div>
95
  <div title="Refresh Node" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Orange rounded-xl" onClick={() => this.onRefresh()}><BiRefresh className="h-full w-full text-white p-1"/></div>
96
 
97
  { this.state.size && <div className="duration-300 flex w-auto h-full mr-2 -mt-3 space-x-4">
 
47
  }
48
 
49
  onRefresh(){
50
+ if(!this.isFetchable) this.onNodeClick(this.state.data.label)
51
  else{
52
  this.setState({id : this.state.id, reachable : this.state.reachable, selected : this.state.selected, data : this.state.data, width : this.state.width, height : this.state.height, size : this.state.size, iframe : this.state.iframe + 1})
53
  }
 
81
  }
82
 
83
  render(){
84
+ if (!this.state.reachable) this.onNodeClick(this.state.data.label)
85
  return (<>
86
  <>
87
  <div className=" flex w-full h-10 top-0 cursor-pointer" onClick={this.handelEvent}>
 
91
  <div className={` flex ${this.state.selected ? '' : 'w-0 hidden'}`}>
92
  <div title="Adjust Node Size" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Violet rounded-xl" onClick={this.handelSizeState}><TbResize className="h-full w-full text-white p-1"/></div>
93
  <a href={this.state.data.host} target="_blank" rel="noopener noreferrer"><div title="Gradio Host Site" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Pink rounded-xl"><BiCube className="h-full w-full text-white p-1"/></div></a>
94
+ <div title="Delete Node" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Red rounded-xl" onClick={() => this.onNodeClick(this.state.data.label)}><BsTrash className="h-full w-full text-white p-1"/></div>
95
  <div title="Refresh Node" className="duration-300 cursor-pointer shadow-xl border-2 dark:border-white border-white h-10 w-10 mr-2 -mt-3 bg-Warm-Orange rounded-xl" onClick={() => this.onRefresh()}><BiRefresh className="h-full w-full text-white p-1"/></div>
96
 
97
  { this.state.size && <div className="duration-300 flex w-auto h-full mr-2 -mt-3 space-x-4">
frontend/src/components/ReactFlow/ReactFlowEnv.js CHANGED
@@ -37,8 +37,8 @@ export default function ReactEnviorment() {
37
  event.dataTransfer.dropEffect = 'move';
38
  }, []);
39
 
40
- const deleteNode = (id) =>{setNodes((nds) => nds.filter(n => n.id !== id ))}
41
  const deleteNodeContains = (id) =>{setNodes((nds) => nds.filter(n => !n.id.includes(`${id}-`) ))}
 
42
  const onDrop = useCallback(
43
  (event) => {
44
  event.preventDefault();
@@ -60,7 +60,7 @@ export default function ReactEnviorment() {
60
  id: `${item.name}-${nodes.length}`,
61
  type,
62
  position,
63
- data: { label: `${item.name}`, host : `${item.host}`, colour : `${colour}`, delete : deleteNode },
64
  };
65
  setNodes((nds) => nds.concat(newNode));
66
  },
@@ -75,7 +75,7 @@ export default function ReactEnviorment() {
75
  <Navbar onDelete={deleteNodeContains}/>
76
  <ReactFlowProvider>
77
  <div className="h-screen w-screen" ref={reactFlowWrapper}>
78
- <ReactFlow nodes={nodes} edges={edges} nodeTypes={types} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onNodesDelete={deleteNode} onDragOver={onDragOver} onDrop={onDrop} onInit={setReactFlowInstance} fitView>
79
  <Background variant='dots' size={1} className=" bg-white dark:bg-neutral-800"/>
80
  </ReactFlow>
81
  </div>
 
37
  event.dataTransfer.dropEffect = 'move';
38
  }, []);
39
 
 
40
  const deleteNodeContains = (id) =>{setNodes((nds) => nds.filter(n => !n.id.includes(`${id}-`) ))}
41
+
42
  const onDrop = useCallback(
43
  (event) => {
44
  event.preventDefault();
 
60
  id: `${item.name}-${nodes.length}`,
61
  type,
62
  position,
63
+ data: { label: `${item.name}`, host : `${item.host}`, colour : `${colour}`, delete : deleteNodeContains },
64
  };
65
  setNodes((nds) => nds.concat(newNode));
66
  },
 
75
  <Navbar onDelete={deleteNodeContains}/>
76
  <ReactFlowProvider>
77
  <div className="h-screen w-screen" ref={reactFlowWrapper}>
78
+ <ReactFlow nodes={nodes} edges={edges} nodeTypes={types} onNodesChange={onNodesChange} onEdgesChange={onEdgesChange} onNodesDelete={deleteNodeContains} onDragOver={onDragOver} onDrop={onDrop} onInit={setReactFlowInstance} fitView>
79
  <Background variant='dots' size={1} className=" bg-white dark:bg-neutral-800"/>
80
  </ReactFlow>
81
  </div>
frontend/src/css/dist/output.css CHANGED
@@ -656,10 +656,6 @@ video {
656
  margin-top: 1rem;
657
  }
658
 
659
- .mt-2 {
660
- margin-top: 0.5rem;
661
- }
662
-
663
  .ml-auto {
664
  margin-left: auto;
665
  }
@@ -696,6 +692,10 @@ video {
696
  display: none;
697
  }
698
 
 
 
 
 
699
  .h-screen {
700
  height: 100vh;
701
  }
@@ -712,14 +712,14 @@ video {
712
  height: auto;
713
  }
714
 
715
- .h-full {
716
- height: 100%;
717
- }
718
-
719
  .h-\[600px\] {
720
  height: 600px;
721
  }
722
 
 
 
 
 
723
  .w-10 {
724
  width: 2.5rem;
725
  }
@@ -770,12 +770,12 @@ video {
770
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
771
  }
772
 
773
- .cursor-pointer {
774
- cursor: pointer;
775
  }
776
 
777
- .cursor-grabbing {
778
- cursor: grabbing;
779
  }
780
 
781
  .select-none {
@@ -1174,6 +1174,10 @@ video {
1174
  padding-left: 2.25rem;
1175
  }
1176
 
 
 
 
 
1177
  .pt-4 {
1178
  padding-top: 1rem;
1179
  }
@@ -1182,14 +1186,6 @@ video {
1182
  padding-top: 0.5rem;
1183
  }
1184
 
1185
- .pb-3 {
1186
- padding-bottom: 0.75rem;
1187
- }
1188
-
1189
- .text-left {
1190
- text-align: left;
1191
- }
1192
-
1193
  .text-center {
1194
  text-align: center;
1195
  }
@@ -1223,10 +1219,6 @@ video {
1223
  line-height: 2.5rem;
1224
  }
1225
 
1226
- .font-medium {
1227
- font-weight: 500;
1228
- }
1229
-
1230
  .font-bold {
1231
  font-weight: 700;
1232
  }
@@ -1250,6 +1242,18 @@ video {
1250
  text-decoration-line: underline;
1251
  }
1252
 
 
 
 
 
 
 
 
 
 
 
 
 
1253
  .shadow-lg {
1254
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
1255
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
@@ -1321,14 +1325,6 @@ video {
1321
  color: rgb(148 163 184 / var(--tw-text-opacity));
1322
  }
1323
 
1324
- .placeholder\:text-transparent::-webkit-input-placeholder {
1325
- color: transparent;
1326
- }
1327
-
1328
- .placeholder\:text-transparent::placeholder {
1329
- color: transparent;
1330
- }
1331
-
1332
  @-webkit-keyframes pulse {
1333
  50% {
1334
  opacity: .5;
 
656
  margin-top: 1rem;
657
  }
658
 
 
 
 
 
659
  .ml-auto {
660
  margin-left: auto;
661
  }
 
692
  display: none;
693
  }
694
 
695
+ .h-full {
696
+ height: 100%;
697
+ }
698
+
699
  .h-screen {
700
  height: 100vh;
701
  }
 
712
  height: auto;
713
  }
714
 
 
 
 
 
715
  .h-\[600px\] {
716
  height: 600px;
717
  }
718
 
719
+ .w-\[90\%\] {
720
+ width: 90%;
721
+ }
722
+
723
  .w-10 {
724
  width: 2.5rem;
725
  }
 
770
  transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
771
  }
772
 
773
+ .cursor-grab {
774
+ cursor: grab;
775
  }
776
 
777
+ .cursor-pointer {
778
+ cursor: pointer;
779
  }
780
 
781
  .select-none {
 
1174
  padding-left: 2.25rem;
1175
  }
1176
 
1177
+ .pb-3 {
1178
+ padding-bottom: 0.75rem;
1179
+ }
1180
+
1181
  .pt-4 {
1182
  padding-top: 1rem;
1183
  }
 
1186
  padding-top: 0.5rem;
1187
  }
1188
 
 
 
 
 
 
 
 
 
1189
  .text-center {
1190
  text-align: center;
1191
  }
 
1219
  line-height: 2.5rem;
1220
  }
1221
 
 
 
 
 
1222
  .font-bold {
1223
  font-weight: 700;
1224
  }
 
1242
  text-decoration-line: underline;
1243
  }
1244
 
1245
+ .opacity-40 {
1246
+ opacity: 0.4;
1247
+ }
1248
+
1249
+ .opacity-60 {
1250
+ opacity: 0.6;
1251
+ }
1252
+
1253
+ .opacity-70 {
1254
+ opacity: 0.7;
1255
+ }
1256
+
1257
  .shadow-lg {
1258
  --tw-shadow: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
1259
  --tw-shadow-colored: 0 10px 15px -3px var(--tw-shadow-color), 0 4px 6px -4px var(--tw-shadow-color);
 
1325
  color: rgb(148 163 184 / var(--tw-text-opacity));
1326
  }
1327
 
 
 
 
 
 
 
 
 
1328
  @-webkit-keyframes pulse {
1329
  50% {
1330
  opacity: .5;
frontend/src/helper/visual.js CHANGED
@@ -1,5 +1,5 @@
1
  import '../css/dist/output.css'
2
- const emote = ['๐Ÿ‘บ','๐Ÿ’€','๐ŸŽ‰','๐Ÿ‘พ','๐Ÿค–','๐Ÿ”ฅ','๐Ÿง ','๐ŸŒฟ','๐Ÿฆพ','๐ŸฆŠ','โœจ','๐Ÿก','๐Ÿต','๐Ÿฆ„','๐Ÿ€„','๐ŸŒŸ','๐Ÿ–ฅ','๐Ÿ“Ÿ','๐Ÿ‘‹','๐Ÿงฌ','๐Ÿ“–','๐Ÿš€','๐Ÿ‘‘','๐ŸŒˆ','๐ŸŒฑ','๐ŸŒŽ']
3
 
4
  const colour_map = [
5
  'bg-gradient-to-bl from-Retro-light-blue to-Retro-light-pink',
 
1
  import '../css/dist/output.css'
2
+ const emote = ['๐Ÿ‘บ','๐ŸŽฎ', '๐Ÿ’€','โš—๏ธ', '๐ŸŽ‰','๐Ÿ‘พ','๐Ÿค–', '๐Ÿฉ','โœ๏ธ', '๐ŸŽผ', '๐Ÿ”ฅ','๐Ÿง ','๐Ÿ”’','๐ŸŒฟ','๐Ÿฆพ','๐ŸฆŠ','โœจ','๐Ÿก','๐Ÿต','๐Ÿฆ„','๐Ÿ€„','๐ŸŒŸ','๐Ÿ–ฅ','๐Ÿ“Ÿ','๐Ÿ‘‹','๐Ÿงฌ','๐Ÿ“–','๐Ÿš€','๐Ÿ‘‘','๐ŸŒˆ','๐ŸŒฑ','๐ŸŒŽ']
3
 
4
  const colour_map = [
5
  'bg-gradient-to-bl from-Retro-light-blue to-Retro-light-pink',
frontend/tailwind.config.js CHANGED
@@ -3,7 +3,7 @@ module.exports = {
3
  content: ["./src/**/*.{html,js}", "./src/*.{html,js}"],
4
  darkMode : 'class',
5
  theme: {
6
-
7
  extend: {
8
 
9
  colors : {
 
3
  content: ["./src/**/*.{html,js}", "./src/*.{html,js}"],
4
  darkMode : 'class',
5
  theme: {
6
+
7
  extend: {
8
 
9
  colors : {
makefile CHANGED
@@ -1,9 +1,9 @@
1
  up:
2
- docker-compose up -d;
3
  down:
4
- docker-compose down;
5
  restart:
6
- docker-compose down && docker-compose up -d --remove-orphans;
7
  stop_all:
8
  docker-stop $(docker ps -a -q) && docker rm $(docker ps -a -q);
9
  rm:
@@ -11,6 +11,6 @@ rm:
11
  wipe:
12
  make down && make rm
13
  build:
14
- docker-compose build
15
  environment:
16
  docker exec -it backend bash
 
1
  up:
2
+ docker compose up -d;
3
  down:
4
+ docker compose down;
5
  restart:
6
+ docker compose down && docker-compose up -d --remove-orphans;
7
  stop_all:
8
  docker-stop $(docker ps -a -q) && docker rm $(docker ps -a -q);
9
  rm:
 
11
  wipe:
12
  make down && make rm
13
  build:
14
+ docker compose build
15
  environment:
16
  docker exec -it backend bash