Automate browser based workflows with AI
Python aiapiautomationbrowserbrowser-automationcomputergptllmplaywrightpowerautomatepuppeteerpythonrpaseleniumvisionworkflow
Add URL-based tab navigation to browser session page (#4848)
Suchintan6d9e24cb927a
diff --git a/skyvern-frontend/src/router.tsx b/skyvern-frontend/src/router.tsxindex a15d0a2e1..9e527b788 100644--- a/skyvern-frontend/src/router.tsx+++ b/skyvern-frontend/src/router.tsx@@ -35,6 +35,11 @@ const router = createBrowserRouter([{path: "browser-session/:browserSessionId",element: <BrowserSession />,+ children: [+ { index: true, element: <Navigate to="stream" replace /> },+ { path: "stream", element: <></> },+ { path: "recordings", element: <></> },+ ],},{path: "/",diff --git a/skyvern-frontend/src/routes/browserSessions/BrowserSession.tsx b/skyvern-frontend/src/routes/browserSessions/BrowserSession.tsxindex de1cd3ddc..abf4fffea 100644--- a/skyvern-frontend/src/routes/browserSessions/BrowserSession.tsx+++ b/skyvern-frontend/src/routes/browserSessions/BrowserSession.tsx@@ -1,6 +1,6 @@import { ReloadIcon, StopIcon } from "@radix-ui/react-icons";import { useState } from "react";-import { useParams } from "react-router-dom";+import { Outlet, useLocation, useParams } from "react-router-dom";import { useQuery } from "@tanstack/react-query";import { getClient } from "@/api/AxiosClient";@@ -17,7 +17,7 @@ import {} from "@/components/ui/dialog";import { BrowserStream } from "@/components/BrowserStream";import { LogoMinimized } from "@/components/LogoMinimized";-import { SwitchBar } from "@/components/SwitchBar";+import { SwitchBarNavigation } from "@/components/SwitchBarNavigation";import { Toaster } from "@/components/ui/toaster";import { useCredentialGetter } from "@/hooks/useCredentialGetter";import { useCloseBrowserSessionMutation } from "@/routes/browserSessions/hooks/useCloseBrowserSessionMutation";@@ -26,11 +26,12 @@ import { type BrowserSession as BrowserSessionType } from "@/routes/workflows/tyimport { BrowserSessionVideo } from "./BrowserSessionVideo";-type TabName = "stream" | "videos";-function BrowserSession() {const { browserSessionId } = useParams();- const [activeTab, setActiveTab] = useState<TabName>("stream");+ const location = useLocation();+ const activeTab = location.pathname.endsWith("/recordings")+ ? "recordings"+ : "stream";const [isDialogOpen, setIsDialogOpen] = useState(false);const credentialGetter = useCredentialGetter();@@ -128,21 +129,10 @@ function BrowserSession() {{/* Tab Navigation */}<div className="flex w-full items-center justify-start gap-2">- <SwitchBar- className="border-none"- onChange={(value) => setActiveTab(value as TabName)}- value={activeTab}+ <SwitchBarNavigationoptions={[- {- label: "Stream",- value: "stream",- helpText: "The live stream of the browser session (if active).",- },- {- label: "Recordings",- value: "videos",- helpText: "All recordings of this browser session.",- },+ { label: "Stream", to: "stream" },+ { label: "Recordings", to: "recordings" },]}/>@@ -203,14 +193,15 @@ function BrowserSession() {<divclassName="h-full w-full"style={{- visibility: activeTab === "videos" ? "visible" : "hidden",- pointerEvents: activeTab === "videos" ? "auto" : "none",+ visibility: activeTab === "recordings" ? "visible" : "hidden",+ pointerEvents: activeTab === "recordings" ? "auto" : "none",}}><BrowserSessionVideo /></div></div></div>+ <Outlet /><Toaster /></div>);