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.

refactor(dashboards): segment unsaved filter actions (#105388)

Matt Pua2e246c917bdc
diff --git a/frontend/snapshots.yml b/frontend/snapshots.yml
index 5e6f25ff6a04..501d024e887e 100644
--- a/frontend/snapshots.yml
+++ b/frontend/snapshots.yml
@@ -6089,13 +6089,13 @@ snapshots:
products-dashboards-dashboard-widgets-widgetcard--locked--light:
hash: v1.k794b7964.5b137c02f2365806484425bc25fe4c896fc99edbac07caff03503ed3222da251._dt53kAV0UsgvHveL2zwjSHjc2D-p2LO9mZunqv7f5c
products-dashboards-filter-bar--filter-bar--dark:
- hash: v1.k794b7964.3e359ae2789f6fe48dc466b11edfe41b10518ae0d3f4312a29ffede40561fec2.R-hbmu9T9335KUf--XuCkZADUv8EQNFm9tVTN5pj3QI
+ hash: v1.k794b7964.c8ac30798ea4aad54feee2f8de1031683b044cab3a876f536e7084ceebadc930.ZezQg8sHgmlhn8M1WDLqiNqgusFV-Qu-9fWyCiYlZuk
products-dashboards-filter-bar--filter-bar--light:
- hash: v1.k794b7964.a6a8399a1a401981b01e8e557a587bb82fc0989ce02aeae2cbb49a089d7513cf.HHOpDzXqVV3rFxGuB4-puIDQwV16GN6VY7u5pIVUe7k
+ hash: v1.k794b7964.b9ef249357a7d52df7d20cf89f4bcb4674913d1c0f74c04e5be339109761d7d7.PXWSxNitk7sErRUV2IrSMFPN4a1LPk61JdIzCXICbME
products-dashboards-filter-bar--unsaved-changes-popover--dark:
- hash: v1.k794b7964.4106fa5842ea42b9e7da0fff67a5e521a482211f16a704e27908ef9b7aaaa990.ALtMI0hIBMTlNfGdQR12at_eXuEDwYMwn7RIb6jZ0RU
+ hash: v1.k794b7964.cd0763f5b062ec767b6efa099e841b62de1f9a3a4dfdb0bf6c24f6c03ab18e91.kJlKCUFvGXQpWFE1iKqZW5d02nl2ciyHueEC_MeT0MM
products-dashboards-filter-bar--unsaved-changes-popover--light:
- hash: v1.k794b7964.50eb814e6a44f0bb8956a12ad4cd68663b1723b4948389e04e918b8dbaddde23.fdkQTJhzuxWCziSIvvwa-nQc8220y9-AJw9K5g99ct0
+ hash: v1.k794b7964.d76d6e64be7751440cabed822a47f9b113e3c12aa7edc1d4d087171f7a48aa5d.Evf7PgkLMcvli_EU2xrytkIty8G9Djw41eiXgsmY_KQ
products-dashboards-saved-views-manage--default--dark:
hash: v1.k794b7964.5a3fc6cafb3bfa5752b3707e93dd12027d95b7d5db139448c4431e84c64e5af6.uC3oT8cgBWIvwkXeqy_yiNtuoH3JxOhrSxR2bdhxzHw
products-dashboards-saved-views-manage--default--light:
diff --git a/products/dashboards/frontend/dashboardSettings/DashboardUnsavedChangesIndicator.tsx b/products/dashboards/frontend/dashboardSettings/DashboardUnsavedChangesIndicator.tsx
index 4b02bd2ea192..6c228d96fbdf 100644
--- a/products/dashboards/frontend/dashboardSettings/DashboardUnsavedChangesIndicator.tsx
+++ b/products/dashboards/frontend/dashboardSettings/DashboardUnsavedChangesIndicator.tsx
@@ -1,5 +1,4 @@
import { useActions, useValues } from 'kea'
-import { Fragment } from 'react'
import { IconInfo } from '@posthog/icons'
import { LemonButton, LemonMenu } from '@posthog/lemon-ui'
@@ -68,14 +67,13 @@ export function DashboardUnsavedChangesIndicator(): JSX.Element | null {
return (
<span
data-attr="dashboard-filters-unsaved"
- className="flex max-w-full items-center gap-1.5 rounded-full border border-warning bg-warning-highlight py-0.5 pl-2.5 pr-1 text-xs font-semibold text-warning"
+ className="flex max-w-full items-center rounded border border-warning bg-warning-highlight text-xs font-semibold text-warning"
>
<DashboardSettingsChangesTooltip changes={dashboardSettingsChanges} title="Unsaved changes">
<LemonButton
type="tertiary"
size="small"
- noPadding
- className="text-inherit"
+ className="rounded-l text-inherit"
aria-label={`Show ${changeSummary}`}
>
<span className="flex items-center gap-1.5">
@@ -88,26 +86,22 @@ export function DashboardUnsavedChangesIndicator(): JSX.Element | null {
</span>
</LemonButton>
</DashboardSettingsChangesTooltip>
- <span className="flex items-center gap-1.5 @max-lg/dashboard-filters:hidden">
- <span className="h-4 border-l border-warning" />
- <span className="flex items-center gap-1.5">
- {actions.map((action, index) => (
- <Fragment key={action.key}>
- {index > 0 && <span className="h-4 border-l border-warning" />}
- <LemonButton
- data-attr={action.dataAttr}
- type="tertiary"
- size="small"
- disabledReason={action.disabledReason}
- tooltip={action.tooltip}
- onClick={action.onClick}
- loading={action.loading}
- >
- {action.label}
- </LemonButton>
- </Fragment>
- ))}
- </span>
+ <span className="flex items-center @max-lg/dashboard-filters:hidden">
+ {actions.map((action, index) => (
+ <LemonButton
+ key={action.key}
+ data-attr={action.dataAttr}
+ type="tertiary"
+ size="small"
+ className={`border-l border-warning ${index === actions.length - 1 ? 'rounded-r' : 'rounded-none'}`}
+ disabledReason={action.disabledReason}
+ tooltip={action.tooltip}
+ onClick={action.onClick}
+ loading={action.loading}
+ >
+ {action.label}
+ </LemonButton>
+ ))}
</span>
<LemonMenu
items={actions.map((action) => ({
@@ -121,7 +115,7 @@ export function DashboardUnsavedChangesIndicator(): JSX.Element | null {
placement="bottom-end"
>
<LemonButton
- className="@min-lg/dashboard-filters:hidden"
+ className="@min-lg/dashboard-filters:hidden rounded-r border-l border-warning"
type="tertiary"
size="small"
loading={dashboardFiltersSaving}