From a80ff96508a5776c8838078f5e04b1d1d4e0cffa Mon Sep 17 00:00:00 2001 From: Greg Fodor <gfodor@gmail.com> Date: Wed, 28 Mar 2018 15:35:35 -0700 Subject: [PATCH] Feedback from PR --- src/hub.js | 15 ++++----------- src/react-components/home-root.js | 16 +++++++--------- src/react-components/hub-create-panel.js | 3 +-- 3 files changed, 12 insertions(+), 22 deletions(-) diff --git a/src/hub.js b/src/hub.js index 72da0f944..c81d90fb0 100644 --- a/src/hub.js +++ b/src/hub.js @@ -133,7 +133,6 @@ async function exitScene() { } function updatePlayerInfoFromStore() { - const qs = queryString.parse(location.search); const playerRig = document.querySelector("#player-rig"); playerRig.setAttribute("player-info", { displayName: store.state.profile.display_name, @@ -144,7 +143,6 @@ function updatePlayerInfoFromStore() { async function enterScene(mediaStream, enterInVR, janusRoomId) { const scene = document.querySelector("a-scene"); const playerRig = document.querySelector("#player-rig"); - const qs = queryString.parse(location.search); document.querySelector("a-scene canvas").classList.remove("blurred"); registerNetworkSchemas(); @@ -155,9 +153,7 @@ async function enterScene(mediaStream, enterInVR, janusRoomId) { AFRAME.registerInputActions(inGameActions, "default"); - document.querySelector("#player-camera").setAttribute("look-controls", "pointerLockEnabled: true;"); - - const qs = queryString.parse(location.search); + document.querySelector("#player-camera").setAttribute("look-controls"); scene.setAttribute("networked-scene", { adapter: "janus", @@ -228,7 +224,6 @@ async function enterScene(mediaStream, enterInVR, janusRoomId) { function onConnect() {} function mountUI(scene) { - const qs = queryString.parse(location.search); const disableAutoExitOnConcurrentLoad = qs.allow_multi === "true"; let forcedVREntryType = null; @@ -285,11 +280,9 @@ const onReady = async () => { const res = await fetch(`/api/v1/hubs/${hubId}`); const data = await res.json(); const hub = data.hubs[0]; - const defaultSpaceChannel = hub.channels.find(c => - c.attributes.find(a => a.length === 1 && a[0] === "default-space") - ); - const gltfBundleUrl = defaultSpaceChannel.assets.find(a => a.asset_type === "gltf_bundle").src; - uiRoot.setState({ janusRoomId: defaultSpaceChannel.janus_room_id }); + const defaultSpaceTopic = hub.topics[0]; + const gltfBundleUrl = defaultSpaceTopic.assets.find(a => a.asset_type === "gltf_bundle").src; + uiRoot.setState({ janusRoomId: defaultSpaceTopic.janus_room_id }); initialEnvironmentEl.setAttribute("gltf-bundle", `src: ${gltfBundleUrl}`); }; diff --git a/src/react-components/home-root.js b/src/react-components/home-root.js index 80d540f2e..89b9b8188 100644 --- a/src/react-components/home-root.js +++ b/src/react-components/home-root.js @@ -36,15 +36,13 @@ class HomeRoot extends Component { loadEnvironments = () => { const environments = []; - const environmentLoads = ENVIRONMENT_URLS.map( - src => - new Promise(async resolve => { - const res = await fetch(src); - const data = await res.json(); - data.bundle_url = src; - environments.push(data); - resolve(); - }) + const environmentLoads = ENVIRONMENT_URLS.map(src => + (async () => { + const res = await fetch(src); + const data = await res.json(); + data.bundle_url = src; + environments.push(data); + })() ); Promise.all(environmentLoads).then(() => this.setState({ environments })); diff --git a/src/react-components/hub-create-panel.js b/src/react-components/hub-create-panel.js index 196428572..55146dcce 100644 --- a/src/react-components/hub-create-panel.js +++ b/src/react-components/hub-create-panel.js @@ -1,7 +1,6 @@ import React, { Component } from "react"; import PropTypes from "prop-types"; import { injectIntl, FormattedMessage } from "react-intl"; -import { SCHEMA } from "../storage/store"; import { generateHubName } from "../utils/name-generation"; class HubCreatePanel extends Component { @@ -15,7 +14,7 @@ class HubCreatePanel extends Component { environmentBundleUrl: "" }; - componentDidMount() { + constructor() { this.setState({ environmentBundleUrl: this.props.environments[0].bundle_url }); } -- GitLab