Skip to content

Commit

Permalink
Use backgroundElementId
Browse files Browse the repository at this point in the history
  • Loading branch information
merapi committed Jul 18, 2022
1 parent 66c6c0e commit 5beefd2
Showing 1 changed file with 18 additions and 15 deletions.
33 changes: 18 additions & 15 deletions packages/story-editor/src/components/mediaRecording/footer.js
Original file line number Diff line number Diff line change
Expand Up @@ -293,17 +293,23 @@ function Footer({ captureImage, videoRef }) {
actions: { uploadFile },
} = useUploader();

const { updateCurrentPageProperties, currentPage, setSelectedElementsById } =
useStory(
({
state: { currentPage },
actions: { updateCurrentPageProperties, setSelectedElementsById },
}) => ({
updateCurrentPageProperties,
setSelectedElementsById,
currentPage,
})
);
const {
updateCurrentPageProperties,
backgroundElementId,
setSelectedElementsById,
} = useStory(
({
state: { currentPage },
actions: { updateCurrentPageProperties, setSelectedElementsById },
}) => ({
backgroundElementId: currentPage?.elements.find(
({ isBackground }) => isBackground
)?.id,
updateCurrentPageProperties,
setSelectedElementsById,
currentPage,
})
);
const { setHighlights } = useHighlights(({ setHighlights }) => ({
setHighlights,
}));
Expand All @@ -326,10 +332,7 @@ function Footer({ captureImage, videoRef }) {
resource: objectPick(resource, Object.keys(BackgroundAudioPropTypeShape)),
};

const backgroundElement = currentPage?.elements.find(
({ isBackground }) => isBackground
);
setSelectedElementsById({ elementIds: [backgroundElement.id] });
setSelectedElementsById({ elementIds: [backgroundElementId] });
setHighlights({
highlight: states.PAGE_BACKGROUND_AUDIO,
});
Expand Down

0 comments on commit 5beefd2

Please sign in to comment.