Skip to content

Commit

Permalink
Enhance
Browse files Browse the repository at this point in the history
  • Loading branch information
webjunkie committed Aug 8, 2024
1 parent 7fa35bb commit 4512c2c
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 3 additions & 0 deletions frontend/src/queries/schema.json
Original file line number Diff line number Diff line change
Expand Up @@ -8124,6 +8124,9 @@
"additionalProperties": false,
"description": "`RetentionFilterType` minus everything inherited from `FilterType`",
"properties": {
"cumulative": {
"type": "boolean"
},
"period": {
"$ref": "#/definitions/RetentionPeriod"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LemonCheckbox } from '@posthog/lemon-ui'
import { LemonSwitch } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
Expand All @@ -16,12 +16,12 @@ export function RetentionCumulativeCheckbox(): JSX.Element | null {
}

return (
<LemonCheckbox
<LemonSwitch
onChange={(cumulative: boolean) => {
updateInsightFilter({ cumulative })
}}
checked={cumulativeRetention}
label={<span className="font-normal">Cumulative retention</span>}
label={<span className="font-normal">Rolling retention</span>}
bordered
size="small"
/>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { LemonCheckbox } from '@posthog/lemon-ui'
import { LemonSwitch } from '@posthog/lemon-ui'
import { useActions, useValues } from 'kea'
import { insightLogic } from 'scenes/insights/insightLogic'
import { insightVizDataLogic } from 'scenes/insights/insightVizDataLogic'
Expand All @@ -16,7 +16,7 @@ export function RetentionMeanCheckbox(): JSX.Element | null {
}

return (
<LemonCheckbox
<LemonSwitch
onChange={(showMean: boolean) => {
updateInsightFilter({ showMean })
}}
Expand Down
1 change: 1 addition & 0 deletions frontend/src/scenes/insights/utils/cleanFilters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ export function cleanFilters(
breakdown_type: filters.breakdown_type,
retention_reference: filters.retention_reference,
show_mean: filters.show_mean,
cumulative: filters.cumulative,
total_intervals: Math.min(Math.max(filters.total_intervals ?? 11, 0), 100),
...(filters.aggregation_group_type_index != undefined
? { aggregation_group_type_index: filters.aggregation_group_type_index }
Expand Down
1 change: 1 addition & 0 deletions posthog/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -3097,6 +3097,7 @@ class RetentionFilterLegacy(BaseModel):
model_config = ConfigDict(
extra="forbid",
)
cumulative: Optional[bool] = None
period: Optional[RetentionPeriod] = None
retention_reference: Optional[RetentionReference] = None
retention_type: Optional[RetentionType] = None
Expand Down

0 comments on commit 4512c2c

Please sign in to comment.