diff --git a/app/components/ButtonIconSelect.tsx b/app/components/ButtonIconSelect.tsx index 971e86c127..1c86c488d4 100644 --- a/app/components/ButtonIconSelect.tsx +++ b/app/components/ButtonIconSelect.tsx @@ -6,6 +6,7 @@ import { twMerge } from "tailwind-merge"; interface Option { value: string; icon: IconDefinition; + text?: string; } interface ButtonIconSelectProps { @@ -30,18 +31,19 @@ export function ButtonIconSelect({ return (
- {options.map(({ value, icon }) => ( + {options.map(({ value, icon, text }) => ( ))}
diff --git a/app/components/Typography.tsx b/app/components/Typography.tsx index 0bb645e383..c4bb8bac65 100644 --- a/app/components/Typography.tsx +++ b/app/components/Typography.tsx @@ -9,41 +9,54 @@ interface TypoProps { const baseTypo = "text-white"; export const H1 = ({ className, children }: TypoProps) => ( -

{children}

+

+ {children} +

); export const H2 = ({ className, children }: TypoProps) => ( -

{children}

+

+ {children} +

); export const H3 = ({ className, children }: TypoProps) => ( -

{children}

+

+ {children} +

); export const H4 = ({ className, children }: TypoProps) => ( -

{children}

+

+ {children} +

); -export const Label = ({ - className, children, ...rest +export const Label = ({ + className, + children, + ...rest }: LabelHTMLAttributes) => ( ); export const H5 = ({ className, children }: TypoProps) => ( -
{children}
+
+ {children} +
); export const H6 = ({ className, children }: TypoProps) => ( -
{children}
+
+ {children} +
); -export const Link = ({className, ...rest}:NavLinkProps)=> +export const Link = ({ className, ...rest }: NavLinkProps) => ( )} {...rest} /> +); export const P = ({ className, children }: TypoProps) => (

{children}

diff --git a/app/modules/SidePanel/SidePanel.tsx b/app/modules/SidePanel/SidePanel.tsx index fbb0f9699d..06db6d5818 100644 --- a/app/modules/SidePanel/SidePanel.tsx +++ b/app/modules/SidePanel/SidePanel.tsx @@ -1,13 +1,5 @@ -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faChevronLeft, - faChevronRight, -} from "@fortawesome/pro-solid-svg-icons"; import { dndSidePanelWidth, - lastSelectedTab, - selectedTab, - sidePanelHeight, sidePanelVisible, sidePanelWidth, } from "~/pages/PageEnigma/store"; @@ -36,26 +28,7 @@ export const SidePanel = () => { top: 68, right: 84, width: sidePanelVisible.value ? displayWidth : 0, - }} - > - + }}>
diff --git a/app/pages/PageEnigma/PageEditor.tsx b/app/pages/PageEnigma/PageEditor.tsx index e542a05a20..2f7ca00d32 100644 --- a/app/pages/PageEnigma/PageEditor.tsx +++ b/app/pages/PageEnigma/PageEditor.tsx @@ -32,7 +32,7 @@ interface Props { setPage: (page: Pages) => void; } -export const PageEditor = ({ setPage }: Props) => { +export const PageEditor = () => { useSignals(); const [appUiState] = useContext(AppUiContext); @@ -47,8 +47,8 @@ export const PageEditor = ({ setPage }: Props) => { ? dndSidePanelWidth.value : sidePanelWidth.value; const width = sidePanelVisible.value - ? pageWidth.value - dndWidth - 66 - : pageWidth.value - 66; + ? pageWidth.value - dndWidth - 84 + : pageWidth.value - 84; const height = dndTimelineHeight.value > -1 ? pageHeight.value - dndTimelineHeight.value - 68 @@ -115,7 +115,7 @@ export const PageEditor = ({ setPage }: Props) => { onClick={handleOverlayClick}>
- +
diff --git a/app/pages/PageEnigma/PageEnigmaComponent.tsx b/app/pages/PageEnigma/PageEnigmaComponent.tsx index a106f7bc20..2b7a176da7 100644 --- a/app/pages/PageEnigma/PageEnigmaComponent.tsx +++ b/app/pages/PageEnigma/PageEnigmaComponent.tsx @@ -1,16 +1,13 @@ -import { useContext, useEffect, useState } from "react"; +import { useContext, useEffect } from "react"; import { AppUiContext } from "~/contexts/AppUiContext"; import { EngineContext } from "~/contexts/EngineContext"; import { PageEditor } from "~/pages/PageEnigma/PageEditor"; -import { PageStyling } from "~/pages/PageEnigma/PageStyling"; import { useParams } from "@remix-run/react"; -import { Pages } from "~/pages/PageEnigma/constants/page"; export const PageEnigmaComponent = () => { const [, dispatchAppUiState] = useContext(AppUiContext); const editor = useContext(EngineContext); - const [page, setPage] = useState(Pages.EDIT); const params = useParams(); useEffect(() => { @@ -26,14 +23,5 @@ export const PageEnigmaComponent = () => { } }, [editor, dispatchAppUiState, params]); - return ( - <> -
- -
-
- -
- - ); + return ; }; diff --git a/app/pages/PageEnigma/PageStyling.tsx b/app/pages/PageEnigma/PageStyling.tsx deleted file mode 100644 index 136af34944..0000000000 --- a/app/pages/PageEnigma/PageStyling.tsx +++ /dev/null @@ -1,100 +0,0 @@ -import { useSignals } from "@preact/signals-react/runtime"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { - faAngleLeft, - faArrowsRotate, - faFilm, -} from "@fortawesome/pro-solid-svg-icons"; -import { Button } from "~/components"; -import { StyleSelection } from "~/pages/PageEnigma/comps/StyleSelection"; -import { TimerGrid } from "~/pages/PageEnigma/comps/Timeline/TimerGrid"; -import { Scrubber } from "~/pages/PageEnigma/comps/Timeline/Scrubber"; -import { PreviewImages } from "~/pages/PageEnigma/comps/PreviewImages"; -import { TopBar } from "~/modules/TopBar"; -import { UIEvent, useCallback, useContext } from "react"; -import { EngineContext } from "~/contexts/EngineContext"; -import { filmLength, scale, stylizeScrollX } from "~/pages/PageEnigma/store"; -import { pageWidth } from "~/store"; -import useTimelineClick from "~/pages/PageEnigma/comps/Timeline/utils/useTimelineClick"; -import { Pages } from "~/pages/PageEnigma/constants/page"; - -interface Props { - setPage: (page: Pages) => void; -} - -export const PageStyling = ({ setPage }: Props) => { - useSignals(); - const editorEngine = useContext(EngineContext); - - const generateFrame = async () => { - await editorEngine?.generateFrame(); - }; - - const generateMovie = async () => { - await editorEngine?.generateVideo(); - }; - - const switchEdit = () => { - editorEngine?.switchEdit(); - setPage(Pages.EDIT); - }; - - const onScroll = useCallback((event: UIEvent) => { - stylizeScrollX.value = event.currentTarget.scrollLeft; - }, []); - - const onTimelineClick = useTimelineClick(Pages.STYLE); - - return ( -
- -
-
- -
-
-
- -
- -
- - -
-
-
-
- -
-
-
-
- -
-
-
-
-
- ); -}; diff --git a/app/pages/PageEnigma/Queue/Queue.ts b/app/pages/PageEnigma/Queue/Queue.ts index 5b989dbdff..a5365cf026 100644 --- a/app/pages/PageEnigma/Queue/Queue.ts +++ b/app/pages/PageEnigma/Queue/Queue.ts @@ -5,18 +5,27 @@ import { QueueClip, QueueKeyframe, UpdateTime, + MediaItem, } from "~/pages/PageEnigma/models"; import { toTimelineActions } from "./toTimelineActions"; -type UnionedActionTypes = fromEngineActions | toEngineActions | toTimelineActions; -type UnionedDataTypes = QueueClip | UpdateTime | QueueKeyframe | ClipUI[] | MediaItem; +type UnionedActionTypes = + | fromEngineActions + | toEngineActions + | toTimelineActions; +type UnionedDataTypes = + | QueueClip + | UpdateTime + | QueueKeyframe + | ClipUI[] + | MediaItem + | null; export type QueueSubscribeType = { - action: UnionedActionTypes; - data: UnionedDataTypes; -} + action: UnionedActionTypes; + data: UnionedDataTypes; +}; import { ClipUI } from "../datastructures/clips/clip_ui"; -import { MediaItem } from "~/pages/PageEnigma/models"; class Queue { private _queue: Record< string, @@ -27,10 +36,7 @@ class Queue { > = {}; private _subscribers: Record< string, - (entry: { - action: UnionedActionTypes; - data: UnionedDataTypes; - }) => void + (entry: { action: UnionedActionTypes; data: UnionedDataTypes }) => void > = {}; public publish({ @@ -40,7 +46,7 @@ class Queue { }: { queueName: string; action: UnionedActionTypes; - data: UnionedDataTypes ; + data: UnionedDataTypes; }) { if (!this._queue[queueName]) { this._queue[queueName] = []; diff --git a/app/pages/PageEnigma/Queue/toEngineActions.ts b/app/pages/PageEnigma/Queue/toEngineActions.ts index 4be8244918..871c5f7cf1 100644 --- a/app/pages/PageEnigma/Queue/toEngineActions.ts +++ b/app/pages/PageEnigma/Queue/toEngineActions.ts @@ -12,11 +12,19 @@ export enum toEngineActions { // data=QueueClip DELETE_KEYFRAME = "delete_keyframe", // data=QueueKeyframe + ENTER_EDIT_STATE = "enter_edit", + // data=null + ENTER_PREVIEW_STATE = "enter_preview", + // data=null + GENERATE_VIDEO = "generate_video", + // data=null MUTE = "mute", // data={version, type, group, object_uuid} if lipsync // data={version, type, group} if global_audio PLAY_CLIP = "play_clip", // data=QueueClip + TOGGLE_CAMERA_STATE = "toggle_camera", + // data=null UNMUTE = "unmute", // data={version, type, group, object_uuid} if lipsync // data={version, type, group} if global_audio diff --git a/app/pages/PageEnigma/comps/Controls3D/Controls3D.tsx b/app/pages/PageEnigma/comps/Controls3D/Controls3D.tsx index a81e8be050..044c4a7993 100644 --- a/app/pages/PageEnigma/comps/Controls3D/Controls3D.tsx +++ b/app/pages/PageEnigma/comps/Controls3D/Controls3D.tsx @@ -1,20 +1,13 @@ import { - faAngleRight, faArrowsRotate, faArrowsUpDownLeftRight, faUpRightAndDownLeftFromCenter, } from "@fortawesome/pro-solid-svg-icons"; -import { Button, ButtonIconSelect } from "~/components"; +import { ButtonIconSelect } from "~/components"; import { EngineContext } from "~/contexts/EngineContext"; import { useContext } from "react"; -import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; -import { Pages } from "~/pages/PageEnigma/constants/page"; -interface Props { - setPage: (page: Pages) => void; -} - -export const Controls3D = ({ setPage }: Props) => { +export const Controls3D = () => { const editorEngine = useContext(EngineContext); const handleMoveArrows = () => { @@ -52,32 +45,21 @@ export const Controls3D = ({ setPage }: Props) => { } }; - const changeStylize = () => { - editorEngine?.switchPreview(); - setPage(Pages.STYLE); - }; - const modes = [ - { value: "move", icon: faArrowsUpDownLeftRight }, - { value: "rotate", icon: faArrowsRotate }, - { value: "scale", icon: faUpRightAndDownLeftFromCenter }, + { value: "move", icon: faArrowsUpDownLeftRight, text: "Move" }, + { value: "rotate", icon: faArrowsRotate, text: "Rotate" }, + { value: "scale", icon: faUpRightAndDownLeftFromCenter, text: "Scale" }, ]; return (
-
+
- - - -
diff --git a/app/pages/PageEnigma/comps/PreviewEngineCamera/index.tsx b/app/pages/PageEnigma/comps/PreviewEngineCamera/index.tsx index a68523d513..b5d3073829 100644 --- a/app/pages/PageEnigma/comps/PreviewEngineCamera/index.tsx +++ b/app/pages/PageEnigma/comps/PreviewEngineCamera/index.tsx @@ -1,27 +1,31 @@ -import { useContext, useEffect, useState } from "react"; -import { EngineContext } from "../../../../contexts/EngineContext"; -import { Button, Input, LoadingDotsTyping } from "~/components"; +import { useEffect, useState } from "react"; +import { Button, LoadingDotsTyping } from "~/components"; import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faCameraViewfinder } from "@fortawesome/pro-solid-svg-icons"; +import Queue from "~/pages/PageEnigma/Queue/Queue"; +import { QueueNames } from "~/pages/PageEnigma/Queue/QueueNames"; +import { toEngineActions } from "~/pages/PageEnigma/Queue/toEngineActions"; +import { editorState, EditorStates } from "~/pages/PageEnigma/store/engine"; +import { useSignals } from "@preact/signals-react/runtime"; export const PreviewEngineCamera = () => { - const editorEngine = useContext(EngineContext); - //take data from egine context - + useSignals(); const [showLoader, setShowLoader] = useState(true); - const [currentMessage, setCurrentMessage] = - useState("Enter Camera View"); + useEffect(() => { setTimeout(() => setShowLoader(false), 1000); }, []); + if (editorState.value === EditorStates.PREVIEW) { + return null; + } + const handleButtonCameraView = () => { - editorEngine?.switchCameraView(); - if (currentMessage === "Enter Camera View") { - setCurrentMessage("Exit Camera View"); - } else { - setCurrentMessage("Enter Camera View"); - } + Queue.publish({ + queueName: QueueNames.TO_ENGINE, + action: toEngineActions.TOGGLE_CAMERA_STATE, + data: null, + }); }; return ( @@ -36,9 +40,10 @@ export const PreviewEngineCamera = () => {
diff --git a/app/pages/PageEnigma/comps/SidePanelTabs/AudioTab/pageLibrary.tsx b/app/pages/PageEnigma/comps/SidePanelTabs/AudioTab/pageLibrary.tsx index 433ad1b216..d328197cb3 100644 --- a/app/pages/PageEnigma/comps/SidePanelTabs/AudioTab/pageLibrary.tsx +++ b/app/pages/PageEnigma/comps/SidePanelTabs/AudioTab/pageLibrary.tsx @@ -10,6 +10,7 @@ import { JobState } from "~/hooks/useInferenceJobManager/useInferenceJobManager" import { Button } from "~/components"; import { AudioItemElements } from "./audioItemElements"; import { AudioTabPages } from "./types"; +import { TabTitle } from "~/pages/PageEnigma/comps/SidePanelTabs/comps/TabTitle"; import { InferenceElement } from "./inferenceElement"; @@ -37,8 +38,9 @@ export const PageLibrary = ({ return ( <> -
-
+
+ +