From ffbaa7c4dfd1b375d02cebbd9926fffa7bd534ae Mon Sep 17 00:00:00 2001 From: Luis Felix Date: Wed, 25 Sep 2024 14:36:56 -0400 Subject: [PATCH] OV-347: * use of videoScripts from redux and not pass as property --- .../generate-script-placeholder.tsx | 18 ++++++++---------- .../generate-script-view.tsx | 8 ++------ 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-placeholder/generate-script-placeholder.tsx b/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-placeholder/generate-script-placeholder.tsx index 50a7685ec..1de0ff466 100644 --- a/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-placeholder/generate-script-placeholder.tsx +++ b/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-placeholder/generate-script-placeholder.tsx @@ -18,7 +18,6 @@ import { useState, } from '~/bundles/common/hooks/hooks.js'; import { IconName } from '~/bundles/common/icons/icons.js'; -import { type VideoScript } from '~/bundles/common/types/types.js'; import { actions as studioActions } from '~/bundles/studio/store/studio.js'; import { GenerateScriptPlaceholderContent } from '../generate-script-placeholder-content/generate-script-placeholder-content.js'; @@ -26,21 +25,20 @@ import { GenerateScriptScene } from '../generate-script-scene/generate-script-sc import styles from './styles.module.css'; type Properties = { - videoScripts: VideoScript[]; onClose: () => void; }; -const GenerateScriptPlaceholder: React.FC = ({ - videoScripts, - onClose, -}) => { +const GenerateScriptPlaceholder: React.FC = ({ onClose }) => { const dispatch = useAppDispatch(); const [shouldRedirect, setShouldRedirect] = useState(false); const [isScriptAdded, setIsScriptAdded] = useState(false); - const { dataStatus, avatars } = useAppSelector(({ chat, studio }) => ({ - dataStatus: chat.dataStatus, - avatars: studio.avatars, - })); + const { dataStatus, avatars, videoScripts } = useAppSelector( + ({ chat, studio }) => ({ + dataStatus: chat.dataStatus, + videoScripts: chat.videoScripts, + avatars: studio.avatars, + }), + ); const renderLoadingState = (): React.ReactNode => ( diff --git a/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-view/generate-script-view.tsx b/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-view/generate-script-view.tsx index aab9ae351..750519bef 100644 --- a/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-view/generate-script-view.tsx +++ b/frontend/src/bundles/common/components/video-modal/components/video-modal-content/components/generate-script-view/generate-script-view.tsx @@ -27,11 +27,10 @@ type Properties = { }; const GenerateScriptView: React.FC = ({ onClose }) => { const dispatch = useAppDispatch(); - const { messages, videoScripts } = useAppSelector(({ chat }) => ({ + const { messages } = useAppSelector(({ chat }) => ({ messages: chat.messages.filter( (message) => message.sender === MessageSender.AI, ), - videoScripts: chat.videoScripts, })); const handleGenerateVideoScriptSubmit = useCallback( @@ -72,10 +71,7 @@ const GenerateScriptView: React.FC = ({ onClose }) => { - +