Skip to content

Commit

Permalink
restrict the date options in the UI
Browse files Browse the repository at this point in the history
  • Loading branch information
pauldambra committed Apr 24, 2024
1 parent 9b7d376 commit 1ddcce1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion frontend/src/toolbar/stats/HeatmapToolbarMenu.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,12 @@ export const HeatmapToolbarMenu = (): JSX.Element => {
} = useActions(heatmapLogic)
const { setHighlightElement, setSelectedElement } = useActions(elementsLogic)

// some of the date options we allow in insights don't apply to heatmaps
// let's filter the list down
const dateItemDenyList = ['Last 180 days', 'This month', 'Previous month', 'Year to date', 'All time']

const dateItems = dateMapping
.filter((dm) => dm.key !== CUSTOM_OPTION_KEY)
.filter((dm) => dm.key !== CUSTOM_OPTION_KEY && !dateItemDenyList.includes(dm.key))
.map((dateOption) => ({
label: dateOption.key,
onClick: () => setCommonFilters({ date_from: dateOption.values[0], date_to: dateOption.values[1] }),
Expand Down

0 comments on commit 1ddcce1

Please sign in to comment.