From cb55c154e41f8393888d77ce52f701c7ca97b56e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Oberm=C3=BCller?= Date: Thu, 1 Aug 2024 15:33:57 +0200 Subject: [PATCH] feat(insights): keep rolling date range popover open (#24132) --- frontend/src/lib/components/DateFilter/DateFilter.tsx | 2 +- frontend/src/lib/components/DateFilter/dateFilterLogic.ts | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/frontend/src/lib/components/DateFilter/DateFilter.tsx b/frontend/src/lib/components/DateFilter/DateFilter.tsx index 0f10f199aeb61..e8597357d3e58 100644 --- a/frontend/src/lib/components/DateFilter/DateFilter.tsx +++ b/frontend/src/lib/components/DateFilter/DateFilter.tsx @@ -180,7 +180,7 @@ export function DateFilter({ dateRangeFilterLabel={isFixedDateMode ? 'Last' : undefined} selected={isRollingDateRange} onChange={(fromDate) => { - setDate(fromDate, '') + setDate(fromDate, '', true) }} makeLabel={makeLabel} popover={{ diff --git a/frontend/src/lib/components/DateFilter/dateFilterLogic.ts b/frontend/src/lib/components/DateFilter/dateFilterLogic.ts index 08d6b86b4425b..0a1f3680dbc1b 100644 --- a/frontend/src/lib/components/DateFilter/dateFilterLogic.ts +++ b/frontend/src/lib/components/DateFilter/dateFilterLogic.ts @@ -23,7 +23,11 @@ export const dateFilterLogic = kea([ openFixedDate: true, close: true, applyRange: true, - setDate: (dateFrom: string | null, dateTo: string | null) => ({ dateFrom, dateTo }), + setDate: (dateFrom: string | null, dateTo: string | null, keepPopoverOpen = false) => ({ + dateFrom, + dateTo, + keepPopoverOpen, + }), setRangeDateFrom: (range: Dayjs | null) => ({ range }), setRangeDateTo: (range: Dayjs | null) => ({ range }), }), @@ -44,7 +48,7 @@ export const dateFilterLogic = kea([ openFixedRange: () => true, openDateToNow: () => true, openFixedDate: () => true, - setDate: () => false, + setDate: (_, { keepPopoverOpen }) => keepPopoverOpen, close: () => false, }, ],