Skip to content

Commit

Permalink
OV-347: * use of videoScripts from redux and not pass as property
Browse files Browse the repository at this point in the history
  • Loading branch information
lfelix3011 committed Sep 25, 2024
1 parent f69a23a commit ffbaa7c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,29 +18,27 @@ 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';
import { GenerateScriptScene } from '../generate-script-scene/generate-script-scene.js';
import styles from './styles.module.css';

type Properties = {
videoScripts: VideoScript[];
onClose: () => void;
};

const GenerateScriptPlaceholder: React.FC<Properties> = ({
videoScripts,
onClose,
}) => {
const GenerateScriptPlaceholder: React.FC<Properties> = ({ 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 => (
<Box mt="100px">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,10 @@ type Properties = {
};
const GenerateScriptView: React.FC<Properties> = ({ 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(
Expand Down Expand Up @@ -72,10 +71,7 @@ const GenerateScriptView: React.FC<Properties> = ({ onClose }) => {
<GenerateScriptForm
onSubmit={handleGenerateVideoScriptSubmit}
/>
<GenerateScriptPlaceholder
videoScripts={videoScripts}
onClose={onClose}
/>
<GenerateScriptPlaceholder onClose={onClose} />
</HStack>
</TabPanel>
</TabPanels>
Expand Down

0 comments on commit ffbaa7c

Please sign in to comment.