From 62b14e3168a87807bca9ab5789adc92f21e63dc2 Mon Sep 17 00:00:00 2001 From: wil Date: Wed, 3 Apr 2024 10:31:19 -0400 Subject: [PATCH 01/27] scafoldding for generalized dialogue and TTS dialogue done --- app/components/TransitionDialogue.tsx | 56 ++++++++ app/modules/ButtonDialogue/ButtonDialogue.tsx | 103 +++++--------- app/pages/PageEnigma/PageEnigmaComponent.tsx | 2 + .../ControlsTopButtons/ControlsTopButtons.tsx | 126 +----------------- .../TestFeaturesButtons.tsx | 97 ++++++++++++++ .../comps/DialogueTTS/DialogueTTS.tsx | 24 ++++ .../PageEnigma/comps/DialogueTTS/index.tsx | 0 .../reducers/appUiReducer/reducer.tsx | 18 ++- .../reducers/appUiReducer/types.tsx | 12 +- .../reducers/appUiReducer/values.tsx | 1 + 10 files changed, 244 insertions(+), 195 deletions(-) create mode 100644 app/components/TransitionDialogue.tsx create mode 100644 app/pages/PageEnigma/comps/ControlsTopButtons/TestFeaturesButtons.tsx create mode 100644 app/pages/PageEnigma/comps/DialogueTTS/DialogueTTS.tsx create mode 100644 app/pages/PageEnigma/comps/DialogueTTS/index.tsx diff --git a/app/components/TransitionDialogue.tsx b/app/components/TransitionDialogue.tsx new file mode 100644 index 0000000000..9d6be6634c --- /dev/null +++ b/app/components/TransitionDialogue.tsx @@ -0,0 +1,56 @@ +import { Dialog, Transition } from "@headlessui/react"; +import { Fragment, ReactNode } from "react"; + +export const TransitionDialogue = ({ + isOpen, title, onClose, children, +}:{ + isOpen: boolean; + title?: string; + onClose:()=>void; + children: ReactNode; + +})=>{ + return( + + + +
+ + +
+
+ + + {title && ( + + {title} + + )} + {children} + + +
+
+
+
+ ); +}; \ No newline at end of file diff --git a/app/modules/ButtonDialogue/ButtonDialogue.tsx b/app/modules/ButtonDialogue/ButtonDialogue.tsx index 2cf1ceb539..5ef713b2c2 100644 --- a/app/modules/ButtonDialogue/ButtonDialogue.tsx +++ b/app/modules/ButtonDialogue/ButtonDialogue.tsx @@ -1,6 +1,5 @@ -import { Dialog, Transition } from "@headlessui/react"; import { Fragment, useState } from "react"; - +import { TransitionDialogue } from "~/components/TransitionDialogue"; import { Button, ButtonPropsI } from "~/components/Button"; type UnionedButtonProps = { label?: string } & ButtonPropsI; @@ -36,74 +35,40 @@ export const ButtonDialogue = ({ {buttonLabel} - - - +
{children}
+ +
+ - {confirmButtonProps && ( - - )} -
- -
- - -
-
+ {closeButtonLabel} + + {confirmButtonProps && ( + + )} + + ); }; diff --git a/app/pages/PageEnigma/PageEnigmaComponent.tsx b/app/pages/PageEnigma/PageEnigmaComponent.tsx index b8416749c1..5cf6dfef33 100644 --- a/app/pages/PageEnigma/PageEnigmaComponent.tsx +++ b/app/pages/PageEnigma/PageEnigmaComponent.tsx @@ -10,6 +10,7 @@ import { Controls3D } from "./comps/Controls3D"; import { ControlsTopButtons } from "./comps/ControlsTopButtons"; import { ControlsVideo } from "./comps/ControlsVideo"; import { ControlPanelSceneObject } from "./comps/ControlPanelSceneObject"; +import { DialogueTTS } from "./comps/DialogueTTS/DialogueTTS"; import { PreviewEngineCamera } from "./comps/PreviewEngineCamera"; import { ViewSideBySide } from "./comps/ViewSideBySide"; import { SidePanelTabs } from "./comps/SidePanelTabs"; @@ -72,6 +73,7 @@ export const PageEnigmaComponent = () => { + {appUiState.viewMode === APPUI_VIEW_MODES.SIDE_BY_SIDE && ( diff --git a/app/pages/PageEnigma/comps/ControlsTopButtons/ControlsTopButtons.tsx b/app/pages/PageEnigma/comps/ControlsTopButtons/ControlsTopButtons.tsx index 7a064d7f7a..77d1148bf4 100644 --- a/app/pages/PageEnigma/comps/ControlsTopButtons/ControlsTopButtons.tsx +++ b/app/pages/PageEnigma/comps/ControlsTopButtons/ControlsTopButtons.tsx @@ -1,115 +1,24 @@ import { useContext, useState } from "react"; -import { Button, Input } from "~/components"; +import { Input } from "~/components"; import { ButtonDialogue } from "~/modules/ButtonDialogue"; -import { AppUiContext } from "../../contexts/AppUiContext"; import { EngineContext } from "../../contexts/EngineContext"; -import { APPUI_ACTION_TYPES } from "../../reducers"; -import { ClipGroup } from "~/pages/PageEnigma/models/track"; + +import { TestFeaturesButtons } from "./TestFeaturesButtons"; export const ControlsTopButtons = () => { const editorEngine = useContext(EngineContext); - const [appUiState, dispatchAppUiState] = useContext(AppUiContext); + const [sceneName, setSceneName] = useState(""); const [sceneToken, setSceneToken] = useState(""); const handleButtonSave = () => { - console.log(`SceneName is ${sceneName}`); editorEngine?.saveScene(sceneName); }; const handleButtonLoadScene = () => { - console.log(`Scene Token is ${sceneToken}`); editorEngine?.loadScene(sceneToken); }; - const handleButtonTest = () => { - editorEngine?.testStylizeRequest(); - - // if(appUiState?.showEditorLoadingBar.isShowing){ - //TO GO TO A HUNDRED AND DISAPPER - // dispatchAppUiState({ - // type: APPUI_ACTION_TYPES.UPDATE_EDITOR_LOADINGBAR, - // payload:{ - // showEditorLoadingBar: { - // progress: 100, - // } - // } - // }); - // setTimeout(() => { - // dispatchAppUiState({ - // type: APPUI_ACTION_TYPES.HIDE_EDITOR_LOADINGBAR, - // }); - // }, 1000); - //END :TO GO TO A HUNDRED AND DISAPPER - - //EAMPLE OF CHANING LOADING MESSAGE - // dispatchAppUiState({ - // type: APPUI_ACTION_TYPES.UPDATE_EDITOR_LOADINGBAR, - // payload:{ - // showEditorLoadingBar: { - // message: "new message", - // } - // } - // }); - // }else{ - // dispatchAppUiState({ - // type: APPUI_ACTION_TYPES.SHOW_EDITOR_LOADINGBAR, - // payload:{ - // showEditorLoadingBar: { - // message: 'display of LoadingBar triggered by Test Button', - // progress: 10, - // } - // } - - // }); - //} - }; - - const handleObjectPanelTest = () => { - if (appUiState?.controlPanel.isShowing) { - dispatchAppUiState({ - type: APPUI_ACTION_TYPES.HIDE_CONTROLPANELS_SCENEOBJECT, - }); - } else { - dispatchAppUiState({ - type: APPUI_ACTION_TYPES.SHOW_CONTROLPANELS_SCENEOBJECT, - payload: { - group: ClipGroup.OBJECT, - object_name: "TEST BUTTON", - object_uuid: "", - version: "1", - objectVectors: { - position: { x: 1, y: 2, z: 3 }, - rotation: { x: 4, y: 5, z: 6 }, - scale: { x: 7, y: 8, z: 9 }, - }, - }, - }); - } - }; - - const handleButtonCameraView = () => { - editorEngine?.switchCameraView(); - }; - const handleButtonPlayBack = () => { - editorEngine?.startPlayback(); - }; - const handleButtonRender = () => { - editorEngine?.generateVideo(); - }; - - const handleButtonTakeFrame = () => { - editorEngine?.take_timeline_cam_clip(); - }; - - const handleButtonLoad = () => { - console.log("LOADING"); - }; - - const handleButtonSingleFrame = () => { - editorEngine?.generateFrame(); - }; - return (
@@ -166,32 +75,7 @@ export const ControlsTopButtons = () => {

Ask Wil about React

- -
- - -
-
- - - - {/* - */} - -
+
); }; diff --git a/app/pages/PageEnigma/comps/ControlsTopButtons/TestFeaturesButtons.tsx b/app/pages/PageEnigma/comps/ControlsTopButtons/TestFeaturesButtons.tsx new file mode 100644 index 0000000000..2a5376de50 --- /dev/null +++ b/app/pages/PageEnigma/comps/ControlsTopButtons/TestFeaturesButtons.tsx @@ -0,0 +1,97 @@ +import { useContext, useState } from "react"; +import { Button, } from "~/components"; +import { ClipGroup } from "~/pages/PageEnigma/models/track"; +import { APPUI_ACTION_TYPES } from "../../reducers"; +import { AppUiContext } from "../../contexts/AppUiContext"; +import { EngineContext } from "../../contexts/EngineContext"; + +export const TestFeaturesButtons = ()=>{ + const [appUiState, dispatchAppUiState] = useContext(AppUiContext); + const editorEngine = useContext(EngineContext); + + const testObjectPanel = () => { + if (appUiState?.controlPanel.isShowing) { + dispatchAppUiState({ + type: APPUI_ACTION_TYPES.HIDE_CONTROLPANELS_SCENEOBJECT, + }); + } else { + dispatchAppUiState({ + type: APPUI_ACTION_TYPES.SHOW_CONTROLPANELS_SCENEOBJECT, + payload: { + group: ClipGroup.OBJECT, + object_name: "TEST BUTTON", + object_uuid: "", + version: "1", + objectVectors: { + position: { x: 1, y: 2, z: 3 }, + rotation: { x: 4, y: 5, z: 6 }, + scale: { x: 7, y: 8, z: 9 }, + }, + }, + }); + } + }; + + const testTTSPanel = () =>{ + dispatchAppUiState({ + type: APPUI_ACTION_TYPES.OPEN_DIALOGUE_TTS + }) + }; + + const handleButtonCameraView = () => { + editorEngine?.switchCameraView(); + }; + const testStylizeRequest = () => { + editorEngine?.testStylizeRequest(); + }; + const handleButtonRender = () => { + editorEngine?.generateVideo(); + }; + + const handleButtonTakeFrame = () => { + editorEngine?.take_timeline_cam_clip(); + }; + + const handleButtonSingleFrame = () => { + editorEngine?.generateFrame(); + }; + const handleButtonPlayBack = () => { + editorEngine?.startPlayback(); + }; + + const smallButtons = "text-xs p-2 h-6 "; + const tertiaryColor = "bg-brand-tertiary hover:bg-brand-teriary-400 focus-visible:outline-brand-tertiary "; + return( + <> +
+ + + +
+
+ + + + +
+ + ) +} \ No newline at end of file diff --git a/app/pages/PageEnigma/comps/DialogueTTS/DialogueTTS.tsx b/app/pages/PageEnigma/comps/DialogueTTS/DialogueTTS.tsx new file mode 100644 index 0000000000..4597723b7a --- /dev/null +++ b/app/pages/PageEnigma/comps/DialogueTTS/DialogueTTS.tsx @@ -0,0 +1,24 @@ +import { useContext, useState } from "react"; + +import { AppUiContext } from "../../contexts/AppUiContext"; +import { APPUI_ACTION_TYPES } from "../../reducers"; +import { TransitionDialogue } from "~/components/TransitionDialogue"; + +export const DialogueTTS = ()=>{ + const [appUiState, dispatchAppUiState] = useContext(AppUiContext); + const handleClose = ()=> { + dispatchAppUiState({ + type: APPUI_ACTION_TYPES.CLOSE_DIALOGUE_TTS + }) + }; + + return( + +

TTS PANEL BODY

+
+ ); +}; \ No newline at end of file diff --git a/app/pages/PageEnigma/comps/DialogueTTS/index.tsx b/app/pages/PageEnigma/comps/DialogueTTS/index.tsx new file mode 100644 index 0000000000..e69de29bb2 diff --git a/app/pages/PageEnigma/reducers/appUiReducer/reducer.tsx b/app/pages/PageEnigma/reducers/appUiReducer/reducer.tsx index 407450407d..74cd098279 100644 --- a/app/pages/PageEnigma/reducers/appUiReducer/reducer.tsx +++ b/app/pages/PageEnigma/reducers/appUiReducer/reducer.tsx @@ -2,8 +2,24 @@ import { State, Action, ACTION_TYPES } from "./types"; export function reducer(state: State, action: Action): State { switch (action.type) { + case ACTION_TYPES.OPEN_DIALOGUE_TTS:{ + return{ + ...state, + diagloueTts:{ + isOpen: true, + } + } + } + case ACTION_TYPES.CLOSE_DIALOGUE_TTS:{ + return{ + ...state, + diagloueTts:{ + isOpen: false, + } + } + } case ACTION_TYPES.SHOW_CONTROLPANELS_SCENEOBJECT: { - console.log("pay", action.payload); + // console.log("pay", action.payload); return { ...state, controlPanel: { diff --git a/app/pages/PageEnigma/reducers/appUiReducer/types.tsx b/app/pages/PageEnigma/reducers/appUiReducer/types.tsx index ccbc7fd068..36d3e5c549 100644 --- a/app/pages/PageEnigma/reducers/appUiReducer/types.tsx +++ b/app/pages/PageEnigma/reducers/appUiReducer/types.tsx @@ -34,6 +34,9 @@ export type State = { useFakeTimer?: number; }; controlPanel: ControlPanel; + diagloueTts: { + isOpen: boolean; + } }; export enum ACTION_TYPES { @@ -47,13 +50,14 @@ export enum ACTION_TYPES { SHOW_CONTROLPANELS_SCENEOBJECT = "show_controlpanels_sceneobject", UPDATE_CONTROLPANELS_SCENEOBJECT = "update_controlpanels_sceneobject", HIDE_CONTROLPANELS_SCENEOBJECT = "hide_controlpanels_sceneobject", + OPEN_DIALOGUE_TTS = "open_dialogue_tts", + CLOSE_DIALOGUE_TTS = "close_dialogue_tts", } export type Action = - | { - // Not sure why we need this but type script won't stop complaning fix wil. - type: ACTION_TYPES.HIDE_CONTROLPANELS_SCENEOBJECT; - } + | { type: ACTION_TYPES.OPEN_DIALOGUE_TTS } + | { type: ACTION_TYPES.CLOSE_DIALOGUE_TTS } + | { type: ACTION_TYPES.HIDE_CONTROLPANELS_SCENEOBJECT } | { type: ACTION_TYPES.UPDATE_CONTROLPANELS_SCENEOBJECT; payload: SceneObject; diff --git a/app/pages/PageEnigma/reducers/appUiReducer/values.tsx b/app/pages/PageEnigma/reducers/appUiReducer/values.tsx index 51f8a64f01..8aeedf70ae 100644 --- a/app/pages/PageEnigma/reducers/appUiReducer/values.tsx +++ b/app/pages/PageEnigma/reducers/appUiReducer/values.tsx @@ -27,4 +27,5 @@ export const initialStateValues: State = { }, }, }, + diagloueTts:{isOpen:false} }; From 98a9736198714fa30072a08a7174a0c6596b69a0 Mon Sep 17 00:00:00 2001 From: wil Date: Wed, 3 Apr 2024 11:01:28 -0400 Subject: [PATCH 02/27] dialogue ui --- app/components/TransitionDialogue.tsx | 9 ++-- app/components/index.tsx | 2 + .../comps/DialogueTTS/DialogueTTS.tsx | 51 +++++++++++++++++-- 3 files changed, 54 insertions(+), 8 deletions(-) diff --git a/app/components/TransitionDialogue.tsx b/app/components/TransitionDialogue.tsx index 9d6be6634c..6e2d87b4c6 100644 --- a/app/components/TransitionDialogue.tsx +++ b/app/components/TransitionDialogue.tsx @@ -1,12 +1,13 @@ import { Dialog, Transition } from "@headlessui/react"; import { Fragment, ReactNode } from "react"; - +import { twMerge } from "tailwind-merge"; export const TransitionDialogue = ({ - isOpen, title, onClose, children, + isOpen, title, onClose, className, children, }:{ isOpen: boolean; - title?: string; + title?: ReactNode; onClose:()=>void; + className: string; children: ReactNode; })=>{ @@ -36,7 +37,7 @@ export const TransitionDialogue = ({ leaveFrom="opacity-100 scale-100" leaveTo="opacity-0 scale-95" > - + {title && ( { const [appUiState, dispatchAppUiState] = useContext(AppUiContext); @@ -14,11 +21,47 @@ export const DialogueTTS = ()=>{ return( + + Generate TTS + + } + className="max-w-xl" isOpen={appUiState.diagloueTts.isOpen} onClose={handleClose} > -

TTS PANEL BODY

+ <> + +
+ +
+ +
Randomized Text
+
+
+