diff --git a/src/frontend/package-lock.json b/src/frontend/package-lock.json index f150e6b429d..db0e15228cd 100644 --- a/src/frontend/package-lock.json +++ b/src/frontend/package-lock.json @@ -1079,7 +1079,6 @@ }, "node_modules/@clack/prompts/node_modules/is-unicode-supported": { "version": "1.3.0", - "extraneous": true, "inBundle": true, "license": "MIT", "engines": { diff --git a/src/frontend/src/App.tsx b/src/frontend/src/App.tsx index ddccd55ccee..9423ce55f23 100644 --- a/src/frontend/src/App.tsx +++ b/src/frontend/src/App.tsx @@ -1,6 +1,7 @@ import { useContext, useEffect } from "react"; import { Cookies } from "react-cookie"; import { ErrorBoundary } from "react-error-boundary"; +import { Outlet } from "react-router-dom"; import "reactflow/dist/style.css"; import "./App.css"; import AlertDisplayArea from "./alerts/displayArea"; @@ -22,7 +23,6 @@ import { useGetHealthQuery } from "./controllers/API/queries/health"; import { useGetVersionQuery } from "./controllers/API/queries/version"; import { setupAxiosDefaults } from "./controllers/API/utils"; import useTrackLastVisitedPath from "./hooks/use-track-last-visited-path"; -import Router from "./routes"; import useAlertStore from "./stores/alertStore"; import useAuthStore from "./stores/authStore"; import { useDarkStore } from "./stores/darkStore"; @@ -172,8 +172,7 @@ export default function App() { > - - +
diff --git a/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx b/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx index 6c18e6b0bfa..d3992035f75 100644 --- a/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/components/OutputComponent/index.tsx @@ -1,17 +1,5 @@ -import { cloneDeep } from "lodash"; -import { useUpdateNodeInternals } from "reactflow"; -import ForwardedIconComponent from "../../../../components/genericIconComponent"; import ShadTooltip from "../../../../components/shadTooltipComponent"; -import { Button } from "../../../../components/ui/button"; -import { - DropdownMenu, - DropdownMenuContent, - DropdownMenuItem, - DropdownMenuTrigger, -} from "../../../../components/ui/dropdown-menu"; -import useFlowStore from "../../../../stores/flowStore"; import { outputComponentType } from "../../../../types/components"; -import { NodeDataType } from "../../../../types/flow"; import { cn } from "../../../../utils/utils"; export default function OutputComponent({ @@ -23,9 +11,6 @@ export default function OutputComponent({ name, proxy, }: outputComponentType) { - const setNode = useFlowStore((state) => state.setNode); - const updateNodeInternals = useUpdateNodeInternals(); - const displayProxy = (children) => { if (proxy) { return ( diff --git a/src/frontend/src/CustomNodes/GenericNode/index.tsx b/src/frontend/src/CustomNodes/GenericNode/index.tsx index e0a582d445c..09dd6f6a4e2 100644 --- a/src/frontend/src/CustomNodes/GenericNode/index.tsx +++ b/src/frontend/src/CustomNodes/GenericNode/index.tsx @@ -289,7 +289,6 @@ export default function GenericNode({ function handlePlayWShortcut() { if (buildStatus === BuildStatus.BUILDING || isBuilding || !selected) return; setValidationStatus(null); - console.log(data.node?.display_name); buildFlow({ stopNodeId: data.id }); } diff --git a/src/frontend/src/components/authSettingsGuard/index.tsx b/src/frontend/src/components/authSettingsGuard/index.tsx new file mode 100644 index 00000000000..90bf63dd93c --- /dev/null +++ b/src/frontend/src/components/authSettingsGuard/index.tsx @@ -0,0 +1,19 @@ +import FeatureFlags from "@/../feature-config.json"; +import useAuthStore from "@/stores/authStore"; +import { useStoreStore } from "@/stores/storeStore"; +import { Navigate } from "react-router-dom"; + +export const AuthSettingsGuard = ({ children }) => { + const autoLogin = useAuthStore((state) => state.autoLogin); + const hasStore = useStoreStore((state) => state.hasStore); + + // Hides the General settings if there is nothing to show + const showGeneralSettings = + FeatureFlags.ENABLE_PROFILE_ICONS || hasStore || !autoLogin; + + if (showGeneralSettings) { + return children; + } else { + return ; + } +}; diff --git a/src/frontend/src/components/cardComponent/hooks/use-playground-effect.tsx b/src/frontend/src/components/cardComponent/hooks/use-playground-effect.tsx deleted file mode 100644 index e9236e98be1..00000000000 --- a/src/frontend/src/components/cardComponent/hooks/use-playground-effect.tsx +++ /dev/null @@ -1,27 +0,0 @@ -import { useEffect } from "react"; -import { FlowType } from "../../../types/flow"; - -const usePlaygroundEffect = ( - currentFlowId: string, - playground: boolean, - openPlayground: boolean, - currentFlow: FlowType | undefined, - setNodes: (value: any, value2: boolean) => void, - setEdges: (value: any, value2: boolean) => void, - cleanFlowPool: () => void, -) => { - useEffect(() => { - if (currentFlowId && playground) { - if (openPlayground) { - setNodes(currentFlow?.data?.nodes ?? [], true); - setEdges(currentFlow?.data?.edges ?? [], true); - } else { - setNodes([], true); - setEdges([], true); - } - cleanFlowPool(); - } - }, [openPlayground]); -}; - -export default usePlaygroundEffect; diff --git a/src/frontend/src/components/cardComponent/index.tsx b/src/frontend/src/components/cardComponent/index.tsx index 0e6af1f35f2..c36aef2913d 100644 --- a/src/frontend/src/components/cardComponent/index.tsx +++ b/src/frontend/src/components/cardComponent/index.tsx @@ -1,12 +1,10 @@ import { usePostLikeComponent } from "@/controllers/API/queries/store"; -import { useEffect, useState } from "react"; -import { createRoot } from "react-dom/client"; +import { useState } from "react"; import { Control } from "react-hook-form"; -import { getComponent, postLikeComponent } from "../../controllers/API"; +import { getComponent } from "../../controllers/API"; import IOModal from "../../modals/IOModal"; import DeleteConfirmationModal from "../../modals/deleteConfirmationModal"; import useAlertStore from "../../stores/alertStore"; -import useFlowStore from "../../stores/flowStore"; import useFlowsManagerStore from "../../stores/flowsManagerStore"; import { useStoreStore } from "../../stores/storeStore"; import { FlowType } from "../../types/flow"; @@ -31,7 +29,6 @@ import Loading from "../ui/loading"; import useDataEffect from "./hooks/use-data-effect"; import useInstallComponent from "./hooks/use-handle-install"; import useDragStart from "./hooks/use-on-drag-start"; -import usePlaygroundEffect from "./hooks/use-playground-effect"; import { convertTestName } from "./utils/convert-test-name"; export default function CollectionCardComponent({ @@ -56,7 +53,6 @@ export default function CollectionCardComponent({ const setSuccessData = useAlertStore((state) => state.setSuccessData); const setErrorData = useAlertStore((state) => state.setErrorData); const setValidApiKey = useStoreStore((state) => state.updateValidApiKey); - const cleanFlowPool = useFlowStore((state) => state.CleanFlowPool); const isStore = false; const [loading, setLoading] = useState(false); const [likedByUser, setLikedByUser] = useState(data?.liked_by_user ?? false); @@ -64,16 +60,9 @@ export default function CollectionCardComponent({ const [downloadsCount, setDownloadsCount] = useState( data?.downloads_count ?? 0, ); - const currentFlow = useFlowsManagerStore((state) => state.currentFlow); const setCurrentFlow = useFlowsManagerStore((state) => state.setCurrentFlow); const getFlowById = useFlowsManagerStore((state) => state.getFlowById); - const currentFlowId = useFlowsManagerStore((state) => state.currentFlowId); - const setNodes = useFlowStore((state) => state.setNodes); - const setEdges = useFlowStore((state) => state.setEdges); const [openPlayground, setOpenPlayground] = useState(false); - const setCurrentFlowId = useFlowsManagerStore( - (state) => state.setCurrentFlowId, - ); const [loadingPlayground, setLoadingPlayground] = useState(false); const selectedFlowsComponentsCards = useFlowsManagerStore( @@ -96,16 +85,6 @@ export default function CollectionCardComponent({ return inputs.length > 0 || outputs.length > 0; } - usePlaygroundEffect( - currentFlowId, - playground!, - openPlayground, - currentFlow, - setNodes, - setEdges, - cleanFlowPool, - ); - useDataEffect(data, setLikedByUser, setLikesCount, setDownloadsCount); const { handleInstall } = useInstallComponent( @@ -317,7 +296,7 @@ export default function CollectionCardComponent({ setLoadingPlayground(false); return; } - setCurrentFlowId(data.id); + setCurrentFlow(flow); setOpenPlayground(true); setLoadingPlayground(false); } else { @@ -473,7 +452,7 @@ export default function CollectionCardComponent({ setLoadingPlayground(false); return; } - setCurrentFlowId(data.id); + setCurrentFlow(flow); setOpenPlayground(true); setLoadingPlayground(false); } else { @@ -510,6 +489,7 @@ export default function CollectionCardComponent({ {openPlayground && ( state.hasStore); const validApiKey = useStoreStore((state) => state.validApiKey); const hasApiKey = useStoreStore((state) => state.hasApiKey); - const currentFlow = useFlowsManagerStore((state) => state.currentFlow); - - const prevNodesRef = useRef(); + const currentFlow = useFlowStore((state) => state.currentFlow); const ModalMemo = useMemo( () => ( diff --git a/src/frontend/src/components/codeTabsComponent/index.tsx b/src/frontend/src/components/codeTabsComponent/index.tsx index 239a3117e0c..f17afa61571 100644 --- a/src/frontend/src/components/codeTabsComponent/index.tsx +++ b/src/frontend/src/components/codeTabsComponent/index.tsx @@ -86,6 +86,7 @@ export default function CodeTabsComponent({ }} id="tweaks-switch" onCheckedChange={setActiveTweaks} + checked={activeTweaks} autoFocus={false} />