From c7cbb40c36d1a2bd4c4483cd5458d893a8bd8cc8 Mon Sep 17 00:00:00 2001 From: Gabriel Luiz Freitas Almeida Date: Fri, 16 Jun 2023 18:54:18 -0300 Subject: [PATCH] format: run make format --- .../src/CustomNodes/GenericNode/index.tsx | 2 +- .../src/components/cardComponent/index.tsx | 16 +++++----- .../chatComponent/buildTrigger/index.tsx | 29 ++++++++++--------- .../chatComponent/chatTrigger/index.tsx | 7 ++--- .../src/components/chatComponent/index.tsx | 3 +- src/frontend/src/components/ui/tabs.tsx | 24 +++++++-------- src/frontend/src/contexts/SSEContext.tsx | 4 ++- src/frontend/src/contexts/typesContext.tsx | 24 ++++++++------- src/frontend/src/modals/chatModal/index.tsx | 2 +- .../src/modals/flowSettingsModal/index.tsx | 12 ++++---- .../src/pages/CommunityPage/index.tsx | 6 +++- .../components/PageComponent/index.tsx | 18 ++++++------ src/frontend/src/pages/FlowPage/index.tsx | 16 +++++----- src/frontend/src/routes.tsx | 2 +- 14 files changed, 88 insertions(+), 77 deletions(-) diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index b56b15352..fb1ed5f59 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -29,7 +29,7 @@ export default function GenericNode({ const Icon = nodeIcons[data.type] || nodeIcons[types[data.type]]; const [validationStatus, setValidationStatus] = useState(null); // State for outline color - const { sseData,isBuilding } = useSSE(); + const { sseData, isBuilding } = useSSE(); // useEffect(() => { // if (reactFlowInstance) { diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx index 6d919fcd8..aec9ccb3b 100644 --- a/src/frontend/src/components/cardComponent/index.tsx +++ b/src/frontend/src/components/cardComponent/index.tsx @@ -29,13 +29,15 @@ export const CardComponent = ({ - - {flow.name} + + + {flow.name} + {onDelete && ( diff --git a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx index e5d3bb300..db1c030ae 100644 --- a/src/frontend/src/components/chatComponent/chatTrigger/index.tsx +++ b/src/frontend/src/components/chatComponent/chatTrigger/index.tsx @@ -19,7 +19,7 @@ export default function ChatTrigger({ open, setOpen, isBuilt }) { } return ( - - -
+ > +
{ if ( (event.key === "K" || event.key === "k") && - (event.metaKey || event.ctrlKey) && isBuilt + (event.metaKey || event.ctrlKey) && + isBuilt ) { event.preventDefault(); setOpen((oldState) => !oldState); diff --git a/src/frontend/src/components/ui/tabs.tsx b/src/frontend/src/components/ui/tabs.tsx index 7fe1914af..f58a5b68f 100644 --- a/src/frontend/src/components/ui/tabs.tsx +++ b/src/frontend/src/components/ui/tabs.tsx @@ -1,10 +1,10 @@ -"use client" +"use client"; -import * as React from "react" -import * as TabsPrimitive from "@radix-ui/react-tabs" -import { cn } from "../../utils" +import * as React from "react"; +import * as TabsPrimitive from "@radix-ui/react-tabs"; +import { cn } from "../../utils"; -const Tabs = TabsPrimitive.Root +const Tabs = TabsPrimitive.Root; const TabsList = React.forwardRef< React.ElementRef, @@ -18,8 +18,8 @@ const TabsList = React.forwardRef< )} {...props} /> -)) -TabsList.displayName = TabsPrimitive.List.displayName +)); +TabsList.displayName = TabsPrimitive.List.displayName; const TabsTrigger = React.forwardRef< React.ElementRef, @@ -33,8 +33,8 @@ const TabsTrigger = React.forwardRef< )} {...props} /> -)) -TabsTrigger.displayName = TabsPrimitive.Trigger.displayName +)); +TabsTrigger.displayName = TabsPrimitive.Trigger.displayName; const TabsContent = React.forwardRef< React.ElementRef, @@ -48,7 +48,7 @@ const TabsContent = React.forwardRef< )} {...props} /> -)) -TabsContent.displayName = TabsPrimitive.Content.displayName +)); +TabsContent.displayName = TabsPrimitive.Content.displayName; -export { Tabs, TabsList, TabsTrigger, TabsContent } +export { Tabs, TabsList, TabsTrigger, TabsContent }; diff --git a/src/frontend/src/contexts/SSEContext.tsx b/src/frontend/src/contexts/SSEContext.tsx index 26a2e4aaf..83b1d4c89 100644 --- a/src/frontend/src/contexts/SSEContext.tsx +++ b/src/frontend/src/contexts/SSEContext.tsx @@ -31,7 +31,9 @@ export function SSEProvider({ children }) { }, []); return ( - + {children} ); diff --git a/src/frontend/src/contexts/typesContext.tsx b/src/frontend/src/contexts/typesContext.tsx index 8db48fbf0..3179e582e 100644 --- a/src/frontend/src/contexts/typesContext.tsx +++ b/src/frontend/src/contexts/typesContext.tsx @@ -52,16 +52,20 @@ export function TypesProvider({ children }: { children: ReactNode }) { // Set the types by reducing over the keys of the result data and updating the accumulator. setTypes( // Reverse the keys so the tool world does not overlap - Object.keys(result.data).reverse().reduce((acc, curr) => { - Object.keys(result.data[curr]).forEach((c: keyof APIKindType) => { - acc[c] = curr; - // Add the base classes to the accumulator as well. - result.data[curr][c].base_classes?.forEach((b) => { - acc[b] = curr; - }); - }); - return acc; - }, {}) + Object.keys(result.data) + .reverse() + .reduce((acc, curr) => { + Object.keys(result.data[curr]).forEach( + (c: keyof APIKindType) => { + acc[c] = curr; + // Add the base classes to the accumulator as well. + result.data[curr][c].base_classes?.forEach((b) => { + acc[b] = curr; + }); + } + ); + return acc; + }, {}) ); } // Clear the interval if successful. diff --git a/src/frontend/src/modals/chatModal/index.tsx b/src/frontend/src/modals/chatModal/index.tsx index 429975470..bf87e4100 100644 --- a/src/frontend/src/modals/chatModal/index.tsx +++ b/src/frontend/src/modals/chatModal/index.tsx @@ -7,7 +7,7 @@ import { validateNodes } from "../../utils"; import { typesContext } from "../../contexts/typesContext"; import ChatMessage from "./chatMessage"; import { Eraser } from "lucide-react"; -import {X} from "lucide-react" +import { X } from "lucide-react"; import { sendAllProps } from "../../types/api"; import { ChatMessageType } from "../../types/chat"; import ChatInput from "./chatInput"; diff --git a/src/frontend/src/modals/flowSettingsModal/index.tsx b/src/frontend/src/modals/flowSettingsModal/index.tsx index 365911e12..3136dc1fe 100644 --- a/src/frontend/src/modals/flowSettingsModal/index.tsx +++ b/src/frontend/src/modals/flowSettingsModal/index.tsx @@ -22,7 +22,8 @@ export default function FlowSettingsModal() { const { closePopUp } = useContext(PopUpContext); const { setErrorData, setSuccessData } = useContext(alertContext); const ref = useRef(); - const { flows, tabId, updateFlow, setTabsState, saveFlow } = useContext(TabsContext); + const { flows, tabId, updateFlow, setTabsState, saveFlow } = + useContext(TabsContext); const maxLength = 50; const [name, setName] = useState(flows.find((f) => f.id === tabId).name); const [description, setDescription] = useState( @@ -36,8 +37,8 @@ export default function FlowSettingsModal() { }, 300); } } - function handleClick(){ - let savedFlow = flows.find((f) => f.id === tabId) + function handleClick() { + let savedFlow = flows.find((f) => f.id === tabId); savedFlow.name = name; savedFlow.description = description; saveFlow(savedFlow); @@ -67,10 +68,7 @@ export default function FlowSettingsModal() { /> - diff --git a/src/frontend/src/pages/CommunityPage/index.tsx b/src/frontend/src/pages/CommunityPage/index.tsx index dcb6f3fa8..d0bdc3536 100644 --- a/src/frontend/src/pages/CommunityPage/index.tsx +++ b/src/frontend/src/pages/CommunityPage/index.tsx @@ -44,7 +44,11 @@ export default function CommunityPage() { Community Examples
- +