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(web-analytics): Fix mobile design for the new web analytics dashboard (#60279)

Jordan Mryyand8102f984f45
diff --git a/frontend/src/lib/components/FilterBar.tsx b/frontend/src/lib/components/FilterBar.tsx
index 3cfc8382330a..a94f5918248d 100644
--- a/frontend/src/lib/components/FilterBar.tsx
+++ b/frontend/src/lib/components/FilterBar.tsx
@@ -24,7 +24,12 @@ export const FilterBar = ({ top, left, right, className, showBorderBottom }: Fil
<div className="flex flex-col md:flex-row md:justify-between gap-2">
<div className={clsx('flex items-start shrink-0', !right && 'flex-1')}>
<div className="flex flex-1 flex-row gap-2 items-center">
- <div className={clsx('flex flex-row gap-1 items-center flex-1', right && 'md:flex-none')}>
+ <div
+ className={clsx(
+ 'flex flex-row flex-wrap gap-1 items-center flex-1',
+ right && 'md:flex-none'
+ )}
+ >
{left}
</div>
diff --git a/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx b/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
index c07a4fa9603f..018761b2e95e 100644
--- a/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
+++ b/frontend/src/scenes/web-analytics/WebAnalyticsDashboard.tsx
@@ -77,7 +77,8 @@ export const Tiles = (props: { tiles?: WebAnalyticsTile[]; compact?: boolean }):
return (
<div
className={clsx(
- 'mt-4 grid grid-cols-1 md:grid-cols-2 2xl:grid-cols-3',
+ 'mt-4 grid grid-cols-1',
+ useTileHeaderV2 ? 'lg:grid-cols-2 2xl:grid-cols-3' : 'md:grid-cols-2 2xl:grid-cols-3',
useTileHeaderV2 && '2xl:grid-flow-dense',
compact ? 'gap-x-2 gap-y-2' : 'gap-x-4 gap-y-4'
)}
diff --git a/frontend/src/scenes/web-analytics/WebTileHeader.tsx b/frontend/src/scenes/web-analytics/WebTileHeader.tsx
index 1636905aed8f..2c27ca56a952 100644
--- a/frontend/src/scenes/web-analytics/WebTileHeader.tsx
+++ b/frontend/src/scenes/web-analytics/WebTileHeader.tsx
@@ -1,6 +1,7 @@
import { IconChevronDown, IconEllipsis, IconLineGraph } from '@posthog/icons'
import { LemonButton, LemonMenu, LemonMenuItem, LemonSelectOptionLeaf } from '@posthog/lemon-ui'
+import { useWindowSize } from 'lib/hooks/useWindowSize'
import { IconOpenInNew, IconTableChart } from 'lib/lemon-ui/icons'
import { TileId, TileVisualizationOption } from './common'
@@ -42,11 +43,11 @@ function TitleDropdown({ tileId, dropdown }: { tileId: TileId; dropdown: Dropdow
<LemonMenu items={items} placement="bottom-start">
<button
type="button"
- className="inline-flex items-center gap-1 m-0 p-0 bg-transparent border-0 cursor-pointer text-base font-semibold text-current hover:text-accent underline decoration-dotted decoration-from-font underline-offset-4"
+ className="inline-flex items-center gap-1 m-0 p-0 bg-transparent border-0 cursor-pointer text-base font-semibold text-current hover:text-accent underline decoration-dotted decoration-from-font underline-offset-4 min-w-0 max-w-full"
data-attr={`web-analytics-title-dropdown-${tileId}`}
>
- <span>{currentLabel}</span>
- <IconChevronDown className="text-lg" />
+ <span className="truncate">{currentLabel}</span>
+ <IconChevronDown className="text-lg shrink-0" />
</button>
</LemonMenu>
)
@@ -63,11 +64,13 @@ export function WebTileHeader({
openInsight,
overflowMenuItems,
}: WebTileHeaderProps): JSX.Element {
+ const { isWindowLessThan } = useWindowSize()
+ const isCompactHeader = isWindowLessThan('lg')
const isGraph = visualizationToggle?.value === 'graph'
const titleNode =
titleDropdown || title || docs ? (
- <h2 className="flex-1 m-0 flex flex-row items-center gap-1.5 text-base font-semibold">
- {titlePrefix && <span>{titlePrefix}</span>}
+ <h2 className="flex-1 min-w-0 m-0 flex flex-row items-center gap-1.5 text-base font-semibold">
+ {titlePrefix && <span className="shrink-0">{titlePrefix}</span>}
{titleDropdown ? (
<TitleDropdown tileId={tileId} dropdown={titleDropdown} />
) : (
@@ -80,12 +83,12 @@ export function WebTileHeader({
)
return (
- <div className="flex flex-row items-center self-stretch gap-2 min-h-10 px-3 py-2">
+ <div className="flex flex-row items-center self-stretch gap-1 sm:gap-2 min-h-10 px-3 py-2">
{titleNode}
{intervalSelector && (
<span className="flex items-center gap-1">
- <span className="text-secondary text-xs">Interval</span>
+ <span className="text-secondary text-xs hidden lg:inline">Interval</span>
{intervalSelector.node}
</span>
)}
@@ -111,7 +114,7 @@ export function WebTileHeader({
onClick={openInsight.onClick}
data-attr={`web-analytics-open-insight-${tileId}`}
>
- Open as insight
+ {isCompactHeader ? undefined : 'Open as insight'}
</LemonButton>
)}