Skip to content

Commit

Permalink
feat(surveys): exclude users who have already seen survey wait period (
Browse files Browse the repository at this point in the history
…#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>
  • Loading branch information
liyiy and github-actions[bot] authored Aug 17, 2023
1 parent 4e53dc7 commit beec907
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 1 deletion.
Binary file modified frontend/__snapshots__/scenes-app-surveys--new-survey.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
44 changes: 43 additions & 1 deletion frontend/src/scenes/surveys/Survey.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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>
Expand Down

0 comments on commit beec907

Please sign in to comment.