Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

feat(posthog-ai): add context as a full page on phones (#111563)

Shy Alter6d6437b26463
diff --git a/products/posthog_ai/frontend/components/quill/QuillAttachedContextPicker.tsx b/products/posthog_ai/frontend/components/quill/QuillAttachedContextPicker.tsx
index 7693563f4416..8c780607203b 100644
--- a/products/posthog_ai/frontend/components/quill/QuillAttachedContextPicker.tsx
+++ b/products/posthog_ai/frontend/components/quill/QuillAttachedContextPicker.tsx
@@ -1,9 +1,12 @@
import { useActions, useValues } from 'kea'
import { useId, useState } from 'react'
-import { IconAtSign } from '@posthog/icons'
+import { IconAtSign, IconChevronLeft } from '@posthog/icons'
import {
Button,
+ Dialog,
+ DialogContent,
+ DialogTitle,
Popover,
PopoverContent,
PopoverTrigger,
@@ -15,6 +18,8 @@ import {
import { TaxonomicFilter } from 'lib/components/TaxonomicFilter/TaxonomicFilter'
import { TaxonomicFilterGroupType } from 'lib/components/TaxonomicFilter/types'
+import { todayShellLogic } from '~/layout/today/todayShellLogic'
+
import { attachedContextLogic } from '../../logics/attachedContextLogic'
import { CONTEXT_PICKER_GROUP_TYPES, contextPickerLogic } from '../../logics/contextPickerLogic'
@@ -23,6 +28,58 @@ export function QuillAttachedContextPicker(): JSX.Element {
const filterKey = `posthog-ai-context-picker-${useId()}`
const { hasContext } = useValues(attachedContextLogic)
const { handleTaxonomicFilterChange } = useActions(contextPickerLogic)
+ const { todayRailEnabled, phoneLayout } = useValues(todayShellLogic)
+ if (todayRailEnabled && phoneLayout) {
+ return (
+ <>
+ <Button
+ variant="default"
+ size={hasContext ? 'icon-lg' : 'lg'}
+ aria-label="Add context"
+ onClick={() => setOpen(true)}
+ data-attr="posthog-ai-context-picker"
+ >
+ <IconAtSign />
+ {!hasContext && 'Add context'}
+ </Button>
+ <Dialog open={open} onOpenChange={setOpen}>
+ <DialogContent
+ showCloseButton={false}
+ className="inset-0 flex h-dvh max-h-none w-screen max-w-none translate-none flex-col gap-0 rounded-none p-0 shadow-none"
+ data-attr="posthog-ai-context-page"
+ >
+ <div className="flex h-12 shrink-0 items-center gap-1 border-b border-border px-1">
+ <Button
+ size="icon-lg"
+ aria-label="Back"
+ onClick={() => setOpen(false)}
+ data-attr="posthog-ai-context-page-back"
+ >
+ <IconChevronLeft />
+ </Button>
+ <DialogTitle className="text-base font-semibold">Add context</DialogTitle>
+ </div>
+ <div data-not-quill className="min-h-0 flex-1 overflow-hidden px-5 pt-3">
+ <TaxonomicFilter
+ taxonomicFilterLogicKey={filterKey}
+ groupType={TaxonomicFilterGroupType.Events}
+ taxonomicGroupTypes={CONTEXT_PICKER_GROUP_TYPES}
+ onChange={({ type }, value, item) => {
+ if (value !== null) {
+ handleTaxonomicFilterChange(value, type, item)
+ }
+ setOpen(false)
+ }}
+ onClose={() => setOpen(false)}
+ width="100%"
+ height={window.innerHeight - 72}
+ />
+ </div>
+ </DialogContent>
+ </Dialog>
+ </>
+ )
+ }
return (
<Popover open={open} onOpenChange={setOpen}>
<Tooltip>