From 690a5dbd6e3f498c7287ed1a668c9154bb9921ed Mon Sep 17 00:00:00 2001 From: Kieran Farr Date: Sun, 2 Jun 2024 22:51:21 -0700 Subject: [PATCH] 'New Scene' default title & simplify title editing --- .../SceneEditTitle.component.jsx | 40 ++----------------- 1 file changed, 3 insertions(+), 37 deletions(-) diff --git a/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx b/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx index c97ff0027..fd5663468 100644 --- a/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx +++ b/src/editor/components/components/SceneEditTitle/SceneEditTitle.component.jsx @@ -1,10 +1,8 @@ import { useEffect, useState } from 'react'; import styles from './SceneEditTitle.module.scss'; -import { CheckMark32Icon, Cross32Icon } from '../../../icons'; import { updateSceneIdAndTitle } from '../../../api/scene'; const SceneEditTitle = ({ sceneData }) => { - const [editMode, setEditMode] = useState(false); const [title, setTitle] = useState(sceneData?.sceneTitle); const sceneId = STREET.utils.getCurrentSceneId(); @@ -27,7 +25,6 @@ const SceneEditTitle = ({ sceneData }) => { }; const saveNewTitle = async (newTitle) => { - setEditMode(false); try { await updateSceneIdAndTitle(sceneData?.sceneId, newTitle); AFRAME.scenes[0].setAttribute('metadata', 'sceneTitle', newTitle); @@ -39,46 +36,15 @@ const SceneEditTitle = ({ sceneData }) => { } }; - const handleCancelClick = () => { - if (sceneData && sceneData.sceneTitle !== undefined) { - setTitle(sceneData.sceneTitle); - } - setEditMode(false); - }; - - const handleKeyDown = (event) => { - if (event.key === 'Enter') { - saveNewTitle(); - } else if (event.key === 'Escape') { - handleCancelClick(); - } - }; return (
- {editMode ? ( -
- -
-
saveNewTitle(title)} className={styles.check}> - -
-
- -
-
-
- ) : ( + {

- {title} + {title || 'New Scene'}

- )} + }
); };