From 4ea6942fc0f39af7dbeacd195942a0b9ca1deaa8 Mon Sep 17 00:00:00 2001 From: Josh Field Date: Thu, 27 Jun 2024 16:34:31 +1000 Subject: [PATCH] IR-2824-Reinstate-original-publish-workflow-in-studio (#10462) Co-authored-by: Aditya Mitra <55396651+aditya-mitra@users.noreply.github.com> --- .../locations/AddEditLocationModal.tsx | 11 +++++++-- .../src/components/toolbar/Toolbar2.tsx | 23 +++++++++++++++---- 2 files changed, 28 insertions(+), 6 deletions(-) diff --git a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx index 969024a3e3..83deea0895 100644 --- a/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx +++ b/packages/client-core/src/admin/components/locations/AddEditLocationModal.tsx @@ -49,7 +49,13 @@ const locationTypeOptions = [ { label: 'Showroom', value: 'showroom' } ] -export default function AddEditLocationModal({ location }: { location?: LocationType }) { +export default function AddEditLocationModal({ + location, + sceneID +}: { + location?: LocationType + sceneID?: string | null +}) { const { t } = useTranslation() const locationMutation = useMutation(locationPath) @@ -59,7 +65,8 @@ export default function AddEditLocationModal({ location }: { location?: Location const name = useHookstate(location?.name || '') const maxUsers = useHookstate(location?.maxUsersPerInstance || 20) - const scene = useHookstate(location?.sceneId || '') + + const scene = useHookstate((location ? location.sceneId : sceneID) ?? '') const videoEnabled = useHookstate(location?.locationSetting.videoEnabled || true) const audioEnabled = useHookstate(location?.locationSetting.audioEnabled || true) const screenSharingEnabled = useHookstate(location?.locationSetting.screenSharingEnabled || true) diff --git a/packages/editor/src/components/toolbar/Toolbar2.tsx b/packages/editor/src/components/toolbar/Toolbar2.tsx index a8d03d1b8e..b6c649f3e7 100644 --- a/packages/editor/src/components/toolbar/Toolbar2.tsx +++ b/packages/editor/src/components/toolbar/Toolbar2.tsx @@ -23,13 +23,16 @@ All portions of the code written by the Ethereal Engine team are Copyright © 20 Ethereal Engine. All Rights Reserved. */ +import AddEditLocationModal from '@etherealengine/client-core/src/admin/components/locations/AddEditLocationModal' import { NotificationService } from '@etherealengine/client-core/src/common/services/NotificationService' import { PopoverState } from '@etherealengine/client-core/src/common/services/PopoverState' import { RouterState } from '@etherealengine/client-core/src/common/services/RouterService' import { useProjectPermissions } from '@etherealengine/client-core/src/user/useUserProjectPermission' import { useUserHasAccessHook } from '@etherealengine/client-core/src/user/userHasAccess' +import { locationPath } from '@etherealengine/common/src/schema.type.module' import { GLTFModifiedState } from '@etherealengine/engine/src/gltf/GLTFDocumentState' import { getMutableState, getState, useHookstate, useMutableState } from '@etherealengine/hyperflux' +import { useFind } from '@etherealengine/spatial/src/common/functions/FeathersHooks' import ContextMenu from '@etherealengine/ui/src/components/editor/layout/ContextMenu' import Button from '@etherealengine/ui/src/primitives/tailwind/Button' import { t } from 'i18next' @@ -113,11 +116,13 @@ export default function Toolbar() { const anchorEvent = useHookstate>(null) const anchorPosition = useHookstate({ left: 0, top: 0 }) - const { projectName, sceneName } = useMutableState(EditorState) + const { projectName, sceneName, sceneAssetID } = useMutableState(EditorState) const hasLocationWriteScope = useUserHasAccessHook('location:write') const permission = useProjectPermissions(projectName.value!) const hasPublishAccess = hasLocationWriteScope || permission?.type === 'owner' || permission?.type === 'editor' + const locationQuery = useFind(locationPath, { query: { sceneId: sceneAssetID.value } }) + const currentLocation = locationQuery.data.length === 1 ? locationQuery.data[0] : undefined return ( <> @@ -148,9 +153,19 @@ export default function Toolbar() { / {sceneName.value} - + {sceneAssetID.value && ( + + )} }