Merge branch 'modalRefactor' into input-refactor

This commit is contained in:
Cristhian Zanforlin Lousa 2023-07-22 09:05:38 -03:00
commit c218dc1d02
5 changed files with 19 additions and 11 deletions

View file

@ -7,7 +7,7 @@ type InputProps = {
name: string | null;
description: string | null;
maxLength?: number;
flows: Array<{ id: string; name: string }>;
flows: Array<{ id: string; name: string; description: string }>;
tabId: string;
setName: (name: string) => void;
setDescription: (description: string) => void;
@ -37,7 +37,13 @@ export const EditFlowSettings: React.FC<InputProps> = ({
setName(value);
};
const [desc, setDesc] = useState(
flows.find((f) => f.id === tabId).description
);
const handleDescriptionChange = (event: ChangeEvent<HTMLTextAreaElement>) => {
flows.find((f) => f.id === tabId).description = event.target.value;
setDesc(flows.find((f) => f.id === tabId).description)
setDescription(event.target.value);
};
@ -70,7 +76,7 @@ export const EditFlowSettings: React.FC<InputProps> = ({
name="description"
id="description"
onChange={handleDescriptionChange}
value={description ?? ""}
value={desc}
placeholder="Flow description"
className="mt-2 max-h-[100px] font-normal"
rows={3}

View file

@ -191,6 +191,7 @@ export default function CodeTabsComponent({
<AccordionComponent
trigger={t["data"]["id"]}
open={openAccordion}
keyValue={t["data"]["id"]}
>
<div className="api-modal-table-arrangement">
<Table className="table-fixed bg-muted outline-1">
@ -224,8 +225,6 @@ export default function CodeTabsComponent({
t.data.node.template[n].type === "int")
)
.map((n, i) => {
//console.log(t.data.node.template[n]);
return (
<TableRow
key={i}

View file

@ -15,12 +15,6 @@ export default function InputListComponent({
}: InputListComponentType) {
const [inputList, setInputList] = useState(value ?? [""]);
useEffect(() => {
if (value) {
setInputList(value);
}
}, [value]);
useEffect(() => {
if (disabled) {
setInputList([""]);
@ -47,7 +41,7 @@ export default function InputListComponent({
placeholder="Type something..."
onChange={(e) => {
setInputList((old) => {
let newInputList = _.cloneDeep(old);
let newInputList = _.cloneDeep(inputList);
newInputList[idx] = e.target.value;
return newInputList;
});

View file

@ -96,6 +96,12 @@ export default function GenericModal({
}
}, [inputValue, type]);
useEffect(() => {
setInputValue(value)
}, [value])
const coloredContent = (inputValue || "")
.replace(/</g, "&lt;")
.replace(/>/g, "&gt;")

View file

@ -93,6 +93,7 @@ export default function NodeToolbarComponent({ data, setData, deleteNode }) {
</ShadTooltip>
<ShadTooltip content="Edit" side="top">
<div>
<EditNodeModal
data={data}
setData={setData}
@ -109,6 +110,8 @@ export default function NodeToolbarComponent({ data, setData, deleteNode }) {
<IconComponent name="Settings2" className="h-4 w-4 " />
</div>
</EditNodeModal>
</div>
</ShadTooltip>
</span>
</div>