bugfixes: darkmode and not saving file/text
This commit is contained in:
parent
74b8cbb224
commit
0dc8ca8682
6 changed files with 18 additions and 4 deletions
|
|
@ -24,6 +24,7 @@ import { nodeNames, nodeIcons } from "../../../../utils";
|
||||||
import React from "react";
|
import React from "react";
|
||||||
import { nodeColors } from "../../../../utils";
|
import { nodeColors } from "../../../../utils";
|
||||||
import ShadTooltip from "../../../../components/ShadTooltipComponent";
|
import ShadTooltip from "../../../../components/ShadTooltipComponent";
|
||||||
|
import { PopUpContext } from "../../../../contexts/popUpContext";
|
||||||
|
|
||||||
export default function ParameterComponent({
|
export default function ParameterComponent({
|
||||||
left,
|
left,
|
||||||
|
|
@ -40,6 +41,7 @@ export default function ParameterComponent({
|
||||||
const refHtml = useRef(null);
|
const refHtml = useRef(null);
|
||||||
const updateNodeInternals = useUpdateNodeInternals();
|
const updateNodeInternals = useUpdateNodeInternals();
|
||||||
const [position, setPosition] = useState(0);
|
const [position, setPosition] = useState(0);
|
||||||
|
const { closePopUp } = useContext(PopUpContext);
|
||||||
|
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
if (ref.current && ref.current.offsetTop && ref.current.clientHeight) {
|
if (ref.current && ref.current.offsetTop && ref.current.clientHeight) {
|
||||||
|
|
@ -56,6 +58,8 @@ export default function ParameterComponent({
|
||||||
data.node.template[name]?.value ?? false
|
data.node.template[name]?.value ?? false
|
||||||
);
|
);
|
||||||
|
|
||||||
|
useEffect(() => {}, [closePopUp, data.node.template]);
|
||||||
|
|
||||||
const { reactFlowInstance } = useContext(typesContext);
|
const { reactFlowInstance } = useContext(typesContext);
|
||||||
let disabled =
|
let disabled =
|
||||||
reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false;
|
reactFlowInstance?.getEdges().some((e) => e.targetHandle === id) ?? false;
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,7 @@ export default function GenericNode({
|
||||||
const showError = useRef(true);
|
const showError = useRef(true);
|
||||||
const { types, deleteNode } = useContext(typesContext);
|
const { types, deleteNode } = useContext(typesContext);
|
||||||
const { openPopUp } = useContext(PopUpContext);
|
const { openPopUp } = useContext(PopUpContext);
|
||||||
|
const { closePopUp } = useContext(PopUpContext);
|
||||||
|
|
||||||
const Icon = nodeIcons[data.type] || nodeIcons[types[data.type]];
|
const Icon = nodeIcons[data.type] || nodeIcons[types[data.type]];
|
||||||
const [validationStatus, setValidationStatus] = useState(null);
|
const [validationStatus, setValidationStatus] = useState(null);
|
||||||
|
|
@ -59,6 +60,8 @@ export default function GenericNode({
|
||||||
}
|
}
|
||||||
}, [save]);
|
}, [save]);
|
||||||
|
|
||||||
|
useEffect(() => {}, [closePopUp]);
|
||||||
|
|
||||||
const validateNode = useCallback(
|
const validateNode = useCallback(
|
||||||
debounce(async () => {
|
debounce(async () => {
|
||||||
try {
|
try {
|
||||||
|
|
|
||||||
|
|
@ -37,6 +37,10 @@ export default function InputFileComponent({
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {
|
||||||
|
setMyValue(value);
|
||||||
|
}, [value]);
|
||||||
|
|
||||||
const handleButtonClick = () => {
|
const handleButtonClick = () => {
|
||||||
const input = document.createElement("input");
|
const input = document.createElement("input");
|
||||||
input.type = "file";
|
input.type = "file";
|
||||||
|
|
@ -73,7 +77,7 @@ export default function InputFileComponent({
|
||||||
onClick={handleButtonClick}
|
onClick={handleButtonClick}
|
||||||
className={
|
className={
|
||||||
editNode
|
editNode
|
||||||
? "placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200"
|
? "truncate placeholder:text-center text-gray-500 border-0 block w-full pt-0.5 pb-0.5 form-input dark:bg-gray-900 dark:text-gray-300 dark:border-gray-600 rounded-md border-gray-300 shadow-sm sm:text-sm focus:outline-none focus:ring-1 focus:ring-inset focus:ring-gray-200"
|
||||||
: "truncate block w-full text-gray-500 dark:text-gray-300 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" +
|
: "truncate block w-full text-gray-500 dark:text-gray-300 px-3 py-2 rounded-md border border-gray-300 dark:border-gray-700 shadow-sm focus:border-indigo-500 focus:ring-indigo-500 sm:text-sm" +
|
||||||
(disabled ? " bg-gray-200" : "")
|
(disabled ? " bg-gray-200" : "")
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -19,6 +19,7 @@ export default function ToggleShadComponent({
|
||||||
style={{
|
style={{
|
||||||
transform: "scaleX(0.6) scaleY(0.6)",
|
transform: "scaleX(0.6) scaleY(0.6)",
|
||||||
}}
|
}}
|
||||||
|
className="data-[state=unchecked]:bg-slate-500"
|
||||||
checked={enabled}
|
checked={enabled}
|
||||||
onCheckedChange={(x: boolean) => {
|
onCheckedChange={(x: boolean) => {
|
||||||
setEnabled(x);
|
setEnabled(x);
|
||||||
|
|
|
||||||
|
|
@ -77,6 +77,8 @@ export default function EditNodeModal({ data }: { data: NodeDataType }) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
useEffect(() => {}, [closePopUp, data.node.template]);
|
||||||
|
|
||||||
function changeAdvanced(node): void {
|
function changeAdvanced(node): void {
|
||||||
Object.keys(data.node.template).filter((n, i) => {
|
Object.keys(data.node.template).filter((n, i) => {
|
||||||
if (n === node.name) {
|
if (n === node.name) {
|
||||||
|
|
@ -102,10 +104,10 @@ export default function EditNodeModal({ data }: { data: NodeDataType }) {
|
||||||
<DialogDescription>
|
<DialogDescription>
|
||||||
{EDIT_DIALOG_SUBTITLE}
|
{EDIT_DIALOG_SUBTITLE}
|
||||||
<div className="flex pt-3">
|
<div className="flex pt-3">
|
||||||
<VariableIcon className="w-5 h-5 pe-1 text-gray-700 stroke-2">
|
<VariableIcon className="w-5 h-5 pe-1 text-gray-700 stroke-2 dark:text-slate-200">
|
||||||
|
|
||||||
</VariableIcon>
|
</VariableIcon>
|
||||||
<span className="text-sm font-semibold text-gray-800">
|
<span className="text-sm font-semibold text-gray-800 dark:text-white">
|
||||||
Parameters
|
Parameters
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ import { Button } from "../../components/ui/button";
|
||||||
import { Textarea } from "../../components/ui/textarea";
|
import { Textarea } from "../../components/ui/textarea";
|
||||||
import { PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants";
|
import { PROMPT_DIALOG_SUBTITLE, TEXT_DIALOG_SUBTITLE } from "../../constants";
|
||||||
|
|
||||||
export default function PromptAreaModal({
|
export default function GenericModal({
|
||||||
value,
|
value,
|
||||||
setValue,
|
setValue,
|
||||||
buttonText,
|
buttonText,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue