diff --git a/custom/fitness-demo/components/Prejoin/CreatingRoom.js b/custom/fitness-demo/components/Prejoin/CreatingRoom.js deleted file mode 100644 index 29b779d..0000000 --- a/custom/fitness-demo/components/Prejoin/CreatingRoom.js +++ /dev/null @@ -1,100 +0,0 @@ -import React, { useState, useEffect } from 'react'; -import { Card, CardHeader, CardBody } from '@custom/shared/components/Card'; -import Loader from '@custom/shared/components/Loader'; -import Well from '@custom/shared/components/Well'; -import PropTypes from 'prop-types'; - -export const CreatingRoom = ({ onCreated }) => { - const [room, setRoom] = useState(); - const [fetching, setFetching] = useState(false); - const [error, setError] = useState(false); - - useEffect(() => { - if (room) return; - - async function createRoom() { - setError(false); - setFetching(true); - - console.log(`🚪 Creating new demo room...`); - - // Create a room server side (using Next JS serverless) - const res = await fetch('/api/createRoom', { - method: 'POST', - headers: { - 'Content-Type': 'application/json', - }, - }); - - const resJson = await res.json(); - - if (resJson.name) { - setFetching(false); - setRoom(resJson.name); - return; - } - - setError(resJson.error || 'An unknown error occured'); - setFetching(false); - } - - createRoom(); - }, [room]); - - useEffect(() => { - if (!room || !onCreated) return; - - console.log(`🚪 Room created: ${room}, joining now`); - - onCreated(room, true); - }, [room, onCreated]); - - return ( -
- {fetching && ( -
- Creating new demo room... -
- )} - {error && ( - - An error occured - - {error} - An error occured when trying to create a demo room. Please check - that your environmental variables are correct and try again. - - - )} - - -
- ); -}; - -CreatingRoom.propTypes = { - onCreated: PropTypes.func.isRequired, -}; - -export default CreatingRoom; diff --git a/custom/fitness-demo/components/Prejoin/Intro.js b/custom/fitness-demo/components/Prejoin/Intro.js index b19046f..f7cce1a 100644 --- a/custom/fitness-demo/components/Prejoin/Intro.js +++ b/custom/fitness-demo/components/Prejoin/Intro.js @@ -120,6 +120,7 @@ export const Intro = ({