0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00

feat(surveys): exclude users who have already seen survey wait period (#17064)

* add condition value for wait period

* do not allow for wait periods under 1 day

* Update UI snapshots for `chromium` (1)

* Update UI snapshots for `chromium` (2)

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
Li Yi Yu 2023-08-17 15:14:24 -04:00 committed by GitHub
parent 4e53dc74b7
commit beec9074d4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 43 additions and 1 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 62 KiB

After

Width:  |  Height:  |  Size: 67 KiB

View File

@ -4,7 +4,15 @@ import { BindLogic, useActions, useValues } from 'kea'
import { Form, Group } from 'kea-forms'
import { PageHeader } from 'lib/components/PageHeader'
import { LemonSkeleton } from 'lib/lemon-ui/LemonSkeleton'
import { LemonButton, LemonDivider, LemonInput, LemonSelect, LemonTextArea, Link } from '@posthog/lemon-ui'
import {
LemonButton,
LemonCheckbox,
LemonDivider,
LemonInput,
LemonSelect,
LemonTextArea,
Link,
} from '@posthog/lemon-ui'
import { router } from 'kea-router'
import { urls } from 'scenes/urls'
import { Field, PureField } from 'lib/forms/Field'
@ -290,6 +298,40 @@ export function SurveyForm({ id }: { id: string }): JSX.Element {
placeholder="ex: .className or #id"
/>
</PureField>
<PureField label="Survey wait period">
<div className="flex flex-row gap-2 items-center">
<LemonCheckbox
checked={!!value?.seenSurveyWaitPeriodInDays}
onChange={(checked) => {
if (checked) {
onChange({
...value,
seenSurveyWaitPeriodInDays:
value?.seenSurveyWaitPeriodInDays || 30,
})
} else {
const { seenSurveyWaitPeriodInDays, ...rest } = value || {}
onChange(rest)
}
}}
/>
Do not display this survey to users who have already seen a survey in the
last
<LemonInput
type="number"
size="small"
min={0}
value={value?.seenSurveyWaitPeriodInDays}
onChange={(val) => {
if (val !== undefined && val > 0) {
onChange({ ...value, seenSurveyWaitPeriodInDays: val })
}
}}
className="w-16"
/>{' '}
days.
</div>
</PureField>
</>
)}
</Field>