AutoGPT is the vision of accessible AI for everyone, to use and to build on. Our mission is to provide the tools, so that you can focus on what matters.
fix(frontend): hide new app sidebar on unauthenticated platform pages (#13479)
Abhimanyu Yadavfbe1d0dfd53c
diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.tsindex 154370e833..65a8be7934 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/__tests__/usePlatformChrome.test.ts@@ -62,6 +62,23 @@ describe("usePlatformChrome", () => {});});+ it.each([+ "/reset-password",+ "/auth/auth-code-error",+ "/error",+ "/unauthorized",+ ])(+ "excludes the unauthenticated %s route from the new layout",+ async (route) => {+ pathnameMock.mockReturnValue(route);+ const { result } = renderHook(() => usePlatformChrome());++ await waitFor(() => {+ expect(result.current.showNewLayout).toBe(false);+ });+ },+ );+it("passes the flag enum to useGetFlag", async () => {renderHook(() => usePlatformChrome());await waitFor(() => {diff --git a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.tsindex 5daa993fa5..c78bfd677e 100644--- a/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts+++ b/autogpt_platform/frontend/src/app/(platform)/PlatformChrome/usePlatformChrome.ts@@ -4,9 +4,16 @@ import { useEffect, useState } from "react";import { Flag, useGetFlag } from "@/services/feature-flags/use-get-flag";// Routes that must stay outside the new top-level sidebar layout. Login,-// signup and onboarding already live in the (no-navbar) group, so settings-// is the only (platform) route to exclude here.-const NEW_LAYOUT_EXCLUDED_PREFIXES = ["/settings"];+// signup and onboarding already live in the (no-navbar) group. These+// (platform) routes should not show the app sidebar — reset-password and the+// auth/error/unauthorized pages are all reachable while unauthenticated.+const NEW_LAYOUT_EXCLUDED_PREFIXES = [+ "/settings",+ "/reset-password",+ "/auth/auth-code-error",+ "/error",+ "/unauthorized",+];export function usePlatformChrome() {const pathname = usePathname();