-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(surveys): some small UI polishing for the survey form editor #22496
Changes from 5 commits
7cb5e66
a32af1c
72ce118
6eb0d16
db3c989
3c40b0b
52c286a
de1daa3
4194950
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -86,7 +86,7 @@ export function SurveyForm({ id }: { id: string }): JSX.Element { | |
<LemonDivider /> | ||
<SurveyEdit /> | ||
<LemonDivider /> | ||
<SurveyReleaseSummary id={id} survey={survey} targetingFlagFilters={targetingFlagFilters} /> | ||
<SurveyDisplaySummary id={id} survey={survey} targetingFlagFilters={targetingFlagFilters} /> | ||
<LemonDivider /> | ||
<div className="flex items-center gap-2 justify-end"> | ||
<LemonButton | ||
|
@@ -112,7 +112,7 @@ export function SurveyForm({ id }: { id: string }): JSX.Element { | |
) | ||
} | ||
|
||
export function SurveyReleaseSummary({ | ||
export function SurveyDisplaySummary({ | ||
id, | ||
survey, | ||
targetingFlagFilters, | ||
|
@@ -121,11 +121,16 @@ export function SurveyReleaseSummary({ | |
survey: Survey | NewSurvey | ||
targetingFlagFilters?: FeatureFlagFilters | ||
}): JSX.Element { | ||
const hasConditions = survey.conditions?.url || survey.conditions?.selector | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For a bonus, would be cool if we can add a line for the wait period here as well, since technically if wait period is set it may not show to everyone. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ooh, great context! Will add. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It also requires adding a bit of text, right now I think when wait period is set the summary shows up empty 😅 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. oh man, I'm so sorry I missed that. Out of character for me; I should've double-checked. Here's a fix: #22532 |
||
const hasFeatureFlags = survey.linked_flag_id || targetingFlagFilters | ||
|
||
return ( | ||
<div className="flex flex-col mt-2 gap-2"> | ||
<div className="font-semibold">Release conditions summary</div> | ||
<div className="font-semibold">Display conditions summary</div> | ||
<span className="text-muted"> | ||
By default surveys will be released to everyone unless targeting options are set. | ||
{hasConditions || hasFeatureFlags | ||
? 'Surveys will be displayed to users that match the following conditions:' | ||
: 'Surveys will be displayed to everyone.'} | ||
</span> | ||
{survey.conditions?.url && ( | ||
<div className="flex flex-col font-medium gap-1"> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -486,7 +486,10 @@ export default function SurveyEdit(): JSX.Element { | |
placeholder="ex: .className or #id" | ||
/> | ||
</LemonField.Pure> | ||
<LemonField.Pure label="Survey wait period"> | ||
<LemonField.Pure | ||
label="Survey wait period" | ||
info="Note that this condition will only apply to one browser for a given non-anonymous user. If the user switches browsers or uses an incognito session, they could see this survey again." | ||
> | ||
Comment on lines
+491
to
+492
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I kinda just fired from the hip on this copy, open to suggestions if folks have any. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a bug [well, the same user identity switching browsers bit] 😅 , @Phanatic we found yet another candidate for the With a different anonymous user, absolutely makes sense. |
||
<div className="flex flex-row gap-2 items-center"> | ||
<LemonCheckbox | ||
checked={!!value?.seenSurveyWaitPeriodInDays} | ||
|
@@ -507,11 +510,10 @@ export default function SurveyEdit(): JSX.Element { | |
} | ||
}} | ||
/> | ||
Do not display this survey to users who have already | ||
seen a survey in the last | ||
Don't show to users who saw a survey within the last | ||
<LemonInput | ||
type="number" | ||
size="small" | ||
size="xsmall" | ||
min={0} | ||
value={value?.seenSurveyWaitPeriodInDays || NaN} | ||
onChange={(val) => { | ||
|
@@ -527,7 +529,7 @@ export default function SurveyEdit(): JSX.Element { | |
}) | ||
} | ||
}} | ||
className="w-16" | ||
className="w-12" | ||
/>{' '} | ||
days. | ||
</div> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -67,6 +67,7 @@ export const defaultSurveyFieldValues = { | |
scale: 10, | ||
lowerBoundLabel: 'Unlikely', | ||
upperBoundLabel: 'Very likely', | ||
buttonText: 'Submit', | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this was the fix for issue (3) from the description; we just missed a default. |
||
}, | ||
], | ||
appearance: { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
renamed this since it felt more accurate to reflect the new name of the header.