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

Commit

Permalink
show loading when adding scene (#10345)
Browse files Browse the repository at this point in the history
  • Loading branch information
aditya-mitra authored Jun 11, 2024
1 parent 23de2af commit 5c7c3c6
Showing 1 changed file with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,12 +50,16 @@ export default function ScenesPanel() {
const contextMenuRef = useRef(null)
const isContextMenuOpen = useHookstate<AssetType['id']>('')
const scenesLoading = scenesQuery.status === 'pending'
const onCreateScene = async () => onNewScene()

const onClickScene = (scene: AssetType) => {
getMutableState(EditorState).scenePath.set(scene.assetURL)
const isCreatingScene = useHookstate(false)
const handleCreateScene = async () => {
isCreatingScene.set(true)
await onNewScene()
isCreatingScene.set(false)
}

const onClickScene = (scene: AssetType) => getMutableState(EditorState).scenePath.set(scene.assetURL)

const deleteSelectedScene = async (scene: AssetType) => {
if (scene) {
await deleteScene(scene.id)
Expand All @@ -77,11 +81,13 @@ export default function ScenesPanel() {
<div className="mb-4 w-full bg-theme-surface-main">
<Button
startIcon={<HiOutlinePlusCircle />}
endIcon={isCreatingScene.value && <LoadingView spinnerOnly className="h-4 w-4" />}
disabled={isCreatingScene.value}
variant="transparent"
rounded="none"
className="ml-auto w-32 bg-theme-highlight px-2"
className="ml-auto bg-theme-highlight px-2"
size="small"
onClick={onCreateScene}
onClick={handleCreateScene}
>
{t('editor:newScene')}
</Button>
Expand Down

0 comments on commit 5c7c3c6

Please sign in to comment.