Working Jitsi ID lookup 🥳
This commit is contained in:
46
src/App.css
46
src/App.css
@ -1,38 +1,30 @@
|
||||
body {
|
||||
background: transparent url(./img/bg.jpg) no-repeat;
|
||||
}
|
||||
|
||||
.App {
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
.App-logo {
|
||||
height: 40vmin;
|
||||
pointer-events: none;
|
||||
}
|
||||
|
||||
@media (prefers-reduced-motion: no-preference) {
|
||||
.App-logo {
|
||||
animation: App-logo-spin infinite 20s linear;
|
||||
}
|
||||
}
|
||||
|
||||
.App-header {
|
||||
background-color: #282c34;
|
||||
min-height: 100vh;
|
||||
height: 100vh;
|
||||
width: 100%;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: calc(10px + 2vmin);
|
||||
color: white;
|
||||
}
|
||||
|
||||
.App-link {
|
||||
color: #61dafb;
|
||||
.App .Main {
|
||||
height: 60vh;
|
||||
width: 40%;
|
||||
background: #fff;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
@keyframes App-logo-spin {
|
||||
from {
|
||||
transform: rotate(0deg);
|
||||
}
|
||||
to {
|
||||
transform: rotate(360deg);
|
||||
}
|
||||
.App .Main form {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
115
src/App.js
115
src/App.js
@ -1,25 +1,102 @@
|
||||
import logo from './logo.svg';
|
||||
import React from 'react';
|
||||
|
||||
import {
|
||||
Heading, IconButton, StarIcon, Pane, TextInput, Text
|
||||
} from 'evergreen-ui'
|
||||
|
||||
import './App.css';
|
||||
|
||||
function App() {
|
||||
return (
|
||||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
const API_URL = 'https://api.jitsi.net/conferenceMapper';
|
||||
|
||||
class Form extends React.Component {
|
||||
constructor() {
|
||||
super();
|
||||
this.state = {};
|
||||
this.handleSubmit = this.handleSubmit.bind(this);
|
||||
}
|
||||
|
||||
handleSubmit(event) {
|
||||
event.preventDefault();
|
||||
if (!event.target.checkValidity()) {
|
||||
this.setState({
|
||||
invalid: true,
|
||||
displayErrors: true,
|
||||
});
|
||||
return;
|
||||
}
|
||||
|
||||
const form = event.target;
|
||||
const form_data = new FormData(form);
|
||||
fetch(`${API_URL}?conference=${form_data.get('meeting-name')}@conference.meet.jit.si`, {
|
||||
method: 'GET',
|
||||
})
|
||||
.then(res => res.json())
|
||||
.then((data) => {
|
||||
this.setState({
|
||||
invalid: false,
|
||||
displayErrors: false,
|
||||
name: form_data.get('meeting-name'),
|
||||
meetingid: data.id
|
||||
})
|
||||
console.log(this.state.meetingid)
|
||||
})
|
||||
.catch(console.log);
|
||||
}
|
||||
|
||||
render() {
|
||||
const { name, meetingid, invalid, displayErrors } = this.state;
|
||||
return (
|
||||
<div>
|
||||
<form
|
||||
onSubmit={this.handleSubmit}
|
||||
noValidate
|
||||
className={displayErrors ? 'displayErrors' : ''}
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
);
|
||||
<Heading size={700}>meeting name:</Heading>
|
||||
<TextInput
|
||||
height={60}
|
||||
margin={20}
|
||||
name="meeting-name"
|
||||
placeholder="YourMeetingNameHere"
|
||||
required
|
||||
/>
|
||||
<IconButton icon={StarIcon} height={60} onClick={this.onClick}/>
|
||||
</form>
|
||||
|
||||
<div className="res-block">
|
||||
{invalid && (
|
||||
<Pane><Text>Form is not valid</Text></Pane>
|
||||
)}
|
||||
{!invalid && name && (
|
||||
<div>
|
||||
<h3>Copy Pasta</h3>
|
||||
<p>Notes: https://pad.riseup.net/p/{name}</p>
|
||||
<p>Link: https://meet.jit.si/{name}</p>
|
||||
<p>PIN: {meetingid}</p>
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
class App extends React.Component {
|
||||
onClick = () => {
|
||||
console.log("Foo");
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<Pane className="App" >
|
||||
<Pane
|
||||
className="Main"
|
||||
>
|
||||
<Form />
|
||||
</Pane>
|
||||
</Pane>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
export default App;
|
||||
|
||||
BIN
src/img/bg.jpg
Normal file
BIN
src/img/bg.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 421 KiB |
Reference in New Issue
Block a user