Skip to content

Commit 5c527da

Browse files
authored
feat: add VariablesButton component to workflow layout (#1837)
- Introduced a new VariablesButton component that opens a sidebar for variable management. - Integrated the Braces icon from lucide-react for visual representation. - Ensured the VariablesButton is rendered within the WorkflowStateProvider for proper context access.
1 parent fe7b3b3 commit 5c527da

File tree

1 file changed

+18
-1
lines changed
  • apps/atoms/src/app/dashboard/agents/[id]/(workflow-editor)/workflow

1 file changed

+18
-1
lines changed

apps/atoms/src/app/dashboard/agents/[id]/(workflow-editor)/workflow/layout.tsx

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
"use client";
22

3-
import { Loader2, Lock } from "lucide-react";
3+
import { Braces, Loader2, Lock } from "lucide-react";
44
import { useRouter } from "next/navigation";
55
import React, { Suspense } from "react";
66
import { ReactFlowProvider } from "reactflow";
@@ -10,9 +10,25 @@ import ProtectedRoute from "@/components/ProtectedRoutes";
1010
import WorkflowSidebar from "@/components/Workflow/WorkflowSidebar";
1111
import { AgentContextProvider, useAgent } from "@/contexts/AgentContext";
1212
import { WorkflowStateProvider } from "@/contexts/workflow/workflow";
13+
import useSidebar from "@/hooks/workflow/useSidebar";
1314

1415
import { Button } from "@repo/ui/button";
1516

17+
// Variables button component - needs to be inside WorkflowStateProvider to access useSidebar
18+
const VariablesButton = () => {
19+
const { onOpen } = useSidebar();
20+
21+
return (
22+
<Button
23+
onClick={() => onOpen("variables")}
24+
variant="outline"
25+
className="fixed right-4 top-20 z-40 gap-2 bg-white shadow-sm">
26+
<Braces className="h-4 w-4" />
27+
<span>Variables</span>
28+
</Button>
29+
);
30+
};
31+
1632
const WorkflowContent = ({ children }: { children: React.ReactNode }) => {
1733
const { agent } = useAgent();
1834

@@ -31,6 +47,7 @@ const WorkflowContent = ({ children }: { children: React.ReactNode }) => {
3147
<div className="relative">
3248
{children}
3349
<WorkflowSidebar />
50+
<VariablesButton />
3451
<LockOverlay />
3552
</div>
3653
</WorkflowStateProvider>

0 commit comments

Comments
 (0)