-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: Add UI to control human friendly comparison periods
You can now toggle that in the UI on `settings/environment-product-analytics#human-friendly-comparison-periods`
- Loading branch information
1 parent
5a2ab1c
commit a298ea9
Showing
5 changed files
with
41 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
frontend/src/scenes/settings/environment/HumanFriendlyComparisonPeriodsSetting.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { LemonSwitch } from '@posthog/lemon-ui' | ||
import { useActions, useValues } from 'kea' | ||
import { teamLogic } from 'scenes/teamLogic' | ||
|
||
export function HumanFriendlyComparisonPeriodsSetting(): JSX.Element { | ||
const { updateCurrentTeam } = useActions(teamLogic) | ||
const { currentTeam, currentTeamLoading } = useValues(teamLogic) | ||
|
||
return ( | ||
<> | ||
<p> | ||
When comparing against a previous month or year, PostHog will use the same start and end dates as the | ||
current period by default. It might be desirable, however, to compare against the same day of the week | ||
instead of the same day to account for weekend seasonality. If that's the case for your analysis, you | ||
can enable this setting. | ||
</p> | ||
<p> | ||
In practice, this means that an year comparison becomes a 52 week comparison, and a month comparison | ||
becomes a 4 week comparison. | ||
</p> | ||
<LemonSwitch | ||
onChange={(checked) => { | ||
updateCurrentTeam({ human_friendly_comparison_periods: checked }) | ||
}} | ||
checked={!!currentTeam?.human_friendly_comparison_periods} | ||
disabled={currentTeamLoading} | ||
label="Use human friendly comparison periods" | ||
bordered | ||
/> | ||
</> | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters