: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.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
feat(replay): quill siblings for the list shell footer and states (#128297)
Hayne Ryub077d429bfa1
diff --git a/frontend/src/scenes/session-recordings/playlist/Playlist.tsx b/frontend/src/scenes/session-recordings/playlist/Playlist.tsxindex edf4727c9a62..c6b33c05c68d 100644--- a/frontend/src/scenes/session-recordings/playlist/Playlist.tsx+++ b/frontend/src/scenes/session-recordings/playlist/Playlist.tsx@@ -6,9 +6,9 @@ import { useActions, useValues } from 'kea'import { ReactNode, useLayoutEffect, useRef, useState } from 'react'import { IconSidebarClose } from '@posthog/icons'-import { LemonBadge, LemonBanner, LemonButton, LemonCollapse, LemonDivider, Link, Tooltip } from '@posthog/lemon-ui'+import { LemonBadge, LemonBanner, LemonButton, LemonDivider, Tooltip } from '@posthog/lemon-ui'+import { Heading, Text } from '@posthog/quill'-import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'import { useResizeBreakpoints } from 'lib/hooks/useResizeObserver'import { LemonTableLoader } from 'lib/lemon-ui/LemonTable/LemonTableLoader'import { DraggableToNotebook } from 'scenes/notebooks/AddToNotebook/DraggableToNotebook'@@ -25,8 +25,11 @@ import { splitOngoingRecordings } from 'scenes/session-recordings/playlist/playlimport { QuillListCollapsedToggle } from 'scenes/session-recordings/playlist/QuillListCollapsedToggle'import { QuillListLoadingState } from 'scenes/session-recordings/playlist/QuillListLoadingState'import { QuillListLoadMoreFooter } from 'scenes/session-recordings/playlist/QuillListLoadMoreFooter'+import { QuillListNotice } from 'scenes/session-recordings/playlist/QuillListNotice'import { QuillListOnlyLiveState } from 'scenes/session-recordings/playlist/QuillListOnlyLiveState'import { QuillSelectedRecordingsBar } from 'scenes/session-recordings/playlist/QuillSelectedRecordingsBar'+import { QuillSessionRecordingsPlaylistTroubleshooting } from 'scenes/session-recordings/playlist/QuillSessionRecordingsPlaylistTroubleshooting'+import { QuillUnusableEventsWarning } from 'scenes/session-recordings/playlist/QuillUnusableEventsWarning'import { ReplayFilterBar } from 'scenes/session-recordings/playlist/ReplayFilterBar'import { isFeedReplayLayout, isNewReplayLayout } from 'scenes/session-recordings/playlist/replayLayout'import { ReplayListHeader } from 'scenes/session-recordings/playlist/ReplayListHeader'@@ -37,6 +40,7 @@ import { SessionRecordingPreviewFeed } from 'scenes/session-recordings/playlist/import { sessionRecordingsPlaylistLogic } from 'scenes/session-recordings/playlist/sessionRecordingsPlaylistLogic'import { SessionRecordingsPlaylistTopSettings } from 'scenes/session-recordings/playlist/SessionRecordingsPlaylistSettings'import { SessionRecordingsPlaylistTroubleshooting } from 'scenes/session-recordings/playlist/SessionRecordingsPlaylistTroubleshooting'+import { UnusableEventsWarning } from 'scenes/session-recordings/playlist/UnusableEventsWarning'import { urls } from 'scenes/urls'import { ReplayTabs, SessionRecordingType } from '~/types'@@ -48,7 +52,6 @@ const ESTIMATED_ROW_HEIGHT = 56type PlaylistSectionBase = {key: stringtitle?: ReactNode- initiallyOpen?: boolean}export type PlaylistRecordingPreviewBlock = PlaylistSectionBase & {@@ -197,7 +200,6 @@ export function Playlist({),items: pinnedRecordings,render: renderRow,- initiallyOpen: true,})} else {sections.push({@@ -209,7 +211,6 @@ export function Playlist({</div>),items: finishedRecordings,- initiallyOpen: !pinnedRecordings.length,render: renderRow,footer: newLayout ? (<QuillListLoadMoreFooter {...loadMoreFooterProps} />@@ -222,18 +223,10 @@ export function Playlist({const firstItem = sections.filter((s): s is PlaylistRecordingPreviewBlock => 'items' in s)?.find((s) => s.items.length > 0)?.items[0]- const sectionCount = sections.lengthconst itemsCount = sections.filter((s): s is PlaylistRecordingPreviewBlock => 'items' in s).flatMap((s) => s.items).length- const initiallyOpenSections = sections.filter((s) => s.initiallyOpen).map((s) => s.key)- const [openSections, setOpenSections] = useState<string[]>(initiallyOpenSections)-- const onChangeOpenSections = (activeKeys: string[]): void => {- setOpenSections(activeKeys)- }-const [controlledActiveItemId, setControlledActiveItemId] = useState<SessionRecordingType['id'] | null>(selectInitialItem && firstItem ? firstItem.id : null)@@ -263,9 +256,9 @@ export function Playlist({<ListOnlyLiveState {...onlyLiveProps} />)) : type === 'collection' ? (- <CollectionEmptyState isSynthetic={isSynthetic} description={description} />+ <CollectionEmptyState isSynthetic={isSynthetic} description={description} newLayout={newLayout} />) : (- <ListEmptyState listEmptyState={listEmptyState} />+ <ListEmptyState listEmptyState={listEmptyState} newLayout={newLayout} />)// Show collapsed view@@ -354,12 +347,18 @@ export function Playlist({)}<LemonTableLoader loading={sessionRecordingsResponseLoading} /></div>- {selectedRecordingOutsideFilters && (- <LemonBanner type="warning" className="m-2">- The recording you have open doesn't match the current filters. It stays in the list- until you close it.- </LemonBanner>- )}+ {selectedRecordingOutsideFilters &&+ (newLayout ? (+ <QuillListNotice tone="warning" className="m-2">+ The recording you have open doesn't match the current filters. It stays in the list+ until you close it.+ </QuillListNotice>+ ) : (+ <LemonBanner type="warning" className="m-2">+ The recording you have open doesn't match the current filters. It stays in the list+ until you close it.+ </LemonBanner>+ ))}<divclassName="overflow-y-auto flex-1 min-h-0 [scrollbar-gutter:stable] [scrollbar-width:thin]"onScroll={handleScroll}@@ -379,47 +378,15 @@ export function Playlist({scrollEl={scrollEl}/></OngoingRecordingsGroup>- {sectionCount > 1 ? (- <LemonCollapse- defaultActiveKeys={openSections}- panels={sections.map((s) => {- return {- key: s.key,- header: String(s.title),- content: (- <SectionContent- section={s}- loading={!!sessionRecordingsResponseLoading}- loadingState={loadingState}- setActiveItemId={onChangeActiveItem}- activeItemId={activeItemId}- emptyState={emptyState}- scrollEl={scrollEl}- />- ),- className: 'p-0',- }- })}- onChange={onChangeOpenSections}- multiple- embedded- size="small"- />- ) : sectionCount === 1 ? (- <SectionContent- section={sections[0]}- loading={!!sessionRecordingsResponseLoading}- loadingState={loadingState}- setActiveItemId={onChangeActiveItem}- activeItemId={activeItemId}- emptyState={emptyState}- scrollEl={scrollEl}- />- ) : sessionRecordingsResponseLoading ? (- loadingState- ) : (- emptyState- )}+ <SectionContent+ section={sections[0]}+ loading={!!sessionRecordingsResponseLoading}+ loadingState={loadingState}+ setActiveItemId={onChangeActiveItem}+ activeItemId={activeItemId}+ emptyState={emptyState}+ scrollEl={scrollEl}+ /></div></div></div>@@ -455,9 +422,27 @@ const TitleWithCount = ({ title, count }: { title?: string; count: number }): JS)}-const ListEmptyState = ({ listEmptyState }: Pick<PlaylistProps, 'listEmptyState'>): JSX.Element => {+const ListEmptyState = ({+ listEmptyState,+ newLayout,+}: Pick<PlaylistProps, 'listEmptyState'> & { newLayout: boolean }): JSX.Element => {const { sessionRecordingsAPIErrored, unusableEventsInFilter } = useValues(sessionRecordingsPlaylistLogic)+ if (newLayout) {+ return (+ <div data-quill className="p-3 text-sm text-muted-foreground">+ {sessionRecordingsAPIErrored ? (+ <QuillListNotice tone="destructive">Error while trying to load recordings.</QuillListNotice>+ ) : unusableEventsInFilter.length ? (+ <QuillUnusableEventsWarning unusableEventsInFilter={unusableEventsInFilter} />+ ) : (+ <div className="flex flex-col gap-2">+ {listEmptyState ?? <QuillSessionRecordingsPlaylistTroubleshooting />}+ </div>+ )}+ </div>+ )+ }return (<div className="p-3 text-sm text-secondary">{sessionRecordingsAPIErrored ? (@@ -476,12 +461,36 @@ const ListEmptyState = ({ listEmptyState }: Pick<PlaylistProps, 'listEmptyState'const CollectionEmptyState = ({isSynthetic,description,+ newLayout,}: {isSynthetic?: booleandescription?: string+ newLayout: boolean}): JSX.Element => {const { sessionRecordingsAPIErrored, unusableEventsInFilter } = useValues(sessionRecordingsPlaylistLogic)+ if (newLayout) {+ return (+ <div data-quill className="p-3 text-sm text-muted-foreground">+ {sessionRecordingsAPIErrored ? (+ <QuillListNotice tone="destructive">Error while trying to load recordings.</QuillListNotice>+ ) : unusableEventsInFilter.length ? (+ <QuillUnusableEventsWarning unusableEventsInFilter={unusableEventsInFilter} />+ ) : (+ <div className="flex flex-col gap-2">+ <Heading size="sm" render={<h3 />} className="m-0">+ {isSynthetic ? 'No recordings yet' : 'No recordings in this collection'}+ </Heading>+ <Text size="sm" variant="muted">+ {isSynthetic+ ? description || 'This collection is automatically populated.'+ : 'Use "Add recordings" above to browse recordings and add them to this collection.'}+ </Text>+ </div>+ )}+ </div>+ )+ }return (<div className="p-3 text-sm text-secondary">{sessionRecordingsAPIErrored ? (@@ -603,30 +612,3 @@ export function ListSection({</>)}--/**- * TODO add docs on how to enrich custom events with session_id and link to it from here- */-const UnusableEventsWarning = (props: { unusableEventsInFilter: string[] }): JSX.Element => {- return (- <LemonBanner type="warning">- <p>Cannot use these events to filter for session recordings:</p>- <li className="my-1">- {props.unusableEventsInFilter.map((event) => (- <span key={event}>"{event}"</span>- ))}- </li>- <p>- Events have to have a <PropertyKeyInfo value="$session_id" /> to be used to filter recordings. This is- added automatically by{' '}- <Link to="https://posthog.com/docs/libraries/js" target="_blank">- the Web SDK- </Link>- ,{' '}- <Link to="https://posthog.com/docs/libraries" target="_blank">- and the Mobile SDKs (Android, iOS, React Native and Flutter)- </Link>- </p>- </LemonBanner>- )-}diff --git a/frontend/src/scenes/session-recordings/playlist/QuillListNotice.tsx b/frontend/src/scenes/session-recordings/playlist/QuillListNotice.tsxnew file mode 100644index 000000000000..94e7691c40a1--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/QuillListNotice.tsx@@ -0,0 +1,19 @@+import { ReactNode } from 'react'++import { Item, ItemContent } from '@posthog/quill'++export function QuillListNotice({+ tone,+ className,+ children,+}: {+ tone: 'warning' | 'destructive'+ className?: string+ children: ReactNode+}): JSX.Element {+ return (+ <Item data-quill variant="outline" tone={tone} className={className}>+ <ItemContent className="text-sm">{children}</ItemContent>+ </Item>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/QuillSessionRecordingsPlaylistTroubleshooting.tsx b/frontend/src/scenes/session-recordings/playlist/QuillSessionRecordingsPlaylistTroubleshooting.tsxnew file mode 100644index 000000000000..dedabc1db77a--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/QuillSessionRecordingsPlaylistTroubleshooting.tsx@@ -0,0 +1,83 @@+import { Button, Heading, Separator } from '@posthog/quill'++import { LinkPrimitive } from 'lib/lemon-ui/Link'++import { useListTroubleshooting } from './useListTroubleshooting'++export function QuillSessionRecordingsPlaylistTroubleshooting(): JSX.Element {+ const {+ heading,+ recordingsAreHidden,+ hiddenRecordingsCount,+ canClearFilters,+ showHiddenRecordings,+ clearFilters,+ searchLast30Days,+ } = useListTroubleshooting()++ return (+ <div data-quill className="flex flex-col gap-2 text-foreground">+ <Heading size="sm" render={<h3 />} className="m-0 text-muted-foreground">+ {heading}+ </Heading>+ <div className="flex flex-col gap-1">+ {recordingsAreHidden && (+ <Button+ variant="outline"+ size="sm"+ className="w-full"+ onClick={showHiddenRecordings}+ data-attr="replay-empty-state-troubleshooting-show-hidden-recordings"+ >+ {hiddenRecordingsCount > 0+ ? `Show ${hiddenRecordingsCount} hidden recordings`+ : 'Show hidden recordings'}+ </Button>+ )}+ {canClearFilters && (+ <Button+ variant="outline"+ size="sm"+ className="w-full"+ onClick={clearFilters}+ data-attr="replay-empty-state-troubleshooting-clear-filters"+ >+ Clear filters+ </Button>+ )}+ <Button+ variant="outline"+ size="sm"+ className="w-full"+ onClick={searchLast30Days}+ data-attr="expand-replay-listing-from-default-seven-days-to-twenty-one"+ >+ Search over the last 30 days+ </Button>+ <Separator className="my-1" />+ <Button+ variant="link"+ size="inline"+ render={+ <LinkPrimitive to="https://posthog.com/docs/session-replay/data-retention" target="_blank" />+ }+ >+ Recordings might be outside the retention period+ </Button>+ <Separator className="my-1" />+ <Button+ variant="link"+ size="inline"+ render={+ <LinkPrimitive+ to="https://posthog.com/docs/session-replay/troubleshooting#4-adtracking-blockers"+ target="_blank"+ />+ }+ >+ An ad blocker might be preventing recordings+ </Button>+ </div>+ </div>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/QuillUnusableEventsWarning.tsx b/frontend/src/scenes/session-recordings/playlist/QuillUnusableEventsWarning.tsxnew file mode 100644index 000000000000..6f7aa3f5820b--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/QuillUnusableEventsWarning.tsx@@ -0,0 +1,42 @@+import { Button } from '@posthog/quill'++import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'+import { LinkPrimitive } from 'lib/lemon-ui/Link'++import { QuillListNotice } from './QuillListNotice'++export function QuillUnusableEventsWarning({+ unusableEventsInFilter,+}: {+ unusableEventsInFilter: string[]+}): JSX.Element {+ return (+ <QuillListNotice tone="warning">+ <p>Cannot use these events to filter for session recordings:</p>+ <p className="my-1">+ {unusableEventsInFilter.map((event) => (+ <span key={event}>"{event}"</span>+ ))}+ </p>+ <p>+ Events have to have a <PropertyKeyInfo value="$session_id" /> to be used to filter recordings. This is+ added automatically by{' '}+ <Button+ variant="link"+ size="inline"+ render={<LinkPrimitive to="https://posthog.com/docs/libraries/js" target="_blank" />}+ >+ the Web SDK+ </Button>+ ,{' '}+ <Button+ variant="link"+ size="inline"+ render={<LinkPrimitive to="https://posthog.com/docs/libraries" target="_blank" />}+ >+ and the Mobile SDKs (Android, iOS, React Native and Flutter)+ </Button>+ </p>+ </QuillListNotice>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistTroubleshooting.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistTroubleshooting.tsxindex 21a4b8eabaf9..958421c7327b 100644--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistTroubleshooting.tsx+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylistTroubleshooting.tsx@@ -1,35 +1,21 @@-import { useActions, useValues } from 'kea'-import posthog from 'posthog-js'-import { useEffect } from 'react'-import { LemonButton, LemonDivider, Link } from '@posthog/lemon-ui'-import { playerSettingsLogic } from '../player/playerSettingsLogic'-import { sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'+import { useListTroubleshooting } from './useListTroubleshooting'export const SessionRecordingsPlaylistTroubleshooting = (): JSX.Element => {- const { hideViewedRecordings } = useValues(playerSettingsLogic)- const { setHideViewedRecordings } = useActions(playerSettingsLogic)- const { hiddenRecordingsCount, totalFiltersCount, isScopedByCaller } = useValues(sessionRecordingsPlaylistLogic)- const { setShowSettings, setFilters, resetFilters } = useActions(sessionRecordingsPlaylistLogic)-- const recordingsAreHidden = hideViewedRecordings !== false- const hasFilters = totalFiltersCount > 0-- useEffect(() => {- posthog.capture('recording list empty state shown', {- hidden_recordings_count: hiddenRecordingsCount,- total_filters_count: totalFiltersCount,- })- }, [])- // Clearing would drop the caller's scoping, leaving a list that no longer matches the surface.- const canClearFilters = hasFilters && !isScopedByCaller+ const {+ heading,+ recordingsAreHidden,+ hiddenRecordingsCount,+ canClearFilters,+ showHiddenRecordings,+ clearFilters,+ searchLast30Days,+ } = useListTroubleshooting()return (<>- <h3 className="title text-secondary mb-0">- {hasFilters ? 'No recordings match your filters' : 'No recordings found'}- </h3>+ <h3 className="title text-secondary mb-0">{heading}</h3><div className="flex flex-col deprecated-space-y-2"><ul className="deprecated-space-y-1">{recordingsAreHidden && (@@ -39,10 +25,7 @@ export const SessionRecordingsPlaylistTroubleshooting = (): JSX.Element => {fullWidth={true}size="xsmall"data-attr="replay-empty-state-troubleshooting-show-hidden-recordings"- onClick={() => {- setShowSettings(true)- setHideViewedRecordings(false)- }}+ onClick={showHiddenRecordings}>{hiddenRecordingsCount > 0? `Show ${hiddenRecordingsCount} hidden recordings`@@ -57,7 +40,7 @@ export const SessionRecordingsPlaylistTroubleshooting = (): JSX.Element => {fullWidth={true}size="xsmall"data-attr="replay-empty-state-troubleshooting-clear-filters"- onClick={() => resetFilters()}+ onClick={clearFilters}>Clear filters</LemonButton>@@ -69,7 +52,7 @@ export const SessionRecordingsPlaylistTroubleshooting = (): JSX.Element => {fullWidth={true}size="xsmall"data-attr="expand-replay-listing-from-default-seven-days-to-twenty-one"- onClick={() => setFilters({ date_from: '-30d' })}+ onClick={searchLast30Days}>Search over the last 30 days</LemonButton>diff --git a/frontend/src/scenes/session-recordings/playlist/UnusableEventsWarning.tsx b/frontend/src/scenes/session-recordings/playlist/UnusableEventsWarning.tsxnew file mode 100644index 000000000000..722a8ae11dc9--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/UnusableEventsWarning.tsx@@ -0,0 +1,30 @@+import { LemonBanner, Link } from '@posthog/lemon-ui'++import { PropertyKeyInfo } from 'lib/components/PropertyKeyInfo'++/**+ * TODO add docs on how to enrich custom events with session_id and link to it from here+ */+export function UnusableEventsWarning({ unusableEventsInFilter }: { unusableEventsInFilter: string[] }): JSX.Element {+ return (+ <LemonBanner type="warning">+ <p>Cannot use these events to filter for session recordings:</p>+ <li className="my-1">+ {unusableEventsInFilter.map((event) => (+ <span key={event}>"{event}"</span>+ ))}+ </li>+ <p>+ Events have to have a <PropertyKeyInfo value="$session_id" /> to be used to filter recordings. This is+ added automatically by{' '}+ <Link to="https://posthog.com/docs/libraries/js" target="_blank">+ the Web SDK+ </Link>+ ,{' '}+ <Link to="https://posthog.com/docs/libraries" target="_blank">+ and the Mobile SDKs (Android, iOS, React Native and Flutter)+ </Link>+ </p>+ </LemonBanner>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/useListTroubleshooting.ts b/frontend/src/scenes/session-recordings/playlist/useListTroubleshooting.tsnew file mode 100644index 000000000000..8b6da8fc239e--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/useListTroubleshooting.ts@@ -0,0 +1,44 @@+import { useActions, useValues } from 'kea'+import posthog from 'posthog-js'+import { useEffect } from 'react'++import { playerSettingsLogic } from '../player/playerSettingsLogic'+import { sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'++export function useListTroubleshooting(): {+ heading: string+ recordingsAreHidden: boolean+ hiddenRecordingsCount: number+ canClearFilters: boolean+ showHiddenRecordings: () => void+ clearFilters: () => void+ searchLast30Days: () => void+} {+ const { hideViewedRecordings } = useValues(playerSettingsLogic)+ const { setHideViewedRecordings } = useActions(playerSettingsLogic)+ const { hiddenRecordingsCount, totalFiltersCount, isScopedByCaller } = useValues(sessionRecordingsPlaylistLogic)+ const { setShowSettings, setFilters, resetFilters } = useActions(sessionRecordingsPlaylistLogic)++ const hasFilters = totalFiltersCount > 0++ useEffect(() => {+ posthog.capture('recording list empty state shown', {+ hidden_recordings_count: hiddenRecordingsCount,+ total_filters_count: totalFiltersCount,+ })+ }, [])++ return {+ heading: hasFilters ? 'No recordings match your filters' : 'No recordings found',+ recordingsAreHidden: hideViewedRecordings !== false,+ hiddenRecordingsCount,+ // Clearing would drop the caller's scoping, leaving a list that no longer matches the surface.+ canClearFilters: hasFilters && !isScopedByCaller,+ showHiddenRecordings: () => {+ setShowSettings(true)+ setHideViewedRecordings(false)+ },+ clearFilters: () => resetFilters(),+ searchLast30Days: () => setFilters({ date_from: '-30d' }),+ }+}