Fix pinning issue and improve code structure

This commit is contained in:
anovazzi1 2024-01-24 15:00:49 -03:00
commit 7352ec9a16
4 changed files with 15 additions and 19 deletions

View file

@ -330,7 +330,7 @@ export default function GenericNode({
node: { node: {
...old.data.node, ...old.data.node,
pinned: old.data?.node?.pinned ? false : true, pinned: old.data?.node?.pinned ? false : true,
} },
}, },
})); }));
}} }}
@ -340,9 +340,7 @@ export default function GenericNode({
name={"Pin"} name={"Pin"}
className={cn( className={cn(
"h-5 fill-transparent stroke-chat-trigger stroke-2 transition-all", "h-5 fill-transparent stroke-chat-trigger stroke-2 transition-all",
pinned ?? false pinned ?? false ? "animate-wiggle fill-chat-trigger" : ""
? "animate-wiggle fill-chat-trigger"
: ""
)} )}
/> />
</div> </div>

View file

@ -1,12 +1,10 @@
import { Transition } from "@headlessui/react"; import { Transition } from "@headlessui/react";
import { useState } from "react"; import { useState } from "react";
import Loading from "../../../components/ui/loading"; import Loading from "../../../components/ui/loading";
import { postBuildInit } from "../../../controllers/API";
import { FlowType } from "../../../types/flow"; import { FlowType } from "../../../types/flow";
import useAlertStore from "../../../stores/alertStore"; import useAlertStore from "../../../stores/alertStore";
import useFlowStore from "../../../stores/flowStore"; import useFlowStore from "../../../stores/flowStore";
import { parsedDataType } from "../../../types/components";
import { validateNodes } from "../../../utils/reactflowUtils"; import { validateNodes } from "../../../utils/reactflowUtils";
import RadialProgressComponent from "../../RadialProgress"; import RadialProgressComponent from "../../RadialProgress";
import IconComponent from "../../genericIconComponent"; import IconComponent from "../../genericIconComponent";
@ -46,7 +44,6 @@ export default function BuildTrigger({
const startTime = Date.now(); const startTime = Date.now();
setIsBuilding(true); setIsBuilding(true);
await enforceMinimumLoadingTime(startTime, minimumLoadingTime); await enforceMinimumLoadingTime(startTime, minimumLoadingTime);
} catch (error) { } catch (error) {
console.error("Error:", error); console.error("Error:", error);
@ -55,7 +52,6 @@ export default function BuildTrigger({
} }
} }
const checkInputAndOutput = useFlowStore( const checkInputAndOutput = useFlowStore(
(state) => state.checkInputAndOutput (state) => state.checkInputAndOutput
); );
@ -83,7 +79,13 @@ export default function BuildTrigger({
leaveFrom="translate-y-0" leaveFrom="translate-y-0"
leaveTo="translate-y-96" leaveTo="translate-y-96"
> >
<div className={checkInputAndOutput() ? "fixed bottom-20 right-4" : "fixed bottom-4 right-4"}> <div
className={
checkInputAndOutput()
? "fixed bottom-20 right-4"
: "fixed bottom-4 right-4"
}
>
<div <div
className={`${eventClick} round-button-form`} className={`${eventClick} round-button-form`}
onClick={() => { onClick={() => {

View file

@ -279,15 +279,11 @@ export default function ExtraSidebar(): JSX.Element {
<div className="side-bar-button"> <div className="side-bar-button">
{currentFlow && currentFlow.data && ( {currentFlow && currentFlow.data && (
<ApiModal flow={currentFlow}> <ApiModal flow={currentFlow}>
<button <button className={"w-full "}>
className={"w-full "}
>
<div className={classNames("extra-side-bar-buttons")}> <div className={classNames("extra-side-bar-buttons")}>
<IconComponent <IconComponent
name="Code2" name="Code2"
className={ className={"side-bar-button-size"}
"side-bar-button-size"
}
/> />
</div> </div>
</button> </button>

View file

@ -30,12 +30,12 @@ module.exports = {
extend: { extend: {
keyframes: { keyframes: {
wiggle: { wiggle: {
'0%, 100%': { transform: 'scale(100%)' }, "0%, 100%": { transform: "scale(100%)" },
'50%': { transform: 'scale(120%)' }, "50%": { transform: "scale(120%)" },
} },
}, },
animation: { animation: {
wiggle: 'wiggle 150ms ease-in-out 1', wiggle: "wiggle 150ms ease-in-out 1",
}, },
colors: { colors: {
"component-icon": "var(--component-icon)", "component-icon": "var(--component-icon)",