diff --git a/src/frontend/src/modals/templatesModal/components/TemplateCardComponent/index.tsx b/src/frontend/src/modals/templatesModal/components/TemplateCardComponent/index.tsx index 93b5bfa2f2d4..7bb54f4b1d81 100644 --- a/src/frontend/src/modals/templatesModal/components/TemplateCardComponent/index.tsx +++ b/src/frontend/src/modals/templatesModal/components/TemplateCardComponent/index.tsx @@ -1,5 +1,6 @@ import { convertTestName } from "@/components/storeCardComponent/utils/convert-test-name"; -import { BG_NOISE, flowGradients } from "@/utils/styleUtils"; +import { swatchColors } from "@/utils/styleUtils"; +import { cn } from "@/utils/utils"; import IconComponent, { ForwardedIconComponent, } from "../../../../components/genericIconComponent"; @@ -9,10 +10,11 @@ export default function TemplateCardComponent({ example, onClick, }: TemplateCardComponentProps) { - const directionIndex = - (example.gradient && example.gradient.split(",").length == 1 - ? example.gradient.length - : example.name.length) % flowGradients.length; + const swatchIndex = + (example.gradient && parseInt(example.gradient) + ? parseInt(example.gradient) + : (example.gradient?.length ?? example.name.length)) % + swatchColors.length; const handleKeyDown = (e) => { if (e.key === "Enter" || e.key === " ") { @@ -21,13 +23,6 @@ export default function TemplateCardComponent({ } }; - const bgGradient = - BG_NOISE + - "," + - (example.gradient && example.gradient.split(",").length > 1 - ? "linear-gradient(90deg, " + example.gradient + ")" - : flowGradients[directionIndex]); - return (
-
+
diff --git a/src/frontend/src/pages/MainPage/components/grid/index.tsx b/src/frontend/src/pages/MainPage/components/grid/index.tsx index 84d938280357..7a6f7d5f47c9 100644 --- a/src/frontend/src/pages/MainPage/components/grid/index.tsx +++ b/src/frontend/src/pages/MainPage/components/grid/index.tsx @@ -14,6 +14,8 @@ import useAlertStore from "@/stores/alertStore"; import useFlowsManagerStore from "@/stores/flowsManagerStore"; import { FlowType } from "@/types/flow"; import { getInputsAndOutputs } from "@/utils/storeUtils"; +import { swatchColors } from "@/utils/styleUtils"; +import { cn } from "@/utils/utils"; import { useState } from "react"; import { useParams } from "react-router-dom"; import useDescriptionModal from "../../oldComponents/componentsComponent/hooks/use-description-modal"; @@ -99,6 +101,12 @@ const GridComponent = ({ flowData }: { flowData: FlowType }) => { const { onDragStart } = useDragStart(flowData); + const swatchIndex = + (flowData.gradient && parseInt(flowData.gradient) + ? parseInt(flowData.gradient) + : (flowData.gradient?.length ?? flowData.name.length)) % + swatchColors.length; + return ( <> { }`} >
-
+