diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx
index 1feaa4e3b..d6b22fefb 100644
--- a/src/frontend/src/components/cardComponent/index.tsx
+++ b/src/frontend/src/components/cardComponent/index.tsx
@@ -1,6 +1,6 @@
import { useContext } from "react";
import { TabsContext } from "../../contexts/tabsContext";
-import { FlowType } from "../../types/flow";
+import { cardComponentPropsType } from "../../types/components";
import { gradients } from "../../utils/styleUtils";
import IconComponent from "../genericIconComponent";
import {
@@ -10,7 +10,6 @@ import {
CardHeader,
CardTitle,
} from "../ui/card";
-import { cardComponentPropsType } from "../../types/components";
export const CardComponent = ({
flow,
diff --git a/src/frontend/src/components/codeTabsComponent/index.tsx b/src/frontend/src/components/codeTabsComponent/index.tsx
index b01bc85fa..71db84905 100644
--- a/src/frontend/src/components/codeTabsComponent/index.tsx
+++ b/src/frontend/src/components/codeTabsComponent/index.tsx
@@ -29,7 +29,7 @@ import {
TabsTrigger,
} from "../../components/ui/tabs";
import { darkContext } from "../../contexts/darkContext";
-import { FlowType } from "../../types/flow/index";
+import { codeTabsPropsType } from "../../types/components";
import { classNames } from "../../utils/utils";
import IconComponent from "../genericIconComponent";
@@ -40,20 +40,7 @@ export default function CodeTabsComponent({
setActiveTab,
isMessage,
tweaks,
-}: {
- flow?: FlowType;
- tabs: any;
- activeTab: string;
- setActiveTab: any;
- isMessage?: boolean;
- tweaks?: {
- tweak?: any;
- tweaksList?: any;
- buildContent?: any;
- getValue?: any;
- buildTweakObject?: any;
- };
-}) {
+}: codeTabsPropsType) {
const [isCopied, setIsCopied] = useState
(false);
const [data, setData] = useState(flow ? flow["data"]["nodes"] : null);
const [openAccordion, setOpenAccordion] = useState([]);
diff --git a/src/frontend/src/components/genericIconComponent/index.tsx b/src/frontend/src/components/genericIconComponent/index.tsx
index f5d7b8555..d4512c010 100644
--- a/src/frontend/src/components/genericIconComponent/index.tsx
+++ b/src/frontend/src/components/genericIconComponent/index.tsx
@@ -1,4 +1,4 @@
-import { ReactElement, SVGProps, createElement } from "react";
+import { createElement } from "react";
import { IconComponentProps } from "../../types/components";
import { nodeIconsLucide } from "../../utils/styleUtils";
@@ -7,10 +7,9 @@ export default function IconComponent({
className,
iconColor,
}: IconComponentProps): JSX.Element {
- // MAYBE PROBLEM HERE?
- const TargetIcon = createElement(nodeIconsLucide[name] ?? nodeIconsLucide["unknown"], {
+ const TargetIcon = createElement(nodeIconsLucide[name], {
className,
style: { color: iconColor },
- });
- return TargetIcon as JSX.Element
+ });
+ return TargetIcon as JSX.Element;
}
diff --git a/src/frontend/src/contexts/undoRedoContext.tsx b/src/frontend/src/contexts/undoRedoContext.tsx
index 6fe5a907d..312b09085 100644
--- a/src/frontend/src/contexts/undoRedoContext.tsx
+++ b/src/frontend/src/contexts/undoRedoContext.tsx
@@ -12,8 +12,8 @@ import {
UseUndoRedoOptions,
undoRedoContextType,
} from "../types/typesContext";
-import { TabsContext } from "./tabsContext";
import { isWrappedWithClass } from "../utils/utils";
+import { TabsContext } from "./tabsContext";
const initialValue = {
undo: () => {},
diff --git a/src/frontend/src/modals/ApiModal/index.tsx b/src/frontend/src/modals/ApiModal/index.tsx
index cdc0f9284..1cbcff6c2 100644
--- a/src/frontend/src/modals/ApiModal/index.tsx
+++ b/src/frontend/src/modals/ApiModal/index.tsx
@@ -15,7 +15,7 @@ import CodeTabsComponent from "../../components/codeTabsComponent";
import IconComponent from "../../components/genericIconComponent";
import { EXPORT_CODE_DIALOG } from "../../constants/constants";
import { TabsContext } from "../../contexts/tabsContext";
-import { FlowType, NodeDataType } from "../../types/flow/index";
+import { FlowType } from "../../types/flow/index";
import { buildTweaks } from "../../utils/reactflowUtils";
import {
getCurlCode,
diff --git a/src/frontend/src/modals/EditNodeModal/index.tsx b/src/frontend/src/modals/EditNodeModal/index.tsx
index cd31b6edd..ebd52ca2a 100644
--- a/src/frontend/src/modals/EditNodeModal/index.tsx
+++ b/src/frontend/src/modals/EditNodeModal/index.tsx
@@ -24,7 +24,6 @@ import {
import { limitScrollFieldsModal } from "../../constants/constants";
import { TabsContext } from "../../contexts/tabsContext";
import { typesContext } from "../../contexts/typesContext";
-import { editNodeToggleType } from "../../types/components";
import { NodeDataType } from "../../types/flow";
import { classNames } from "../../utils/utils";
import BaseModal from "../baseModal";
@@ -61,7 +60,10 @@ const EditNodeModal = forwardRef(
});
}
- const handleOnNewValue = (newValue: string | string[] | boolean, name: string) => {
+ const handleOnNewValue = (
+ newValue: string | string[] | boolean,
+ name: string
+ ) => {
setMyData((old) => {
let newData = cloneDeep(old);
newData.node.template[name].value = newValue;
diff --git a/src/frontend/src/modals/codeAreaModal/index.tsx b/src/frontend/src/modals/codeAreaModal/index.tsx
index f7429bde6..6289ab1e5 100644
--- a/src/frontend/src/modals/codeAreaModal/index.tsx
+++ b/src/frontend/src/modals/codeAreaModal/index.tsx
@@ -3,7 +3,7 @@ import "ace-builds/src-noconflict/ext-language_tools";
import "ace-builds/src-noconflict/mode-python";
import "ace-builds/src-noconflict/theme-github";
import "ace-builds/src-noconflict/theme-twilight";
-import { ReactNode, useContext, useState } from "react";
+import { useContext, useState } from "react";
import AceEditor from "react-ace";
import IconComponent from "../../components/genericIconComponent";
import { Button } from "../../components/ui/button";
@@ -11,9 +11,8 @@ import { CODE_PROMPT_DIALOG_SUBTITLE } from "../../constants/constants";
import { alertContext } from "../../contexts/alertContext";
import { darkContext } from "../../contexts/darkContext";
import { postValidateCode } from "../../controllers/API";
-import { APIClassType } from "../../types/api";
-import BaseModal from "../baseModal";
import { codeAreaModalPropsType } from "../../types/components";
+import BaseModal from "../baseModal";
export default function CodeAreaModal({
value,
diff --git a/src/frontend/src/modals/exportModal/index.tsx b/src/frontend/src/modals/exportModal/index.tsx
index 9e9f79be3..55ac18c15 100644
--- a/src/frontend/src/modals/exportModal/index.tsx
+++ b/src/frontend/src/modals/exportModal/index.tsx
@@ -8,72 +8,74 @@ import { TabsContext } from "../../contexts/tabsContext";
import { removeApiKeys } from "../../utils/reactflowUtils";
import BaseModal from "../baseModal";
-const ExportModal = forwardRef((props: { children: ReactNode }, ref): JSX.Element => {
- const { flows, tabId, updateFlow, downloadFlow, saveFlow } =
- useContext(TabsContext);
- const [checked, setChecked] = useState(false);
- const [name, setName] = useState(flows.find((f) => f.id === tabId)?.name);
- const [description, setDescription] = useState(
- flows.find((f) => f.id === tabId)?.description
- );
- const [open, setOpen] = useState(false);
- return (
-
- {props.children}
-
- Export
-
-
-
-
-
- {
- setChecked(event);
- }}
+const ExportModal = forwardRef(
+ (props: { children: ReactNode }, ref): JSX.Element => {
+ const { flows, tabId, updateFlow, downloadFlow, saveFlow } =
+ useContext(TabsContext);
+ const [checked, setChecked] = useState(false);
+ const [name, setName] = useState(flows.find((f) => f.id === tabId)?.name);
+ const [description, setDescription] = useState(
+ flows.find((f) => f.id === tabId)?.description
+ );
+ const [open, setOpen] = useState(false);
+ return (
+
+ {props.children}
+
+ Export
+
-
-
-
+
+
+
+
+ {
+ setChecked(event);
+ }}
+ />
+
+
+
-
-
-
-
- );
-});
+
+
+
+
+ );
+ }
+);
export default ExportModal;
diff --git a/src/frontend/src/modals/flowSettingsModal/index.tsx b/src/frontend/src/modals/flowSettingsModal/index.tsx
index 54617b337..586acc0f7 100644
--- a/src/frontend/src/modals/flowSettingsModal/index.tsx
+++ b/src/frontend/src/modals/flowSettingsModal/index.tsx
@@ -5,8 +5,8 @@ import { Button } from "../../components/ui/button";
import { SETTINGS_DIALOG_SUBTITLE } from "../../constants/constants";
import { alertContext } from "../../contexts/alertContext";
import { TabsContext } from "../../contexts/tabsContext";
-import BaseModal from "../baseModal";
import { FlowSettingsPropsType } from "../../types/components";
+import BaseModal from "../baseModal";
export default function FlowSettingsModal({
open,
diff --git a/src/frontend/src/modals/formModal/chatInput/index.tsx b/src/frontend/src/modals/formModal/chatInput/index.tsx
index 1c8086283..3936c6d69 100644
--- a/src/frontend/src/modals/formModal/chatInput/index.tsx
+++ b/src/frontend/src/modals/formModal/chatInput/index.tsx
@@ -1,7 +1,7 @@
import { useEffect } from "react";
import IconComponent from "../../../components/genericIconComponent";
-import { chatInputType } from "../../../types/components";
import { Textarea } from "../../../components/ui/textarea";
+import { chatInputType } from "../../../types/components";
import { classNames } from "../../../utils/utils";
export default function ChatInput({
diff --git a/src/frontend/src/modals/formModal/chatMessage/index.tsx b/src/frontend/src/modals/formModal/chatMessage/index.tsx
index 3b9823c4c..b3f57389d 100644
--- a/src/frontend/src/modals/formModal/chatMessage/index.tsx
+++ b/src/frontend/src/modals/formModal/chatMessage/index.tsx
@@ -9,10 +9,9 @@ import Robot from "../../../assets/robot.png";
import SanitizedHTMLWrapper from "../../../components/SanitizedHTMLWrapper";
import CodeTabsComponent from "../../../components/codeTabsComponent";
import IconComponent from "../../../components/genericIconComponent";
-import { ChatMessageType } from "../../../types/chat";
+import { chatMessagePropsType } from "../../../types/components";
import { classNames } from "../../../utils/utils";
import FileCard from "../fileComponent";
-import { chatMessagePropsType } from "../../../types/components";
export default function ChatMessage({
chat,
diff --git a/src/frontend/src/modals/genericModal/index.tsx b/src/frontend/src/modals/genericModal/index.tsx
index d569af09f..4deac515f 100644
--- a/src/frontend/src/modals/genericModal/index.tsx
+++ b/src/frontend/src/modals/genericModal/index.tsx
@@ -1,4 +1,4 @@
-import { ReactNode, useContext, useEffect, useRef, useState } from "react";
+import { useContext, useEffect, useRef, useState } from "react";
import SanitizedHTMLWrapper from "../../components/SanitizedHTMLWrapper";
import ShadTooltip from "../../components/ShadTooltipComponent";
import IconComponent from "../../components/genericIconComponent";
@@ -15,14 +15,13 @@ import {
import { TypeModal } from "../../constants/enums";
import { alertContext } from "../../contexts/alertContext";
import { postValidatePrompt } from "../../controllers/API";
-import { APIClassType } from "../../types/api";
+import { genericModalPropsType } from "../../types/components";
import {
classNames,
getRandomKeyByssmm,
varHighlightHTML,
} from "../../utils/utils";
import BaseModal from "../baseModal";
-import { genericModalPropsType } from "../../types/components";
export default function GenericModal({
field_name = "",
diff --git a/src/frontend/src/modals/importModal/buttonBox/index.tsx b/src/frontend/src/modals/importModal/buttonBox/index.tsx
index 80fbe76c9..567f0c94c 100644
--- a/src/frontend/src/modals/importModal/buttonBox/index.tsx
+++ b/src/frontend/src/modals/importModal/buttonBox/index.tsx
@@ -1,6 +1,5 @@
-import { ReactNode } from "react";
-import { classNames } from "../../../utils/utils";
import { buttonBoxPropsType } from "../../../types/components";
+import { classNames } from "../../../utils/utils";
export default function ButtonBox({
onClick,
diff --git a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
index a6d7a1c90..78eb32b67 100644
--- a/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
+++ b/src/frontend/src/pages/FlowPage/components/PageComponent/index.tsx
@@ -6,7 +6,6 @@ import ReactFlow, {
Controls,
Edge,
EdgeChange,
- Node,
NodeChange,
NodeDragHandler,
OnEdgesDelete,
@@ -263,7 +262,6 @@ export default function Page({ flow }: { flow: FlowType }): JSX.Element {
data: {
...data,
id: newId,
- value: null,
},
};
} else {
@@ -275,7 +273,6 @@ export default function Page({ flow }: { flow: FlowType }): JSX.Element {
data: {
...data,
id: newId,
- value: null,
},
};
diff --git a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx
index 032e61952..e5c4d85c7 100644
--- a/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx
+++ b/src/frontend/src/pages/FlowPage/components/nodeToolbarComponent/index.tsx
@@ -7,7 +7,11 @@ import EditNodeModal from "../../../../modals/EditNodeModal";
import { nodeToolbarPropsType } from "../../../../types/components";
import { classNames } from "../../../../utils/utils";
-export default function NodeToolbarComponent({ data, setData, deleteNode }: nodeToolbarPropsType): JSX.Element {
+export default function NodeToolbarComponent({
+ data,
+ setData,
+ deleteNode,
+}: nodeToolbarPropsType): JSX.Element {
const [nodeLength, setNodeLength] = useState(
Object.keys(data.node.template).filter(
(t) =>
diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts
index b27c931a7..5d92ef17c 100644
--- a/src/frontend/src/types/components/index.ts
+++ b/src/frontend/src/types/components/index.ts
@@ -1,9 +1,9 @@
-import { ForwardRefExoticComponent, ReactElement, ReactNode, RefAttributes, SVGProps } from "react";
-import { APIClassType, APITemplateType } from "../api";
-import { FlowStyleType, FlowType, NodeDataType } from "../flow/index";
-import { typesContextType } from "../typesContext";
-import { ChatMessageType } from "../chat";
+import { ReactElement, ReactNode } from "react";
import { ReactFlowJsonObject } from "reactflow";
+import { APIClassType, APITemplateType } from "../api";
+import { ChatMessageType } from "../chat";
+import { FlowStyleType, FlowType, NodeDataType, NodeType } from "../flow/index";
+import { typesContextType } from "../typesContext";
export type InputComponentType = {
value: string;
@@ -365,7 +365,7 @@ export type FlowSettingsPropsType = {
export type groupDataType = {
[char: string]: string;
-}
+};
export type cardComponentPropsType = {
flow: FlowType;
@@ -373,3 +373,53 @@ export type cardComponentPropsType = {
onDelete?: () => void;
button?: JSX.Element;
};
+
+type tabsArrayType = {
+ code: string;
+ image: string;
+ language: string;
+ mode: string;
+ name: string;
+};
+
+type getValueNodeType = {
+ id: string;
+ node: NodeType;
+ type: string;
+ value: null;
+};
+
+type codeTabsFuncTempType = {
+ [key: string]: string | boolean;
+};
+
+export type codeTabsPropsType = {
+ flow?: FlowType;
+ tabs: Array;
+ activeTab: string;
+ setActiveTab: (value: string) => void;
+ isMessage?: boolean;
+ tweaks?: {
+ tweak?: { current: Array };
+ tweaksList?: { current: Array };
+ buildContent?: (value: string) => ReactNode;
+ getValue?: (
+ value: string,
+ node: getValueNodeType,
+ template: codeTabsFuncTempType
+ ) => string;
+ buildTweakObject?: (
+ tw: string,
+ changes: string | string[] | boolean,
+ template: codeTabsFuncTempType
+ ) => string;
+ };
+};
+
+export type crashComponentPropsType = {
+ error: {
+ message: string;
+ stack: string;
+ };
+ resetErrorBoundary: (args) => void;
+};
diff --git a/src/frontend/src/types/flow/index.ts b/src/frontend/src/types/flow/index.ts
index 734370af7..e1a2fda2a 100644
--- a/src/frontend/src/types/flow/index.ts
+++ b/src/frontend/src/types/flow/index.ts
@@ -18,7 +18,6 @@ export type NodeDataType = {
type: string;
node?: APIClassType;
id: string;
- value: null;
};
// FlowStyleType is the type of the style object that is used to style the
// Flow card with an emoji and a color.
diff --git a/src/frontend/src/types/typesContext/index.ts b/src/frontend/src/types/typesContext/index.ts
index 0f470862d..0506e3e34 100644
--- a/src/frontend/src/types/typesContext/index.ts
+++ b/src/frontend/src/types/typesContext/index.ts
@@ -8,7 +8,7 @@ const data: { [char: string]: string } = {};
export type typesContextType = {
reactFlowInstance: ReactFlowInstance | null;
- setReactFlowInstance: any;
+ setReactFlowInstance: () => void;
deleteNode: (idx: string) => void;
types: typeof types;
setTypes: (newState: {}) => void;
@@ -56,8 +56,8 @@ export type locationContextType = {
options?: Array<{
name: string;
href: string;
- icon: any;
- children?: Array;
+ icon: React.ElementType;
+ children?: Array;
}>;
};
setExtraNavigation: (newState: {
@@ -65,12 +65,12 @@ export type locationContextType = {
options?: Array<{
name: string;
href: string;
- icon: any;
- children?: Array;
+ icon: React.ElementType;
+ children?: Array;
}>;
}) => void;
extraComponent: any;
- setExtraComponent: (newState: any) => void;
+ setExtraComponent: (newState: JSX.Element) => void;
};
export type undoRedoContextType = {
diff --git a/src/frontend/src/utils/utils.ts b/src/frontend/src/utils/utils.ts
index cc35b31dd..db3d092a8 100644
--- a/src/frontend/src/utils/utils.ts
+++ b/src/frontend/src/utils/utils.ts
@@ -10,7 +10,6 @@ import {
import { FlowType } from "../types/flow";
import { TabsState } from "../types/tabs";
import { buildTweaks } from "./reactflowUtils";
-import { APIClassType, APIObjectType, APITemplateType } from "../types/api";
export function classNames(...classes: Array): string {
return classes.filter(Boolean).join(" ");
@@ -94,7 +93,12 @@ export function checkUpperWords(str: string): string {
export const isWrappedWithClass = (event: any, className: string | undefined) =>
event.target.closest(`.${className}`);
-export function groupByFamily(data: groupDataType, baseClasses: string, left: boolean, type: string): groupedObjType[] {
+export function groupByFamily(
+ data: groupDataType,
+ baseClasses: string,
+ left: boolean,
+ type: string
+): groupedObjType[] {
let parentOutput: string;
let arrOfParent: string[] = [];
let arrOfType: { family: string; type: string; component: string }[] = [];