Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
SKY-10586: modernize OSS sidebar to match cloud (#6300)
Suchintana36824b82663
diff --git a/skyvern-frontend/src/routes/root/SideNav.test.tsx b/skyvern-frontend/src/routes/root/SideNav.test.tsxindex 187753a45..0e8ffa022 100644--- a/skyvern-frontend/src/routes/root/SideNav.test.tsx+++ b/skyvern-frontend/src/routes/root/SideNav.test.tsx@@ -5,8 +5,16 @@ import { afterEach, describe, expect, it, vi } from "vitest";import { SideNav } from "./SideNav";import { useSidebarStore } from "@/store/SidebarStore";+const capture = vi.fn();const mutate = vi.fn();+vi.mock("posthog-js/react", () => ({+ useFeatureFlagEnabled: () => false,+ usePostHog: () => ({+ capture,+ }),+}));+vi.mock("@/routes/workflows/hooks/useCreateWorkflowMutation", () => ({useCreateWorkflowMutation: () => ({isPending: false,@@ -29,6 +37,7 @@ describe("SideNav", () => {useSidebarStore.setState({ collapsed: false });setViewportHeight(1024);mutate.mockClear();+ capture.mockClear();});it("creates a new agent from the sidebar", () => {@@ -52,6 +61,53 @@ describe("SideNav", () => {);});+ it("captures recipe clicks with the legacy sidebar agent event", () => {+ window.localStorage.clear();+ setViewportHeight(1024);++ render(+ <MemoryRouter>+ <SideNav />+ </MemoryRouter>,+ );++ fireEvent.click(screen.getByRole("link", { name: "Healthcare" }));++ expect(capture).toHaveBeenCalledWith("sidebar.agent.clicked", {+ agent: "healthcare",+ destination: "/recipes/healthcare",+ disabled: false,+ beta: true,+ badge: "Beta",+ });+ });++ it("captures recipe clicks from the collapsed sidebar menu", async () => {+ useSidebarStore.setState({ collapsed: true });++ render(+ <MemoryRouter>+ <SideNav />+ </MemoryRouter>,+ );++ fireEvent.pointerDown(screen.getByTitle("Recipes"), {+ button: 0,+ ctrlKey: false,+ });+ fireEvent.click(+ await screen.findByRole("menuitem", { name: "Healthcare" }),+ );++ expect(capture).toHaveBeenCalledWith("sidebar.agent.clicked", {+ agent: "healthcare",+ destination: "/recipes/healthcare",+ disabled: false,+ beta: true,+ badge: "Beta",+ });+ });+it("starts recipes collapsed on short screens", () => {window.localStorage.clear();setViewportHeight(860);diff --git a/skyvern-frontend/src/routes/root/SideNav.tsx b/skyvern-frontend/src/routes/root/SideNav.tsxindex 84bcda84d..16d923502 100644--- a/skyvern-frontend/src/routes/root/SideNav.tsx+++ b/skyvern-frontend/src/routes/root/SideNav.tsx@@ -35,6 +35,20 @@ import {import { defaultWorkflowRequest } from "@/routes/workflows/defaultWorkflowRequest";import { useCreateWorkflowMutation } from "@/routes/workflows/hooks/useCreateWorkflowMutation";import { shouldDefaultRecipesOpen } from "./sidebarDefaults";+import { usePostHog } from "posthog-js/react";++const recipeAnalyticsByPath: Record<string, { beta: boolean; badge?: string }> =+ {+ "/recipes/healthcare": { beta: true, badge: "Beta" },+ "/recipes/government": { beta: true, badge: "Beta" },+ "/recipes/invoices": { beta: true, badge: "Beta" },+ "/recipes/insurance": { beta: true, badge: "Beta" },+ "/recipes/purchasing": { beta: true, badge: "Beta" },+ "/recipes/crm": { beta: true, badge: "Beta" },+ "/recipes/logistics": { beta: true, badge: "Beta" },+ "/recipes/contact-forms": { beta: true, badge: "Beta" },+ "/recipes/job-apps": { beta: true, badge: "Beta" },+ };type Props = {collapsed?: boolean;@@ -42,6 +56,19 @@ type Props = {function SideNav({ collapsed }: Props = {}) {const createWorkflowMutation = useCreateWorkflowMutation();+ const postHog = usePostHog();+ const captureRecipeClick = (label: string, to: string) => {+ const analytics = recipeAnalyticsByPath[to] ?? { beta: false };+ postHog?.capture("sidebar.agent.clicked", {+ agent: label+ .toLowerCase()+ .replace(/[^a-z0-9]+/g, "-")+ .replace(/^-|-$/g, ""),+ destination: to,+ disabled: false,+ ...analytics,+ });+ };const navItems: Array<SidebarNavItem> = [{label: "Home",@@ -99,46 +126,59 @@ function SideNav({ collapsed }: Props = {}) {{label: "Healthcare",to: "/recipes/healthcare",+ onClick: () =>+ captureRecipeClick("Healthcare", "/recipes/healthcare"),icon: <HospitalIcon className="size-3.5" />,},{label: "Government",to: "/recipes/government",+ onClick: () =>+ captureRecipeClick("Government", "/recipes/government"),icon: <GovernmentIcon className="size-3.5" />,},{label: "Invoices",to: "/recipes/invoices",+ onClick: () => captureRecipeClick("Invoices", "/recipes/invoices"),icon: <ReceiptIcon className="size-3.5" />,},{label: "Insurance",to: "/recipes/insurance",+ onClick: () => captureRecipeClick("Insurance", "/recipes/insurance"),icon: <DocumentIcon className="size-3.5" />,},{label: "Purchasing",to: "/recipes/purchasing",+ onClick: () =>+ captureRecipeClick("Purchasing", "/recipes/purchasing"),icon: <BagIcon className="size-3.5" />,},{label: "CRM",to: "/recipes/crm",+ onClick: () => captureRecipeClick("CRM", "/recipes/crm"),icon: <Share1Icon className="size-3.5" />,},{label: "Logistics",to: "/recipes/logistics",+ onClick: () => captureRecipeClick("Logistics", "/recipes/logistics"),icon: <LogisticsIcon className="size-3.5" />,},{label: "Contact Forms",to: "/recipes/contact-forms",+ onClick: () =>+ captureRecipeClick("Contact Forms", "/recipes/contact-forms"),icon: <ReaderIcon className="size-3.5" />,},{label: "Job Apps",to: "/recipes/job-apps",+ onClick: () => captureRecipeClick("Job Apps", "/recipes/job-apps"),icon: <InboxIcon className="size-3.5" />,},],diff --git a/skyvern-frontend/src/routes/root/Sidebar.tsx b/skyvern-frontend/src/routes/root/Sidebar.tsxindex 30a07fb64..2ce1633c7 100644--- a/skyvern-frontend/src/routes/root/Sidebar.tsx+++ b/skyvern-frontend/src/routes/root/Sidebar.tsx@@ -8,7 +8,7 @@ function Sidebar() {return (<asideclassName={cn(- "fixed hidden h-screen min-h-screen border-r border-neutral-200 bg-neutral-50 dark:border-white/[0.06] dark:bg-background lg:block",+ "fixed hidden h-screen max-h-screen min-h-screen overflow-y-auto overflow-x-hidden border-r border-neutral-200 bg-neutral-50 dark:border-white/[0.06] dark:bg-background lg:block",{"w-60": !collapsed,"w-16": collapsed,