Skip to content

Commit 7d8b5c0

Browse files
authored
feat(product tours): add device type targeting (#48253)
## Problem closes #48218 (comment) sdk pr PostHog/posthog-js#3113 <!-- Who are we building for, what are their needs, why is this important? --> <!-- Does this fix an issue? Uncomment the line below with the issue ID to automatically close it when merged --> <!-- Closes #ISSUE_ID --> ## Changes <!-- If there are frontend changes, please include screenshots. --> <!-- If a reference design was involved, include a link to the relevant Figma frame! --> ## How did you test this code? <!-- Briefly describe the steps you took. --> <!-- Include automated tests if possible, otherwise describe the manual testing routine. --> <!-- Docs reminder: If this change requires updated docs, please do that! Engineers are the primary people responsible for their documentation. 🙌 --> 👉 _Stay up-to-date with_ [_PostHog coding conventions_](https://posthog.com/docs/contribute/coding-conventions) _for a smoother review._ ## Publish to changelog? <!-- For features only --> <!-- If publishing, you must provide changelog details in the #changelog Slack channel. You will receive a follow-up PR comment or notification. --> <!-- If not, write "no" or "do not publish to changelog" to explicitly opt-out of posting to #changelog. Removing this entire section will not prevent posting. -->
1 parent 4ea4a67 commit 7d8b5c0

File tree

2 files changed

+30
-2
lines changed

2 files changed

+30
-2
lines changed

frontend/src/scenes/product-tours/components/AutoShowSection.tsx

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -274,8 +274,8 @@ export function AutoShowSection({ id }: { id: string }): JSX.Element | null {
274274

275275
return (
276276
<div className="space-y-4">
277-
<div>
278-
<h5 className="font-semibold mb-2">Where to show</h5>
277+
<div className="flex flex-col gap-3">
278+
<h5 className="font-semibold mb-0">Where to show</h5>
279279
<div className="flex gap-2 items-center">
280280
<span className="text-sm whitespace-nowrap">URL</span>
281281
<LemonSelect
@@ -336,6 +336,33 @@ export function AutoShowSection({ id }: { id: string }): JSX.Element | null {
336336
{conditions.urlMatchType === SurveyMatchType.Exact && (
337337
<span className="text-xs text-muted">Trailing slashes are stripped when matching exact URLs.</span>
338338
)}
339+
<div className="flex gap-2 items-center">
340+
<span className="text-sm whitespace-nowrap">Device types</span>
341+
<LemonInputSelect
342+
mode="multiple"
343+
value={conditions.deviceTypes || []}
344+
onChange={(values) => {
345+
onChange({ ...conditions, deviceTypes: values })
346+
}}
347+
options={[
348+
{
349+
key: 'Desktop',
350+
label: 'Desktop',
351+
},
352+
{
353+
key: 'Tablet',
354+
label: 'Tablet',
355+
},
356+
{
357+
key: 'Mobile',
358+
label: 'Mobile',
359+
},
360+
]}
361+
placeholder="Select devices..."
362+
disablePrompting
363+
size="small"
364+
/>
365+
</div>
339366
</div>
340367

341368
<div>

frontend/src/types.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3504,6 +3504,7 @@ export interface ProductTourDisplayConditions {
35043504
} | null
35053505
linkedFlagVariant?: string
35063506
seenTourWaitPeriod?: ProductTourWaitPeriod
3507+
deviceTypes?: string[]
35073508
}
35083509

35093510
export interface ProductTourAppearance {

0 commit comments

Comments
 (0)