Formated code

This commit is contained in:
Igor Carvalho 2023-07-24 16:17:32 -03:00
commit d09e07e12d
7 changed files with 24 additions and 18 deletions

View file

@ -89,8 +89,7 @@ export default function GenericNode({
</ShadTooltip> </ShadTooltip>
</div> </div>
</div> </div>
<div className="round-button-div"> <div className="round-button-div"></div>
</div>
<div className="round-button-div"> <div className="round-button-div">
<div> <div>
<Tooltip <Tooltip
@ -111,7 +110,9 @@ export default function GenericNode({
{validationStatus.params {validationStatus.params
? validationStatus.params ? validationStatus.params
.split("\n") .split("\n")
.map((line: string, index: number) => <div key={index}>{line}</div>) .map((line: string, index: number) => (
<div key={index}>{line}</div>
))
: ""} : ""}
</div> </div>
) )

View file

@ -8,10 +8,10 @@ import { postBuildInit } from "../../../controllers/API";
import { FlowType } from "../../../types/flow"; import { FlowType } from "../../../types/flow";
import { TabsContext } from "../../../contexts/tabsContext"; import { TabsContext } from "../../../contexts/tabsContext";
import { parsedDataType } from "../../../types/components";
import { validateNodes } from "../../../utils/reactflowUtils"; import { validateNodes } from "../../../utils/reactflowUtils";
import RadialProgressComponent from "../../RadialProgress"; import RadialProgressComponent from "../../RadialProgress";
import IconComponent from "../../genericIconComponent"; import IconComponent from "../../genericIconComponent";
import { parsedDataType } from "../../../types/components";
export default function BuildTrigger({ export default function BuildTrigger({
open, open,
@ -129,7 +129,7 @@ export default function BuildTrigger({
// Process each chunk of data here // Process each chunk of data here
// Parse the chunk and update the context // Parse the chunk and update the context
try { try {
console.log(parsedData) console.log(parsedData);
updateSSEData({ [parsedData.id]: parsedData }); updateSSEData({ [parsedData.id]: parsedData });
} catch (err) { } catch (err) {
console.log("Error parsing stream data: ", err); console.log("Error parsing stream data: ", err);

View file

@ -33,9 +33,9 @@ import { limitScrollFieldsModal } from "../../constants/constants";
import { PopUpContext } from "../../contexts/popUpContext"; import { PopUpContext } from "../../contexts/popUpContext";
import { TabsContext } from "../../contexts/tabsContext"; import { TabsContext } from "../../contexts/tabsContext";
import { typesContext } from "../../contexts/typesContext"; import { typesContext } from "../../contexts/typesContext";
import { editNodeToggleType } from "../../types/components";
import { NodeDataType } from "../../types/flow"; import { NodeDataType } from "../../types/flow";
import { classNames } from "../../utils/utils"; import { classNames } from "../../utils/utils";
import { editNodeToggleType } from "../../types/components";
export default function EditNodeModal({ export default function EditNodeModal({
data, data,
@ -88,7 +88,10 @@ export default function EditNodeModal({
setNodeValue(!nodeValue); setNodeValue(!nodeValue);
} }
const handleOnNewValue = (newValue: string | string[] | boolean, name: string): void => { const handleOnNewValue = (
newValue: string | string[] | boolean,
name: string
): void => {
data.node.template[name].value = newValue; data.node.template[name].value = newValue;
// Set state to pending // Set state to pending
setTabsState((prev) => { setTabsState((prev) => {
@ -182,7 +185,7 @@ export default function EditNodeModal({
: data.node.template[n].value : data.node.template[n].value
} }
onChange={(t: string[]) => { onChange={(t: string[]) => {
console.log(t) console.log(t);
handleOnNewValue(t, n); handleOnNewValue(t, n);
}} }}
/> />
@ -233,7 +236,7 @@ export default function EditNodeModal({
}} }}
/> />
</div> </div>
) : data.node.template[n].type === "str" && ) : data.node.template[n].type === "str" &&
data.node.template[n].options ? ( data.node.template[n].options ? (
<div className="mx-auto"> <div className="mx-auto">
<Dropdown <Dropdown

View file

@ -3,7 +3,11 @@ import { useState } from "react";
import IconComponent from "../../../components/genericIconComponent"; import IconComponent from "../../../components/genericIconComponent";
import { fileCardPropsType } from "../../../types/components"; import { fileCardPropsType } from "../../../types/components";
export default function FileCard({ fileName, content, fileType }: fileCardPropsType): JSX.Element { export default function FileCard({
fileName,
content,
fileType,
}: fileCardPropsType): JSX.Element {
const handleDownload = (): void => { const handleDownload = (): void => {
const byteArray = new Uint8Array(base64js.toByteArray(content)); const byteArray = new Uint8Array(base64js.toByteArray(content));
const blob = new Blob([byteArray], { type: "application/octet-stream" }); const blob = new Blob([byteArray], { type: "application/octet-stream" });
@ -56,8 +60,7 @@ export default function FileCard({ fileName, content, fileType }: fileCardPropsT
return ( return (
<button onClick={handleDownload} className="file-card-modal-button"> <button onClick={handleDownload} className="file-card-modal-button">
<div className="file-card-modal-div"> <div className="file-card-modal-div">
ooooooooooooooo ooooooooooooooo{" "}
{" "}
{fileType === "image" ? ( {fileType === "image" ? (
<img <img
src={`data:image/png;base64,${content}`} src={`data:image/png;base64,${content}`}

View file

@ -4,8 +4,8 @@ import ShadTooltip from "../../../../components/ShadTooltipComponent";
import IconComponent from "../../../../components/genericIconComponent"; import IconComponent from "../../../../components/genericIconComponent";
import { TabsContext } from "../../../../contexts/tabsContext"; import { TabsContext } from "../../../../contexts/tabsContext";
import EditNodeModal from "../../../../modals/EditNodeModal"; import EditNodeModal from "../../../../modals/EditNodeModal";
import { classNames } from "../../../../utils/utils";
import { nodeToolbarPropsType } from "../../../../types/components"; import { nodeToolbarPropsType } from "../../../../types/components";
import { classNames } from "../../../../utils/utils";
const NodeToolbarComponent = (props: nodeToolbarPropsType): JSX.Element => { const NodeToolbarComponent = (props: nodeToolbarPropsType): JSX.Element => {
const [nodeLength, setNodeLength] = useState( const [nodeLength, setNodeLength] = useState(

View file

@ -35,7 +35,7 @@ export type sendAllProps = {
name: string; name: string;
description: string; description: string;
viewport: Viewport; viewport: Viewport;
inputs: { text: string; }; inputs: { text: string };
chatHistory: { message: string | object; isSend: boolean }[]; chatHistory: { message: string | object; isSend: boolean }[];
}; };

View file

@ -1,8 +1,7 @@
import { ReactElement, ReactNode, RefObject } from "react"; import { ReactElement, ReactNode } from "react";
import { APIClassType } from "../api"; import { APIClassType } from "../api";
import { FlowStyleType, NodeDataType } from "../flow/index"; import { FlowStyleType, NodeDataType } from "../flow/index";
import { typesContextType } from "../typesContext"; import { typesContextType } from "../typesContext";
import { BlobOptions } from "buffer";
export type InputComponentType = { export type InputComponentType = {
value: string; value: string;
@ -481,7 +480,7 @@ export type editNodeToggleType = {
export interface Props { export interface Props {
language: string; language: string;
value: string; value: string;
}; }
export type fileCardPropsType = { export type fileCardPropsType = {
fileName: string; fileName: string;
@ -493,7 +492,7 @@ export type nodeToolbarPropsType = {
data: NodeDataType; data: NodeDataType;
deleteNode: (idx: string) => void; deleteNode: (idx: string) => void;
openPopUp: (element: JSX.Element) => void; openPopUp: (element: JSX.Element) => void;
} };
export type parsedDataType = { export type parsedDataType = {
id: string; id: string;