Skip to content
This repository has been archived by the owner on Aug 21, 2024. It is now read-only.

Commit

Permalink
rename function to confirmSceneSaveIfModified
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-mitra committed Aug 13, 2024
1 parent 89f22b5 commit a8ecac6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/editor/src/components/EditorContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ import { t } from 'i18next'
import { DockLayout, DockMode, LayoutData } from 'rc-dock'
import React, { useEffect, useRef } from 'react'
import { useHotkeys } from 'react-hotkeys-hook'
import Toolbar, { confirmedSaveIfModified } from '../components/toolbar/Toolbar'
import Toolbar, { confirmSceneSaveIfModified } from '../components/toolbar/Toolbar'
import { cmdOrCtrlString } from '../functions/utils'
import { EditorErrorState } from '../services/EditorErrorServices'
import { EditorState } from '../services/EditorServices'
Expand Down Expand Up @@ -202,7 +202,7 @@ const EditorContainer = () => {

useEffect(() => {
const handleBeforeUnload = async (event: BeforeUnloadEvent) => {
if (!(await confirmedSaveIfModified())) {
if (!(await confirmSceneSaveIfModified())) {
event.preventDefault()
event.returnValue = ''
}
Expand Down
6 changes: 3 additions & 3 deletions packages/editor/src/components/toolbar/Toolbar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ const onImportAsset = async () => {
}
}

export const confirmedSaveIfModified = async () => {
export const confirmSceneSaveIfModified = async () => {
const isModified = EditorState.isModified()

if (isModified) {
Expand All @@ -74,7 +74,7 @@ export const confirmedSaveIfModified = async () => {
}

const onClickNewScene = async () => {
if (!(await confirmedSaveIfModified())) return
if (!(await confirmSceneSaveIfModified())) return

const newSceneUIAddons = getState(EditorState).uiAddons.newScene
if (Object.keys(newSceneUIAddons).length > 0) {
Expand All @@ -85,7 +85,7 @@ const onClickNewScene = async () => {
}

const onCloseProject = async () => {
if (!(await confirmedSaveIfModified())) return
if (!(await confirmSceneSaveIfModified())) return

const editorState = getMutableState(EditorState)
getMutableState(GLTFModifiedState).set({})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import { SceneItem } from '@etherealengine/client-core/src/admin/components/scen
import { PopoverState } from '@etherealengine/client-core/src/common/services/PopoverState'
import { StaticResourceType, fileBrowserPath, staticResourcePath } from '@etherealengine/common/src/schema.type.module'
import CreateSceneDialog from '@etherealengine/editor/src/components/dialogs/CreateScenePanelDialog'
import { confirmedSaveIfModified } from '@etherealengine/editor/src/components/toolbar/Toolbar'
import { confirmSceneSaveIfModified } from '@etherealengine/editor/src/components/toolbar/Toolbar'
import { onNewScene } from '@etherealengine/editor/src/functions/sceneFunctions'
import { EditorState } from '@etherealengine/editor/src/services/EditorServices'
import { getMutableState, useHookstate, useMutableState } from '@etherealengine/hyperflux'
Expand All @@ -49,7 +49,7 @@ export default function ScenesPanel() {
const scenesLoading = scenesQuery.status === 'pending'

const onClickScene = async (scene: StaticResourceType) => {
if (!(await confirmedSaveIfModified())) return
if (!(await confirmSceneSaveIfModified())) return

getMutableState(EditorState).merge({
scenePath: scene.key
Expand Down

0 comments on commit a8ecac6

Please sign in to comment.