Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(desktop): show project switcher on consent screen (#89913)

Adam Leith2b12232f7bef
diff --git a/products/desktop/packages/ui/src/features/consent/ConsentScreen.test.tsx b/products/desktop/packages/ui/src/features/consent/ConsentScreen.test.tsx
new file mode 100644
index 000000000000..87cbf53d1c66
--- /dev/null
+++ b/products/desktop/packages/ui/src/features/consent/ConsentScreen.test.tsx
@@ -0,0 +1,52 @@
+import { render, screen } from "@testing-library/react";
+import type { ReactNode } from "react";
+import { describe, expect, it, vi } from "vitest";
+
+vi.mock("react-hotkeys-hook", () => ({ useHotkeys: vi.fn() }));
+
+vi.mock("@posthog/ui/features/auth/useAuthMutations", () => ({
+ useLogoutMutation: () => ({ isPending: false, mutate: vi.fn() }),
+}));
+
+vi.mock("@posthog/ui/features/auth/useOrgRole", () => ({
+ useIsOrgAdmin: () => ({ isAdmin: false }),
+}));
+
+vi.mock("@posthog/ui/features/settings/SettingsDialog", () => ({
+ openSettingsDialog: vi.fn(),
+}));
+
+vi.mock("@posthog/ui/features/sidebar/components/ProjectSwitcher", () => ({
+ ProjectSwitcher: () => <button type="button">Example project</button>,
+}));
+
+vi.mock("@posthog/ui/primitives/FullScreenLayout", () => ({
+ FullScreenLayout: ({ children }: { children: ReactNode }) => children,
+}));
+
+vi.mock("./ConsentPanel", () => ({
+ ConsentPanel: () => <div>Consent requirements</div>,
+}));
+
+vi.mock("./useOrgConsent", () => ({
+ useOrgConsent: () => ({
+ status: "resolved",
+ organizationId: "org-id",
+ needsAiConsent: false,
+ needsBetaTerms: true,
+ satisfied: false,
+ }),
+}));
+
+import { ConsentScreen } from "./ConsentScreen";
+
+describe("ConsentScreen", () => {
+ it("keeps the selected project switcher available while consent blocks the app", () => {
+ render(<ConsentScreen />);
+
+ expect(
+ screen.getByRole("button", { name: "Example project" }),
+ ).toBeVisible();
+ expect(screen.getByText("Consent requirements")).toBeVisible();
+ });
+});
diff --git a/products/desktop/packages/ui/src/features/consent/ConsentScreen.tsx b/products/desktop/packages/ui/src/features/consent/ConsentScreen.tsx
index ee53d9159ee1..519300c7a960 100644
--- a/products/desktop/packages/ui/src/features/consent/ConsentScreen.tsx
+++ b/products/desktop/packages/ui/src/features/consent/ConsentScreen.tsx
@@ -4,6 +4,7 @@ import { useLogoutMutation } from "@posthog/ui/features/auth/useAuthMutations";
import { useIsOrgAdmin } from "@posthog/ui/features/auth/useOrgRole";
import { SHORTCUTS } from "@posthog/ui/features/command/keyboard-shortcuts";
import { openSettingsDialog } from "@posthog/ui/features/settings/SettingsDialog";
+import { ProjectSwitcher } from "@posthog/ui/features/sidebar/components/ProjectSwitcher";
import { FullScreenLayout } from "@posthog/ui/primitives/FullScreenLayout";
import type { ReactNode } from "react";
import { useHotkeys } from "react-hotkeys-hook";
@@ -62,12 +63,19 @@ export function ConsentScreen({
return (
<>
<FullScreenLayout footerLeft={footerLeft} footerRight={footerRight}>
- <div className="flex h-full items-center justify-center overflow-y-auto px-8 py-16">
- {consent.status === "error" ? (
- <ConsentErrorContent onRetry={consent.retry} />
- ) : consent.status === "resolved" ? (
- <ConsentPanel consent={consent} isAdmin={isAdmin === true} />
- ) : null}
+ <div className="flex h-full flex-col overflow-y-auto px-8 pt-12 pb-16">
+ <div className="flex shrink-0 justify-end">
+ <div className="w-64 max-w-full">
+ <ProjectSwitcher />
+ </div>
+ </div>
+ <div className="flex min-h-0 flex-1 items-center justify-center py-8">
+ {consent.status === "error" ? (
+ <ConsentErrorContent onRetry={consent.retry} />
+ ) : consent.status === "resolved" ? (
+ <ConsentPanel consent={consent} isAdmin={isAdmin === true} />
+ ) : null}
+ </div>
</div>
</FullScreenLayout>
{settingsDialog}