diff --git a/src/hub.js b/src/hub.js index fc843649946ff6630563dfa1c1efd78e1d2b00d1..6d9223d330e363dc0adb5dc27241f4179d3bf83b 100644 --- a/src/hub.js +++ b/src/hub.js @@ -210,6 +210,7 @@ function mountUI(scene) { const forcedVREntryType = qs.vr_entry_type || null; const enableScreenSharing = qsTruthy("enable_screen_sharing"); const htmlPrefix = document.body.dataset.htmlPrefix || ""; + const showProfileEntry = !store.state.profile.has_saved_profile; // TODO: Refactor to avoid using return value /* eslint-disable react/no-render-return-value */ @@ -224,7 +225,8 @@ function mountUI(scene) { forcedVREntryType, enableScreenSharing, store, - htmlPrefix + htmlPrefix, + showProfileEntry }} />, document.getElementById("ui-root") diff --git a/src/react-components/profile-entry-panel.js b/src/react-components/profile-entry-panel.js index 523016e25bdf1e0f127bf5a889165b1ede806322..af1c7382f9ecb56b5a58bec0d623f9b35aa97562 100644 --- a/src/react-components/profile-entry-panel.js +++ b/src/react-components/profile-entry-panel.js @@ -30,6 +30,7 @@ class ProfileEntryPanel extends Component { e.preventDefault(); this.props.store.update({ profile: { + has_saved_profile: true, display_name: this.state.display_name, avatar_id: this.state.avatar_id } diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index 3970a2305c4439900b4936f8e465d2d0039a8de0..e4c844bbdafe095a33410601fae6bfdb0111e3fb 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -60,7 +60,8 @@ class UIRoot extends Component { enableScreenSharing: PropTypes.bool, store: PropTypes.object, scene: PropTypes.object, - htmlPrefix: PropTypes.string + htmlPrefix: PropTypes.string, + showProfileEntry: PropTypes.bool }; state = { @@ -95,6 +96,11 @@ class UIRoot extends Component { janusRoomId: null }; + constructor(props) { + super(props); + this.state.showProfileEntry = this.props.showProfileEntry; + } + componentDidMount() { this.setupTestTone(); this.props.concurrentLoadDetector.addEventListener("concurrentload", this.onConcurrentLoad); diff --git a/src/storage/store.js b/src/storage/store.js index 6f480aa76db6f14904b611cecf5b0b6b84b1f41f..b9f7366abf0aa01d0cec7836bcef541bf3fe8ee8 100644 --- a/src/storage/store.js +++ b/src/storage/store.js @@ -16,6 +16,7 @@ export const SCHEMA = { type: "object", additionalProperties: false, properties: { + has_saved_profile: { type: "boolean" }, display_name: { type: "string", pattern: "^[A-Za-z0-9-]{3,32}$" }, avatar_id: { type: "string" } } diff --git a/src/utils/identity.js b/src/utils/identity.js index def830cbc4df4d9d1a71b0c10d7b54c5a5610b4a..e4d79896c1dce8e8175fe0e6420f1c88aac2a858 100644 --- a/src/utils/identity.js +++ b/src/utils/identity.js @@ -172,6 +172,7 @@ export const avatarIds = avatars.map(av => av.id); export function generateDefaultProfile() { const name = selectRandom(names); return { + has_saved_profile: false, display_name: name.replace(/^./, name[0].toUpperCase()), avatar_id: selectRandom(avatarIds) };