From b7304a4eeaa365c5d76b5a1420696debac0ffc83 Mon Sep 17 00:00:00 2001 From: Rahul Gupta Date: Thu, 12 Sep 2024 21:21:41 -0700 Subject: [PATCH 1/6] WIP --- src/editor/components/scenegraph/Toolbar.js | 40 +++++++++++++++++++-- src/editor/lib/history.js | 4 +-- 2 files changed, 39 insertions(+), 5 deletions(-) diff --git a/src/editor/components/scenegraph/Toolbar.js b/src/editor/components/scenegraph/Toolbar.js index da6326e5..a353a10e 100644 --- a/src/editor/components/scenegraph/Toolbar.js +++ b/src/editor/components/scenegraph/Toolbar.js @@ -15,12 +15,13 @@ import { import Events from '../../lib/Events'; import { saveBlob } from '../../lib/utils'; import { Button, ProfileButton } from '../components'; -import { SavingModal } from '../modals/SavingModal'; import { uploadThumbnailImage } from '../modals/ScreenshotModal/ScreenshotModal.component.jsx'; import { sendMetric } from '../../services/ga.js'; import posthog from 'posthog-js'; import { UndoRedo } from '../components/UndoRedo'; +import debounce from 'lodash-es/debounce'; // const LOCALSTORAGE_MOCAP_UI = "aframeinspectormocapuienabled"; +import styles from '../modals/SavingModal/SavingModal.module.scss'; function filterHelpers(scene, visible) { scene.traverse((o) => { @@ -73,6 +74,13 @@ export default class Toolbar extends Component { componentDidMount() { document.addEventListener('click', this.handleClickOutsideSave); this.checkSignInStatus(); + Events.on('historychanged', (cmd) => { + if (cmd) { + console.log('historychanged', cmd); + // Debounce the cloudSaveHandler call + this.debouncedCloudSaveHandler({ doSaveAs: false }); + } + }); } componentDidUpdate(prevProps) { @@ -285,6 +293,8 @@ export default class Toolbar extends Component { } }; + debouncedCloudSaveHandler = debounce(this.cloudSaveHandler, 1000); + handleRemixClick = () => { posthog.capture('remix_scene_clicked'); if (!this.props.currentUser) { @@ -398,9 +408,33 @@ export default class Toolbar extends Component { leadingIcon={} onClick={this.toggleSaveActionState.bind(this)} > -
Save
+ {this.state.isSavingScene ? ( +
+ + + + + + + + + + +
+ ) : ( +
Save
+ )} - {this.state.isSavingScene && } {this.state.isSaveActionActive && (
{this.state.isSaveActionActive && (