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.

feat(dashboards): hide relaxed and wide tile density options (#124350)

Matt Puad3307a0c2072
diff --git a/frontend/src/scenes/dashboard/DashboardCustomizeSubMenu.tsx b/frontend/src/scenes/dashboard/DashboardCustomizeSubMenu.tsx
index b480f38557d7..b0449339ce91 100644
--- a/frontend/src/scenes/dashboard/DashboardCustomizeSubMenu.tsx
+++ b/frontend/src/scenes/dashboard/DashboardCustomizeSubMenu.tsx
@@ -16,6 +16,7 @@ import { DashboardTileSpacing, TileGroupDisplay } from '~/types'
import {
DASHBOARD_GRID_COMPACTION_LABELS,
DASHBOARD_TILE_SPACING_LABELS,
+ getTileSpacingChoices,
DashboardGridCompaction,
TILE_GROUP_DISPLAY_LABELS,
} from 'products/dashboards/frontend/dashboardCustomization'
@@ -58,7 +59,7 @@ export function DashboardCustomizeSubMenu(): JSX.Element | null {
value={dashboard.customization?.tile_spacing ?? 'standard'}
onValueChange={(value: unknown) => changeDashboardTileSpacing(value as DashboardTileSpacing)}
>
- {(Object.keys(DASHBOARD_TILE_SPACING_LABELS) as DashboardTileSpacing[]).map((spacing) => (
+ {getTileSpacingChoices(dashboard.customization?.tile_spacing ?? 'standard').map((spacing) => (
<SceneMenuBarRadioItem
key={spacing}
value={spacing}
diff --git a/products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu.tsx b/products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu.tsx
index 9a44711a3ca7..5a62129785a5 100644
--- a/products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu.tsx
+++ b/products/dashboards/frontend/components/DashboardCustomizeMenu/DashboardCustomizeMenu.tsx
@@ -10,20 +10,13 @@ import type { DashboardTileSpacing, TileGroupDisplay } from '~/types'
import {
DASHBOARD_GRID_COMPACTION_LABELS,
DASHBOARD_TILE_SPACING_LABELS,
+ getTileSpacingChoices,
DashboardGridCompaction,
type DashboardGridCompaction as DashboardGridCompactionType,
TILE_GROUP_DISPLAY_LABELS,
} from '../../dashboardCustomization'
import { DashboardTileMovementPreview } from './DashboardTileMovementPreview'
-const TILE_SPACING_OPTIONS: { value: DashboardTileSpacing; label: string }[] = [
- { value: 'tight', label: DASHBOARD_TILE_SPACING_LABELS.tight },
- { value: 'condensed', label: DASHBOARD_TILE_SPACING_LABELS.condensed },
- { value: 'standard', label: DASHBOARD_TILE_SPACING_LABELS.standard },
- { value: 'relaxed', label: DASHBOARD_TILE_SPACING_LABELS.relaxed },
- { value: 'wide', label: DASHBOARD_TILE_SPACING_LABELS.wide },
-]
-
const TILE_GROUP_DISPLAY_OPTIONS: { value: TileGroupDisplay; label: string }[] = [
{ value: 'sections', label: TILE_GROUP_DISPLAY_LABELS.sections },
{ value: 'tabs', label: TILE_GROUP_DISPLAY_LABELS.tabs },
@@ -77,7 +70,10 @@ export function DashboardCustomizeMenu(): JSX.Element | null {
<LemonRadio<DashboardTileSpacing>
value={tileSpacing}
onChange={changeDashboardTileSpacing}
- options={TILE_SPACING_OPTIONS}
+ options={getTileSpacingChoices(tileSpacing).map((value) => ({
+ value,
+ label: DASHBOARD_TILE_SPACING_LABELS[value],
+ }))}
orientation="horizontal"
className={layoutAvailable ? 'flex-1 flex-wrap gap-x-3 gap-y-1' : 'flex-wrap gap-x-3 gap-y-1'}
aria-label="Tile density"
diff --git a/products/dashboards/frontend/dashboardCustomization.ts b/products/dashboards/frontend/dashboardCustomization.ts
index 136183b14e42..ec90bdf8d6a0 100644
--- a/products/dashboards/frontend/dashboardCustomization.ts
+++ b/products/dashboards/frontend/dashboardCustomization.ts
@@ -28,6 +28,13 @@ export const DASHBOARD_TILE_SPACING_LABELS: Record<DashboardTileSpacing, string>
wide: 'Wide',
}
+const OFFERED_TILE_SPACINGS: DashboardTileSpacing[] = ['tight', 'condensed', 'standard']
+
+// Relaxed and wide are no longer offered, but dashboards already using one keep it and still see it checked
+export function getTileSpacingChoices(current: DashboardTileSpacing): DashboardTileSpacing[] {
+ return OFFERED_TILE_SPACINGS.includes(current) ? OFFERED_TILE_SPACINGS : [...OFFERED_TILE_SPACINGS, current]
+}
+
export const DASHBOARD_GRID_COMPACTION_LABELS: Record<DashboardGridCompaction, string> = {
[DashboardGridCompaction.Vertical]: 'Stack tiles upward',
[DashboardGridCompaction.Horizontal]: 'Stack tiles to the left',