fixed engine compositor not enqueueing from call to action input

This commit is contained in:
Victor committed 2024-02-19 21:54:18 -08:00
1 parent 336996e62e
commit bb5b3b4079
3 files changed
+19 -5

No files matched your search

@@ -1,4 +1,4 @@
import React, { useState } from "react";
import React, { useEffect, useState } from "react";
import { useLocation } from "react-router-dom";
import { a, useTransition } from "@react-spring/web";
import { MediaFile } from "@storyteller/components/src/api/media_files/GetMedia";
@@ -15,9 +15,11 @@ import "./EntityInput.scss";
interface Props {
accept?: AcceptTypes | AcceptTypes[],
aspectRatio?: "square" | "landscape" | "portrait",
label?: string,
label?: string,
name?: string,
onChange?: any,
type: EntityModeProp,
value?: string
}
export interface SlideProps {
@@ -60,19 +62,19 @@ const AniMod = ({ animating, className, isLeaving, render: Render, style, ...res
<Render {...{ ...rest, animating }} />
</a.div>;
export default function EntityInput({ accept: inAccept, aspectRatio = "square", label, onChange, type, ...rest }: Props) {
export default function EntityInput({ accept: inAccept, aspectRatio = "square", label, name = "", onChange, type, value, ...rest }: Props) {
const accept = Array.isArray(inAccept) ? inAccept : [inAccept];
const inputMode = EntityInputMode[type];
const { search } = useLocation();
const presetToken = search ? new URLSearchParams(search).get("preset_token") : "";
const [mediaToken,mediaTokenSet] = useState(presetToken || "");
const [mediaToken,mediaTokenSet] = useState(presetToken || value || "");
const { media, mediaSet } = useMedia({ mediaToken });
const { user } = useSession();
const { open } = useModal();
const selectToken = (token: string) => {
mediaTokenSet(token);
onChange({ target: { name: "temp", value: token } });
onChange({ target: { name, value: token } });
};
const { clear, inputProps } = useFile({
@@ -109,6 +111,10 @@ export default function EntityInput({ accept: inAccept, aspectRatio = "square",
onStart: () => animatingSet(true)
});
useEffect(() => {
if (presetToken && value !== presetToken) onChange({ target: { name, value: presetToken } });
},[presetToken, name, onChange, value]);
return <>
<Label {...{ label }}/>
<div {...{ className: `fy-entity-input panel-inner${ aspectRatio ? " fy-entity-input-" + aspectRatio : "" }`, }}>
@@ -52,6 +52,13 @@
white-space: nowrap;
}
.job-info {
line-height: .75rem;
font-size: .75rem;
white-space: nowrap;
opacity: .6;
}
span {
font-weight: lighter;
line-height: 1rem;
@@ -65,6 +65,7 @@ export default function EngineCompositor({ value, sessionWrapper }: Props) {
label: "Choose 3D data",
onChange,
type: "media",
value: mediaToken
}}
/>
</div>