: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
chore: Inline the switch user UX (#71432)
Luke Belton945b8f535a87
diff --git a/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.scss b/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.scssindex 114d8f4a72fb..0ab033057689 100644--- a/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.scss+++ b/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.scss@@ -162,6 +162,20 @@line-height: 1.5;color: var(--text-primary);}++ // The change-user menu trigger sits inline in the "Signed in as …" sentence,+ // so it reads as the (clickable) email rather than a standalone button.+ &__user-trigger.LemonButton {+ display: inline-flex;+ max-width: 100%;+ min-height: auto;+ padding: 0 0.25rem;+ font-size: inherit;+ font-weight: 600;+ vertical-align: baseline;+ border: 1px solid var(--color-border-warning);+ border-radius: var(--radius);+ }}@keyframes ImpersonationNotice__fadeScaleIn {diff --git a/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.tsx b/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.tsxindex 7624d90839ed..4b3f06d3753b 100644--- a/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.tsx+++ b/frontend/src/layout/navigation/ImpersonationNotice/ImpersonationNotice.tsx@@ -1,7 +1,7 @@import './ImpersonationNotice.scss'import { useActions, useValues } from 'kea'-import { useEffect, useRef, useState } from 'react'+import { useCallback, useEffect, useRef, useState } from 'react'import { IconChevronDown, IconCollapse, IconEllipsis, IconWarning } from '@posthog/icons'import { LemonButton, LemonCheckbox, LemonMenu, LemonTag, Tooltip } from '@posthog/lemon-ui'@@ -68,7 +68,7 @@ function CountDown({ datetime, callback }: { datetime: dayjs.Dayjs; callback?: (if (pastCountdown) {callback?.() // oxlint-disable-line react-hooks/exhaustive-deps}- }, [pastCountdown])+ }, [pastCountdown, callback])return <span className="tabular-nums text-warning">{countdown}</span>}@@ -173,7 +173,7 @@ function ImpersonationNoticeContent(): JSX.Element {onClick: () => setPendingUserId(member.user.id),}))- const handleSessionExpired = (): void => {+ const handleSessionExpired = useCallback((): void => {if (user) {setSessionExpired({email: user.email,@@ -182,12 +182,27 @@ function ImpersonationNoticeContent(): JSX.Element {reason: user.is_impersonated_reason ?? null,})}- }+ }, [user, setSessionExpired])return (<><p className="ImpersonationNotice__message">- Signed in as <span className="text-warning">{user?.email}</span>+ Signed in as{' '}+ <LemonMenu+ items={changeUserItems}+ onVisibilityChange={(visible) => visible && ensureAllMembersLoaded()}+ >+ <LemonButton+ size="xsmall"+ sideIcon={<IconChevronDown />}+ loading={isChangingUser}+ tooltip={`Currently impersonating ${user?.email} - click to switch user`}+ truncate+ className="ImpersonationNotice__user-trigger text-warning"+ >+ {user?.email}+ </LemonButton>+ </LemonMenu>{user?.organization?.name && (<>{' '}@@ -207,20 +222,6 @@ function ImpersonationNoticeContent(): JSX.Element {<LemonButton type="secondary" size="small" onClick={() => loadUser()} loading={userLoading}>Refresh</LemonButton>- <LemonMenu- items={changeUserItems}- onVisibilityChange={(visible) => visible && ensureAllMembersLoaded()}- >- <LemonButton- type="secondary"- size="small"- sideIcon={<IconChevronDown />}- loading={isChangingUser}- tooltip="Change user"- >- User- </LemonButton>- </LemonMenu><LemonButtontype="secondary"status="danger"