From ba4b8e21f4ecd70f30b8dc24458f56a4fe84eca5 Mon Sep 17 00:00:00 2001 From: David Hill <1879069+iamdavidhill@users.noreply.github.com> Date: Mon, 20 Jul 2026 03:22:48 +0100 Subject: [PATCH] feat(app): toggle debug tools from dev badge (#36689) Co-authored-by: LukeParkerDev <10430890+Hona@users.noreply.github.com> --- packages/app/src/components/titlebar.tsx | 27 ++++++++++++++++++------ packages/app/src/pages/layout-new.tsx | 13 ++++++++++-- packages/app/src/pages/layout.tsx | 12 +++++++++-- 3 files changed, 42 insertions(+), 10 deletions(-) diff --git a/packages/app/src/components/titlebar.tsx b/packages/app/src/components/titlebar.tsx index 1a2a8a81b6..4578656107 100644 --- a/packages/app/src/components/titlebar.tsx +++ b/packages/app/src/components/titlebar.tsx @@ -67,7 +67,7 @@ export function useTitlebarRightMount() { return mount } -export function Titlebar(props: { update?: TitlebarUpdate }) { +export function Titlebar(props: { update?: TitlebarUpdate; debugTools?: { visible: boolean; toggle: () => void } }) { const layout = useLayout() const platform = usePlatform() const command = useCommand() @@ -462,7 +462,7 @@ export function Titlebar(props: { update?: TitlebarUpdate }) { "md:pl-4": !mac(), }} > - + @@ -660,9 +660,9 @@ export function Titlebar(props: { update?: TitlebarUpdate }) {
-
+ @@ -747,12 +747,27 @@ function TitlebarUpdateIconButton(props: { state: TitlebarUpdatePillState }) { ) } -function ChannelIndicator() { +function ChannelIndicator(props: { debugTools?: { visible: boolean; toggle: () => void } }) { + const channel = import.meta.env.VITE_OPENCODE_CHANNEL + if (channel === "dev" && props.debugTools) { + return ( + + ) + } + return ( <> - {["beta", "dev"].includes(import.meta.env.VITE_OPENCODE_CHANNEL) && ( + {["beta", "dev"].includes(channel) && (
- {import.meta.env.VITE_OPENCODE_CHANNEL.toUpperCase()} + {channel.toUpperCase()}
)} diff --git a/packages/app/src/pages/layout-new.tsx b/packages/app/src/pages/layout-new.tsx index fd0df68d27..c6fed8f6d5 100644 --- a/packages/app/src/pages/layout-new.tsx +++ b/packages/app/src/pages/layout-new.tsx @@ -1,4 +1,5 @@ import { createEffect, Suspense, type ParentProps } from "solid-js" +import { createStore } from "solid-js/store" import { useNavigate } from "@solidjs/router" import { DebugBar } from "@/components/debug-bar" import { TabsInfoPopup } from "@/components/help-button" @@ -11,6 +12,7 @@ export default function NewLayout(props: ParentProps) { const platform = usePlatform() const navigate = useNavigate() setNavigate(navigate) + const [state, setState] = createStore({ debugTools: true }) createEffect(() => setV2Toast(true)) @@ -32,11 +34,18 @@ export default function NewLayout(props: ParentProps) { "padding-bottom": "env(safe-area-inset-bottom, 0px)", }} > - + setState("debugTools", (value) => !value) } + : undefined + } + />
{props.children}
- {import.meta.env.DEV && } + {import.meta.env.DEV && state.debugTools && } diff --git a/packages/app/src/pages/layout.tsx b/packages/app/src/pages/layout.tsx index 545eee827a..812a479b20 100644 --- a/packages/app/src/pages/layout.tsx +++ b/packages/app/src/pages/layout.tsx @@ -156,6 +156,7 @@ export default function LegacyLayout(props: ParentProps) { sizing: false, peek: undefined as string | undefined, peeked: false, + debugTools: true, }) const updateVersion = () => { @@ -2248,7 +2249,14 @@ export default function LegacyLayout(props: ParentProps) { return (
{autoselecting() ?? ""} - + setState("debugTools", (value) => !value) } + : undefined + } + /> @@ -2393,7 +2401,7 @@ export default function LegacyLayout(props: ParentProps) {
- {import.meta.env.DEV && import.meta.env.VITE_DISABLE_DEBUG_BAR !== "1" && } + {import.meta.env.DEV && import.meta.env.VITE_DISABLE_DEBUG_BAR !== "1" && state.debugTools && }