From 62421461a457b58ca90eff4dfc127d5e3bcaa87e Mon Sep 17 00:00:00 2001 From: Takahiro Date: Thu, 26 Oct 2023 12:25:36 -0700 Subject: [PATCH] Rename New Loader This commit renames "New Loader" to "bitECS based Client" Background: The name "New Loader" may not really make sense to users because the new code is not only related to loading stuffs but it affects the Hubs Client core design and implementation. It would be better to rename "New Loader" where users can see the name, although we may keep internally using "New Loader" as a project name. Changes: * Rename "New Loader" to "bitECS based Client" where it's exposed to users * Add description for the toggle UI * Remove outdated comments --- src/assets/stylesheets/ui-root.scss | 2 +- src/hub.js | 12 ++++++------ src/react-components/room/RoomSettingsSidebar.js | 16 ++++++++++++---- src/react-components/ui-root.js | 10 +++++----- src/utils/bit-utils.ts | 2 +- 5 files changed, 25 insertions(+), 17 deletions(-) diff --git a/src/assets/stylesheets/ui-root.scss b/src/assets/stylesheets/ui-root.scss index 057815ceb7..d39325dac0 100644 --- a/src/assets/stylesheets/ui-root.scss +++ b/src/assets/stylesheets/ui-root.scss @@ -52,7 +52,7 @@ body.vr-mode { pointer-events: auto; } -:local(.new-loader-refresh-prompt) { +:local(.bitecs-based-client-refresh-prompt) { @extend %default-font; background: theme.$background1-color; border: 3px solid theme.$border1-color; diff --git a/src/hub.js b/src/hub.js index 3f1f21a415..6c9419b3fb 100644 --- a/src/hub.js +++ b/src/hub.js @@ -531,8 +531,8 @@ export async function updateEnvironmentForHub(hub, entryManager) { } } -export async function updateUIForHub(hub, hubChannel, showNewLoaderRefreshPrompt = false) { - remountUI({ hub, entryDisallowed: !hubChannel.canEnterRoom(hub), showNewLoaderRefreshPrompt }); +export async function updateUIForHub(hub, hubChannel, showBitECSBasedClientRefreshPrompt = false) { + remountUI({ hub, entryDisallowed: !hubChannel.canEnterRoom(hub), showBitECSBasedClientRefreshPrompt }); } function onConnectionError(entryManager, connectError) { @@ -1375,17 +1375,17 @@ document.addEventListener("DOMContentLoaded", async () => { const userInfo = hubChannel.presence.state[session_id]; const displayName = (userInfo && userInfo.metas[0].profile.displayName) || "API"; - let showNewLoaderRefreshPrompt = false; + let showBitECSBasedClientRefreshPrompt = false; - if (!!hub.user_data?.hubs_use_new_loader !== !!window.APP.hub.user_data?.hubs_use_new_loader) { - showNewLoaderRefreshPrompt = true; + if (!!hub.user_data?.hubs_use_bitecs_based_client !== !!window.APP.hub.user_data?.hubs_use_bitecs_based_client) { + showBitECSBasedClientRefreshPrompt = true; setTimeout(() => { document.location.reload(); }, 5000); } window.APP.hub = hub; - updateUIForHub(hub, hubChannel, showNewLoaderRefreshPrompt); + updateUIForHub(hub, hubChannel, showBitECSBasedClientRefreshPrompt); if ( stale_fields.includes("scene") || diff --git a/src/react-components/room/RoomSettingsSidebar.js b/src/react-components/room/RoomSettingsSidebar.js index 7ac2124503..fff9f2918e 100644 --- a/src/react-components/room/RoomSettingsSidebar.js +++ b/src/react-components/room/RoomSettingsSidebar.js @@ -197,15 +197,23 @@ export function RoomSettingsSidebar({ } + label={} fullWidth > - {/* TODO: Refresh the page in all the clients in the room when toggled */} + + } + description={ + } - {...register("user_data.hubs_use_new_loader")} + {...register("user_data.hubs_use_bitecs_based_client")} /> diff --git a/src/react-components/ui-root.js b/src/react-components/ui-root.js index a094960fb7..5a2a05ecd5 100644 --- a/src/react-components/ui-root.js +++ b/src/react-components/ui-root.js @@ -152,7 +152,7 @@ class UIRoot extends Component { subscriptions: PropTypes.object, initialIsFavorited: PropTypes.bool, showSignInDialog: PropTypes.bool, - showNewLoaderRefreshPrompt: PropTypes.bool, + showBitECSBasedClientRefreshPrompt: PropTypes.bool, signInMessage: PropTypes.object, onContinueAfterSignIn: PropTypes.func, showSafariMicDialog: PropTypes.bool, @@ -1697,11 +1697,11 @@ class UIRoot extends Component { /> )} - {this.props.showNewLoaderRefreshPrompt && ( -
+ {this.props.showBitECSBasedClientRefreshPrompt && ( +
)} diff --git a/src/utils/bit-utils.ts b/src/utils/bit-utils.ts index 97a85c6678..543200c303 100644 --- a/src/utils/bit-utils.ts +++ b/src/utils/bit-utils.ts @@ -62,5 +62,5 @@ export function findChildWithComponent(world: HubsWorld, component: Component, e const forceNewLoader = qsTruthy("newLoader"); export function shouldUseNewLoader() { - return forceNewLoader || APP.hub?.user_data?.hubs_use_new_loader; + return forceNewLoader || APP.hub?.user_data?.hubs_use_bitecs_based_client; }