From ab185f57bd2f0d8ab3ee1a8161b921b7ac55d161 Mon Sep 17 00:00:00 2001 From: Lucas Oliveira Date: Thu, 20 Jul 2023 17:17:48 -0300 Subject: [PATCH] Fixed copy paste on all components --- .../components/parameterComponent/index.tsx | 5 +---- .../EditFlowSettingsComponent/index.tsx | 2 +- .../src/components/floatComponent/index.tsx | 17 ++++------------ .../src/components/inputComponent/index.tsx | 14 +++---------- .../components/inputListComponent/index.tsx | 5 +++-- .../src/components/intComponent/index.tsx | 16 ++++----------- .../components/textAreaComponent/index.tsx | 13 ++---------- src/frontend/src/components/ui/input.tsx | 2 +- .../src/components/ui/rename-label.tsx | 2 +- src/frontend/src/modals/baseModal/index.tsx | 20 ++----------------- .../extraSidebarComponent/index.tsx | 2 +- src/frontend/src/types/components/index.ts | 2 -- 12 files changed, 23 insertions(+), 77 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx index 9a3afec58..cfa9b8b92 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/parameterComponent/index.tsx @@ -152,7 +152,7 @@ export default function ParameterComponent({ return (
<>
@@ -309,7 +307,6 @@ export default function ParameterComponent({
diff --git a/src/frontend/src/components/EditFlowSettingsComponent/index.tsx b/src/frontend/src/components/EditFlowSettingsComponent/index.tsx index 349b151b5..390c3572e 100644 --- a/src/frontend/src/components/EditFlowSettingsComponent/index.tsx +++ b/src/frontend/src/components/EditFlowSettingsComponent/index.tsx @@ -51,7 +51,7 @@ export const EditFlowSettings: React.FC = ({ )}
{ - if (disableCopyPaste) setDisableCopyPaste(true); - }} - onBlur={() => { - if (disableCopyPaste) setDisableCopyPaste(false); - }} type="number" step={step} min={min} @@ -45,9 +35,10 @@ export default function FloatComponent({ max={max} value={value ?? ""} className={ - editNode + "nopan nodrag noundo nocopy " + + (editNode ? "input-edit-node" - : "input-primary" + (disabled ? " input-disable " : "") + : "input-primary" + (disabled ? " input-disable " : "")) } placeholder={ editNode ? "Number 0 to 1" : "Type a number from zero to one" diff --git a/src/frontend/src/components/inputComponent/index.tsx b/src/frontend/src/components/inputComponent/index.tsx index 7b33f18df..682d5716c 100644 --- a/src/frontend/src/components/inputComponent/index.tsx +++ b/src/frontend/src/components/inputComponent/index.tsx @@ -1,18 +1,15 @@ -import { useContext, useEffect, useState } from "react"; -import { TabsContext } from "../../contexts/tabsContext"; +import { useEffect, useState } from "react"; import { InputComponentType } from "../../types/components"; import { classNames } from "../../utils/utils"; export default function InputComponent({ value, onChange, - disableCopyPaste = false, disabled, password, editNode = false, }: InputComponentType) { const [pwdVisible, setPwdVisible] = useState(false); - const { setDisableCopyPaste } = useContext(TabsContext); // Clear component state useEffect(() => { @@ -25,18 +22,13 @@ export default function InputComponent({
{ - if (disableCopyPaste) setDisableCopyPaste(true); - }} - onBlur={() => { - if (disableCopyPaste) setDisableCopyPaste(false); - }} className={classNames( disabled ? " input-disable " : "", password && !pwdVisible && value !== "" ? " text-clip password " : "", editNode ? " input-edit-node " : " input-primary ", password && editNode ? "pr-8" : "", - password && !editNode ? "pr-10" : "" + password && !editNode ? "pr-10" : "", + "nopan nodrag noundo nocopy" )} placeholder={password && editNode ? "Key" : "Type something..."} onChange={(e) => { diff --git a/src/frontend/src/components/inputListComponent/index.tsx b/src/frontend/src/components/inputListComponent/index.tsx index d924095dd..a54b4151f 100644 --- a/src/frontend/src/components/inputListComponent/index.tsx +++ b/src/frontend/src/components/inputListComponent/index.tsx @@ -40,9 +40,10 @@ export default function InputListComponent({ type="text" value={i} className={ - editNode + "nopan nodrag noundo nocopy " + + (editNode ? "input-edit-node " - : "input-primary " + (disabled ? "input-disable" : "") + : "input-primary " + (disabled ? "input-disable" : "")) } placeholder="Type something..." onChange={(e) => { diff --git a/src/frontend/src/components/intComponent/index.tsx b/src/frontend/src/components/intComponent/index.tsx index c846fb772..24d28e4f5 100644 --- a/src/frontend/src/components/intComponent/index.tsx +++ b/src/frontend/src/components/intComponent/index.tsx @@ -1,15 +1,12 @@ -import { useContext, useEffect } from "react"; -import { TabsContext } from "../../contexts/tabsContext"; +import { useEffect } from "react"; import { FloatComponentType } from "../../types/components"; export default function IntComponent({ value, onChange, - disableCopyPaste = false, disabled, editNode = false, }: FloatComponentType) { - const { setDisableCopyPaste } = useContext(TabsContext); const min = 0; // Clear component state @@ -27,12 +24,6 @@ export default function IntComponent({ } > { - if (disableCopyPaste) setDisableCopyPaste(true); - }} - onBlur={() => { - if (disableCopyPaste) setDisableCopyPaste(false); - }} onKeyDown={(event) => { if ( event.key !== "Backspace" && @@ -61,9 +52,10 @@ export default function IntComponent({ }} value={value ?? ""} className={ - editNode + "nopan nodrag noundo nocopy " + + (editNode ? " input-edit-node " - : " input-primary " + (disabled ? " input-disable" : "") + : " input-primary " + (disabled ? " input-disable" : "")) } placeholder={editNode ? "Integer number" : "Type an integer number"} onChange={(e) => { diff --git a/src/frontend/src/components/textAreaComponent/index.tsx b/src/frontend/src/components/textAreaComponent/index.tsx index 0602fc7b6..2bead9a2d 100644 --- a/src/frontend/src/components/textAreaComponent/index.tsx +++ b/src/frontend/src/components/textAreaComponent/index.tsx @@ -1,6 +1,5 @@ -import { useContext, useEffect } from "react"; +import { useEffect } from "react"; import { TypeModal } from "../../constants/enums"; -import { TabsContext } from "../../contexts/tabsContext"; import GenericModal from "../../modals/genericModal"; import { TextAreaComponentType } from "../../types/components"; import IconComponent from "../genericIconComponent"; @@ -11,8 +10,6 @@ export default function TextAreaComponent({ disabled, editNode = false, }: TextAreaComponentType) { - const { setDisableCopyPaste } = useContext(TabsContext); - // Clear text area useEffect(() => { if (disabled) { @@ -25,17 +22,11 @@ export default function TextAreaComponent({
{ - setDisableCopyPaste(true); - }} - onBlur={() => { - setDisableCopyPaste(false); - }} className={ (editNode ? " input-edit-node " : " input-primary " + (disabled ? " input-disable" : "")) + - " w-full" + " nopan nodrag noundo nocopy w-full" } placeholder={"Type something..."} onChange={(e) => { diff --git a/src/frontend/src/components/ui/input.tsx b/src/frontend/src/components/ui/input.tsx index a59b419f3..0942a3930 100644 --- a/src/frontend/src/components/ui/input.tsx +++ b/src/frontend/src/components/ui/input.tsx @@ -10,7 +10,7 @@ const Input = React.forwardRef( { diff --git a/src/frontend/src/modals/baseModal/index.tsx b/src/frontend/src/modals/baseModal/index.tsx index bdecd172a..e679c2d89 100644 --- a/src/frontend/src/modals/baseModal/index.tsx +++ b/src/frontend/src/modals/baseModal/index.tsx @@ -1,4 +1,4 @@ -import { ReactNode, useContext, useEffect, useState } from "react"; +import { ReactNode } from "react"; import React from "react"; import { @@ -9,7 +9,6 @@ import { DialogTitle, DialogTrigger, } from "../../components/ui/dialog"; -import { TabsContext } from "../../contexts/tabsContext"; type ContentProps = { children: ReactNode }; type HeaderProps = { children: ReactNode; description: string }; @@ -97,24 +96,9 @@ function BaseModal({ break; } - const { disableCopyPaste, setDisableCopyPaste } = useContext(TabsContext); - const [keepDisabling, setKeepDisabling] = useState(false); - - useEffect(() => { - if (keepDisabling) { - setDisableCopyPaste(true); - } - }, [disableCopyPaste]); - - useEffect(() => { - if (!open) { - setKeepDisabling(false); - } - }, [open]); - //UPDATE COLORS AND STYLE CLASSSES return ( - + diff --git a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx index befaf798d..45aa67526 100644 --- a/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx +++ b/src/frontend/src/pages/FlowPage/components/extraSidebarComponent/index.tsx @@ -114,7 +114,7 @@ export default function ExtraSidebar() { name="search" id="search" placeholder="Search" - className="input-search" + className="nopan nodrag noundo nocopy input-search" onChange={(e) => { handleSearchInput(e.target.value); // Set search input state diff --git a/src/frontend/src/types/components/index.ts b/src/frontend/src/types/components/index.ts index 2910a6e97..6491355cc 100644 --- a/src/frontend/src/types/components/index.ts +++ b/src/frontend/src/types/components/index.ts @@ -7,7 +7,6 @@ export type InputComponentType = { disabled?: boolean; onChange: (value: string) => void; password: boolean; - disableCopyPaste?: boolean; editNode?: boolean; onChangePass?: (value: boolean | boolean) => void; showPass?: boolean; @@ -94,7 +93,6 @@ export type DisclosureComponentType = { export type FloatComponentType = { value: string; disabled?: boolean; - disableCopyPaste?: boolean; onChange: (value: string) => void; editNode?: boolean; };