Skip to content

πŸ™Œ OpenHands: AI-Driven Development

Remove Beta label from Browser tab (#5484)

Rohit Malhotraa482182a9e4d
diff --git a/frontend/__tests__/components/browser.test.tsx b/frontend/__tests__/components/browser.test.tsx
index eea2eb910a..8fb7e0a310 100644
--- a/frontend/__tests__/components/browser.test.tsx
+++ b/frontend/__tests__/components/browser.test.tsx
@@ -11,6 +11,7 @@ describe("Browser", () => {
browser: {
url: "https://example.com",
screenshotSrc: "",
+ updateCount: 0,
},
},
});
@@ -26,6 +27,7 @@ describe("Browser", () => {
url: "https://example.com",
screenshotSrc:
"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAEAAAABCAYAAAAfFcSJAAAADUlEQVR42mN0uGvyHwAFCAJS091fQwAAAABJRU5ErkJggg==",
+ updateCount: 0,
},
},
});
diff --git a/frontend/src/components/layout/container.tsx b/frontend/src/components/layout/container.tsx
index 91433b2762..f2dcb39a3f 100644
--- a/frontend/src/components/layout/container.tsx
+++ b/frontend/src/components/layout/container.tsx
@@ -5,7 +5,7 @@ import { NavTab } from "./nav-tab";
interface ContainerProps {
label?: string;
labels?: {
- label: string;
+ label: string | React.ReactNode;
to: string;
icon?: React.ReactNode;
isBeta?: boolean;
diff --git a/frontend/src/components/layout/count-badge.tsx b/frontend/src/components/layout/count-badge.tsx
new file mode 100644
index 0000000000..359ae3b71a
--- /dev/null
+++ b/frontend/src/components/layout/count-badge.tsx
@@ -0,0 +1,7 @@
+export function CountBadge({ count }: { count: number }) {
+ return (
+ <span className="text-[11px] leading-5 text-root-primary bg-neutral-400 px-1 rounded-xl">
+ {count}
+ </span>
+ );
+}
diff --git a/frontend/src/components/layout/nav-tab.tsx b/frontend/src/components/layout/nav-tab.tsx
index 930a543771..a9f363e395 100644
--- a/frontend/src/components/layout/nav-tab.tsx
+++ b/frontend/src/components/layout/nav-tab.tsx
@@ -4,7 +4,7 @@ import { BetaBadge } from "./beta-badge";
interface NavTabProps {
to: string;
- label: string;
+ label: string | React.ReactNode;
icon: React.ReactNode;
isBeta?: boolean;
}
diff --git a/frontend/src/routes/_oh.app/route.tsx b/frontend/src/routes/_oh.app/route.tsx
index 43c9f63c05..8541ec45cc 100644
--- a/frontend/src/routes/_oh.app/route.tsx
+++ b/frontend/src/routes/_oh.app/route.tsx
@@ -21,6 +21,7 @@ import { useUserPrefs } from "#/context/user-prefs-context";
import { useConversationConfig } from "#/hooks/query/use-conversation-config";
import { Container } from "#/components/layout/container";
import Security from "#/components/shared/modals/security/security";
+import { CountBadge } from "#/components/layout/count-badge";
function App() {
const { token, gitHubToken } = useAuth();
@@ -33,6 +34,8 @@ function App() {
(state: RootState) => state.initalQuery,
);
+ const { updateCount } = useSelector((state: RootState) => state.browser);
+
const { data: latestGitHubCommit } = useLatestRepoCommit({
repository: selectedRepository,
});
@@ -81,10 +84,14 @@ function App() {
{ label: "Workspace", to: "", icon: <CodeIcon /> },
{ label: "Jupyter", to: "jupyter", icon: <ListIcon /> },
{
- label: "Browser",
+ label: (
+ <div className="flex items-center gap-1">
+ Browser
+ {updateCount > 0 && <CountBadge count={updateCount} />}
+ </div>
+ ),
to: "browser",
icon: <GlobeIcon />,
- isBeta: true,
},
]}
>
diff --git a/frontend/src/state/browser-slice.ts b/frontend/src/state/browser-slice.ts
index fc05f0c508..7276f3577a 100644
--- a/frontend/src/state/browser-slice.ts
+++ b/frontend/src/state/browser-slice.ts
@@ -5,6 +5,8 @@ export const initialState = {
url: "https://github.com/All-Hands-AI/OpenHands",
// Base64-encoded screenshot of browser window (placeholder for now, will be replaced with the actual screenshot later)
screenshotSrc: "",
+ // Counter for browser updates
+ updateCount: 0,
};
export const browserSlice = createSlice({
@@ -16,6 +18,7 @@ export const browserSlice = createSlice({
},
setScreenshotSrc: (state, action) => {
state.screenshotSrc = action.payload;
+ state.updateCount += 1;
},
},
});