: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): collections segment opens collections in the list column (#126577)
Hayne Ryu968d21ae61ee
diff --git a/frontend/src/scenes/session-recordings/SessionRecordings.tsx b/frontend/src/scenes/session-recordings/SessionRecordings.tsxindex 3fd22577433d..6301a24eaeb9 100644--- a/frontend/src/scenes/session-recordings/SessionRecordings.tsx+++ b/frontend/src/scenes/session-recordings/SessionRecordings.tsx@@ -1,7 +1,6 @@import { BindLogic, useActions, useValues } from 'kea'import { router } from 'kea-router'import posthog from 'posthog-js'-import { useState } from 'react'import * as explorerPng from '@posthog/brand/hoggies/png/explorer'import { IconDocument, IconGear, IconHeadset } from '@posthog/icons'@@ -9,7 +8,6 @@ import { LemonButton, LemonSegmentedButton, Link } from '@posthog/lemon-ui'import { Button } from '@posthog/quill'import { PostHogCaptureOnViewed } from '@posthog/react'-import { isAccessDeniedError, shouldReportApiFailure } from 'lib/api-error'import { pngHoggie } from 'lib/brand/hoggies'import { AccessControlAction } from 'lib/components/AccessControlAction'import { Shortcut } from 'lib/components/Shortcuts/Shortcut'@@ -18,7 +16,6 @@ import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'import { LemonBanner } from 'lib/lemon-ui/LemonBanner'import { lemonBannerLogic } from 'lib/lemon-ui/LemonBanner/lemonBannerLogic'import { LemonTab, LemonTabs } from 'lib/lemon-ui/LemonTabs'-import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'import { LinkPrimitive } from 'lib/lemon-ui/Link'import { Spinner } from 'lib/lemon-ui/Spinner/Spinner'import { useAttachedLogic } from 'lib/logic/scenes/useAttachedLogic'@@ -27,7 +24,7 @@ import { sceneConfigurations } from 'scenes/scenes'import { Scene, SceneExport } from 'scenes/sceneTypes'import { LiveRecordingsCount } from 'scenes/session-recordings/components/LiveRecordingsCount'import { playerSettingsLogic } from 'scenes/session-recordings/player/playerSettingsLogic'-import { NEW_REPLAY_LAYOUTS, ReplayLayout } from 'scenes/session-recordings/playlist/replayLayout'+import { NEW_REPLAY_LAYOUTS, ReplayLayout, isNewReplayLayout } from 'scenes/session-recordings/playlist/replayLayout'import { teamLogic } from 'scenes/teamLogic'import { urls } from 'scenes/urls'@@ -40,8 +37,8 @@ import { AccessControlLevel, AccessControlResourceType, ReplayTab, ReplayTabs }import { sessionReplayEmptyState } from 'products/replay/frontend/emptyState/sessionReplayEmptyState'import { SessionRecordingCollections } from './collections/SessionRecordingCollections'+import { useNewCollection } from './collections/useNewCollection'import { SessionRecordingsPlaylistRedesign } from './playlist-redesign/SessionRecordingsPlaylistRedesign'-import { createPlaylist } from './playlist/playlistUtils'import { SessionRecordingsPlaylist } from './playlist/SessionRecordingsPlaylist'import {SessionRecordingPlaylistLogicProps,@@ -64,29 +61,8 @@ function Header(): JSX.Element {const { watchLayoutOffered, replayLayout, canOverrideLayout, staffLayoutOverride } = useValues(playerSettingsLogic)const { setPreferClassicReplayLayout, setStaffLayoutOverride } = useActions(playerSettingsLogic)const recordingsDisabled = currentTeam && !currentTeam?.session_recording_opt_in- const [loading, setLoading] = useState(false)const todayRailNav = useFeatureFlag('TODAY_RAIL_NAV')- const handleNewPlaylist = async (): Promise<void> => {- setLoading(true)- try {- await createPlaylist(- { _create_in_folder: 'Unfiled/Replay playlists', type: 'collection', creation_method: 'new' },- true- )- } catch (error: any) {- if (isAccessDeniedError(error)) {- lemonToast.error('You do not have access to create collections.')- } else {- lemonToast.error('Could not create the collection. Please try again.')- }- // Not a kea loader, so initKea's report gate does not run. Apply the same gate here.- if (shouldReportApiFailure(error)) {- posthog.captureException(error)- }- } finally {- setLoading(false)- }- }+ const { createCollection: handleNewPlaylist, creating: loading } = useNewCollection()return (<div className="flex items-center gap-2">@@ -342,8 +318,12 @@ const ReplayPageTabs: ReplayTab[] = [},]-export function SessionRecordingsPageTabs(): JSX.Element {+export function SessionRecordingsPageTabs(): JSX.Element | null {const { tab } = useValues(sessionReplaySceneLogic)+ const { replayLayout } = useValues(playerSettingsLogic)+ if (tab === ReplayTabs.Home && isNewReplayLayout(replayLayout)) {+ return null+ }return (<LemonTabsactiveKey={tab}diff --git a/frontend/src/scenes/session-recordings/collections/BuiltInCollections.tsx b/frontend/src/scenes/session-recordings/collections/BuiltInCollections.tsxindex eb75def6b35b..ed883958fd71 100644--- a/frontend/src/scenes/session-recordings/collections/BuiltInCollections.tsx+++ b/frontend/src/scenes/session-recordings/collections/BuiltInCollections.tsx@@ -1,29 +1,20 @@-import { IconClock, IconComment, IconDownload, IconRewindPlay, IconShare, IconWarning } from '@posthog/icons'import { LemonTable } from '@posthog/lemon-ui'import { LemonTableColumns } from 'lib/lemon-ui/LemonTable'import { SessionRecordingPlaylistType } from '~/types'+import { BUILT_IN_COLLECTION_ICONS } from './builtInCollectionIcons'import { COLUMN_WIDTHS, countColumn, nameColumn, watchNextColumn } from './collectionColumns'import { CollectionSectionHeading } from './CollectionSectionHeading'-const BUILT_IN_ICONS: Record<string, JSX.Element> = {- 'synthetic-watch-history': <IconRewindPlay />,- 'synthetic-commented': <IconComment />,- 'synthetic-shared': <IconShare />,- 'synthetic-exported': <IconDownload />,- 'synthetic-expiring': <IconClock />,- 'synthetic-frustrated': <IconWarning />,-}-const columns: LemonTableColumns<SessionRecordingPlaylistType> = [{width: COLUMN_WIDTHS.leading,render: function Render(_, { short_id }) {return (<span className="flex items-center justify-center w-9 h-8 text-xl text-secondary">- {BUILT_IN_ICONS[short_id]}+ {BUILT_IN_COLLECTION_ICONS[short_id]}</span>)},diff --git a/frontend/src/scenes/session-recordings/collections/builtInCollectionIcons.tsx b/frontend/src/scenes/session-recordings/collections/builtInCollectionIcons.tsxnew file mode 100644index 000000000000..64656f3c23e3--- /dev/null+++ b/frontend/src/scenes/session-recordings/collections/builtInCollectionIcons.tsx@@ -0,0 +1,10 @@+import { IconClock, IconComment, IconDownload, IconRewindPlay, IconShare, IconWarning } from '@posthog/icons'++export const BUILT_IN_COLLECTION_ICONS: Record<string, JSX.Element> = {+ 'synthetic-watch-history': <IconRewindPlay />,+ 'synthetic-commented': <IconComment />,+ 'synthetic-shared': <IconShare />,+ 'synthetic-exported': <IconDownload />,+ 'synthetic-expiring': <IconClock />,+ 'synthetic-frustrated': <IconWarning />,+}diff --git a/frontend/src/scenes/session-recordings/collections/useNewCollection.ts b/frontend/src/scenes/session-recordings/collections/useNewCollection.tsnew file mode 100644index 000000000000..ae4fcfedeff6--- /dev/null+++ b/frontend/src/scenes/session-recordings/collections/useNewCollection.ts@@ -0,0 +1,32 @@+import posthog from 'posthog-js'+import { useState } from 'react'++import { isAccessDeniedError, shouldReportApiFailure } from 'lib/api-error'+import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'++import { createPlaylist } from '../playlist/playlistUtils'++export function useNewCollection(): { createCollection: () => Promise<void>; creating: boolean } {+ const [creating, setCreating] = useState(false)+ const createCollection = async (): Promise<void> => {+ setCreating(true)+ try {+ await createPlaylist(+ { _create_in_folder: 'Unfiled/Replay playlists', type: 'collection', creation_method: 'new' },+ true+ )+ } catch (error: any) {+ if (isAccessDeniedError(error)) {+ lemonToast.error('You do not have access to create collections.')+ } else {+ lemonToast.error('Could not create the collection. Please try again.')+ }+ if (shouldReportApiFailure(error)) {+ posthog.captureException(error)+ }+ } finally {+ setCreating(false)+ }+ }+ return { createCollection, creating }+}diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayCollectionView.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayCollectionView.tsxnew file mode 100644index 000000000000..551183bb71da--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/ReplayCollectionView.tsx@@ -0,0 +1,101 @@+import { BindLogic, useActions, useMountedLogic, useValues } from 'kea'++import { IconArrowLeft, IconExternal, IconPlus } from '@posthog/icons'+import { LemonBadge, LemonButton, LemonSkeleton } from '@posthog/lemon-ui'++import { LemonBanner } from 'lib/lemon-ui/LemonBanner'+import { urls } from 'scenes/urls'++import { BUILT_IN_COLLECTION_ICONS } from '../collections/builtInCollectionIcons'+import { AddRecordingsToCollectionModal } from './AddRecordingsToCollectionModal'+import { Playlist } from './Playlist'+import { replayCollectionViewLogic } from './replayCollectionViewLogic'+import { replayListColumnLogic } from './replayListColumnLogic'+import { SessionRecordingPlaylistLogicProps, sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'+import { sessionRecordingsPlaylistSceneLogic } from './sessionRecordingsPlaylistSceneLogic'++export function ReplayCollectionView({ shortId, logicKey }: { shortId: string; logicKey: string }): JSX.Element {+ const columnLogic = replayListColumnLogic({ logicKey })+ const { closeCollection } = useActions(columnLogic)+ const sceneLogic = sessionRecordingsPlaylistSceneLogic({ shortId })+ const { playlist, playlistLoading, pinnedRecordings } = useValues(sceneLogic)+ const { onPinnedChange, setAddRecordingsModalOpen } = useActions(sceneLogic)++ const listProps: SessionRecordingPlaylistLogicProps = {+ logicKey: shortId,+ type: 'collection',+ onlyPinned: true,+ autoPlay: false,+ updateSearchParams: false,+ pinnedRecordings: pinnedRecordings ?? [],+ onPinnedChange,+ analyticsSource: 'replay-list-collection',+ }+ useMountedLogic(+ replayCollectionViewLogic({ shortId, listProps, mainListProps: columnLogic.props.playlistLogicProps })+ )+ const failed = !playlist && !playlistLoading++ return (+ <div className="flex flex-col flex-1 min-h-0 gap-2" data-attr="list-collection-view">+ <div className="flex items-center gap-1">+ <LemonButton+ size="small"+ icon={<IconArrowLeft />}+ onClick={closeCollection}+ tooltip="Back to collections"+ aria-label="Back to collections"+ data-attr="list-collection-back"+ />+ {playlist ? (+ <span className="flex items-center gap-1.5 min-w-0 flex-1 text-sm font-semibold">+ {BUILT_IN_COLLECTION_ICONS[playlist.short_id]}+ <span className="truncate">{playlist.name || playlist.derived_name || 'Unnamed'}</span>+ <LemonBadge.Number count={pinnedRecordings?.length ?? 0} size="small" status="muted" showZero />+ </span>+ ) : failed ? (+ <span className="flex-1 text-sm font-semibold">Collection</span>+ ) : (+ <LemonSkeleton className="h-5 flex-1" />+ )}+ {playlist && !playlist.is_synthetic && (+ <LemonButton+ size="small"+ type="secondary"+ icon={<IconPlus />}+ onClick={() => setAddRecordingsModalOpen(true)}+ data-attr="list-collection-add-recordings"+ >+ Add+ </LemonButton>+ )}+ <LemonButton+ size="small"+ icon={<IconExternal />}+ to={urls.replayPlaylist(shortId)}+ tooltip="Open collection page"+ aria-label="Open collection page"+ data-attr="list-collection-open-page"+ />+ </div>+ {failed ? (+ <LemonBanner type="error">Couldn't load this collection. Refresh the page to try again.</LemonBanner>+ ) : (+ <BindLogic logic={sessionRecordingsPlaylistLogic} props={listProps}>+ <Playlist+ type="collection"+ logicKey={shortId}+ isSynthetic={playlist?.is_synthetic}+ description={playlist?.description}+ watchLayout+ />+ </BindLogic>+ )}+ {playlist && !playlistLoading && (+ <BindLogic logic={sessionRecordingsPlaylistSceneLogic} props={{ shortId }}>+ <AddRecordingsToCollectionModal />+ </BindLogic>+ )}+ </div>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayCollectionsSegment.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayCollectionsSegment.tsxnew file mode 100644index 000000000000..ab76597116d4--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/ReplayCollectionsSegment.tsx@@ -0,0 +1,163 @@+import { useActions, useValues } from 'kea'++import { IconPin, IconPinFilled, IconPlus } from '@posthog/icons'+import { LemonBadge, LemonButton, LemonInput, LemonSkeleton, Link } from '@posthog/lemon-ui'++import { AccessControlAction } from 'lib/components/AccessControlAction'+import { LemonBanner } from 'lib/lemon-ui/LemonBanner'+import { urls } from 'scenes/urls'++import { AccessControlLevel, AccessControlResourceType, ReplayTabs, SessionRecordingPlaylistType } from '~/types'++import { BUILT_IN_COLLECTION_ICONS } from '../collections/builtInCollectionIcons'+import { CollectionSectionHeading } from '../collections/CollectionSectionHeading'+import { getCollectionCounts } from '../collections/collectionUtils'+import { sessionRecordingCollectionsLogic } from '../collections/sessionRecordingCollectionsLogic'+import { useNewCollection } from '../collections/useNewCollection'+import { ReplayCollectionView } from './ReplayCollectionView'+import { replayListColumnLogic } from './replayListColumnLogic'++export function ReplayCollectionsSegment({ logicKey }: { logicKey: string }): JSX.Element {+ const { playlists, playlistsLoading, loadPlaylistsFailed, builtInPlaylists, builtInPlaylistsLoading, filters } =+ useValues(sessionRecordingCollectionsLogic)+ const { setSavedPlaylistsFilters } = useActions(sessionRecordingCollectionsLogic)+ const { openCollectionShortId } = useValues(replayListColumnLogic({ logicKey }))+ const { openCollection } = useActions(replayListColumnLogic({ logicKey }))+ const { createCollection, creating } = useNewCollection()+ const searching = !!filters.search++ if (openCollectionShortId) {+ return <ReplayCollectionView shortId={openCollectionShortId} logicKey={logicKey} />+ }++ return (+ <div+ className="flex flex-col flex-1 min-h-0 border rounded bg-surface-primary overflow-hidden"+ data-attr="list-collections"+ >+ <div className="flex items-center gap-2 p-2 border-b">+ <LemonInput+ type="search"+ size="small"+ className="flex-1"+ placeholder="Search collections"+ value={filters.search || ''}+ onChange={(value) => setSavedPlaylistsFilters({ search: value || undefined })}+ data-attr="list-collections-search"+ />+ <AccessControlAction+ resourceType={AccessControlResourceType.SessionRecording}+ minAccessLevel={AccessControlLevel.Editor}+ >+ <LemonButton+ type="primary"+ size="small"+ icon={<IconPlus />}+ onClick={() => void createCollection()}+ loading={creating}+ data-attr="list-collections-new"+ >+ New+ </LemonButton>+ </AccessControlAction>+ </div>+ <div className="flex-1 min-h-0 overflow-y-auto">+ {!searching && (+ <>+ <CollectionSectionHeading title="Built-in" description="Kept up to date by PostHog." />+ {builtInPlaylistsLoading && builtInPlaylists.length === 0 ? (+ <RowSkeletons count={4} />+ ) : (+ builtInPlaylists.map((playlist) => (+ <CollectionRow+ key={playlist.short_id}+ playlist={playlist}+ icon={BUILT_IN_COLLECTION_ICONS[playlist.short_id]}+ onClick={() => openCollection(playlist.short_id)}+ />+ ))+ )}+ </>+ )}+ <CollectionSectionHeading title="Your collections" description="Made by your team." />+ {loadPlaylistsFailed ? (+ <LemonBanner type="error" className="m-2">+ Couldn't load your collections. Refresh the page to try again.+ </LemonBanner>+ ) : playlistsLoading && playlists.results.length === 0 ? (+ <RowSkeletons count={4} />+ ) : playlists.results.length === 0 ? (+ <p className="text-secondary text-xs m-0 px-3 py-4 text-center">+ {searching+ ? 'No collections match your search.'+ : 'No collections yet. Create one to group recordings.'}+ </p>+ ) : (+ playlists.results.map((playlist) => (+ <CollectionRow+ key={playlist.short_id}+ playlist={playlist}+ icon={playlist.pinned ? <IconPinFilled /> : <IconPin />}+ onClick={() => openCollection(playlist.short_id)}+ />+ ))+ )}+ </div>+ <div className="flex items-center justify-between gap-2 px-3 py-1.5 border-t text-xs">+ <span className="text-secondary">+ {playlists.count > playlists.results.length+ ? `Showing ${playlists.results.length} of ${playlists.count}`+ : ''}+ </span>+ <Link to={urls.replay(ReplayTabs.Playlists)} data-attr="list-collections-manage">+ Manage collections+ </Link>+ </div>+ </div>+ )+}++function CollectionRow({+ playlist,+ icon,+ onClick,+}: {+ playlist: SessionRecordingPlaylistType+ icon?: JSX.Element+ onClick: () => void+}): JSX.Element {+ const counts = getCollectionCounts(playlist.recordings_counts)+ return (+ <LemonButton+ fullWidth+ size="small"+ className="rounded-none"+ icon={icon}+ onClick={onClick}+ sideIcon={+ counts ? (+ <LemonBadge.Number+ count={counts.total || 0}+ status={counts.unwatched ? 'primary' : 'muted'}+ size="small"+ maxDigits={3}+ showZero+ />+ ) : undefined+ }+ data-attr={playlist.is_synthetic ? 'list-collections-row-synthetic' : 'list-collections-row'}+ >+ <span className="truncate font-normal">{playlist.name || playlist.derived_name || 'Unnamed'}</span>+ </LemonButton>+ )+}++function RowSkeletons({ count }: { count: number }): JSX.Element {+ return (+ <div className="flex flex-col gap-1 p-2">+ {Array.from({ length: count }, (_, i) => (+ <LemonSkeleton key={i} className="h-7" />+ ))}+ </div>+ )+}diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsxindex ad2fd659b079..01027d20922c 100644--- a/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx+++ b/frontend/src/scenes/session-recordings/playlist/ReplayListColumn.tsx@@ -3,6 +3,7 @@ import { ReactNode, useEffect } from 'react'import { LemonBadge, LemonSegmentedButton } from '@posthog/lemon-ui'+import { ReplayCollectionsSegment } from './ReplayCollectionsSegment'import { ReplayListPicksMode, ReplayListSegment, replayListColumnLogic } from './replayListColumnLogic'export interface ReplayListColumnProps {@@ -11,6 +12,7 @@ export interface ReplayListColumnProps {/** The Highlights list, when the picks experiment offers one. */picksList?: ReactNodepicksMode: ReplayListPicksMode+ collections?: booleanunwatchedPicksCount?: numberonPicksSelected?: (selected: boolean) => void}@@ -20,6 +22,7 @@ export function ReplayListColumn({recordingsList,picksList,picksMode,+ collections = false,unwatchedPicksCount = 0,onPicksSelected,}: ReplayListColumnProps): JSX.Element {@@ -54,6 +57,9 @@ export function ReplayListColumn({label: 'All recordings','data-attr': 'list-segment-recordings',},+ ...(collections+ ? [{ value: 'collections' as const, label: 'Collections', 'data-attr': 'list-segment-collections' }]+ : []),]return (@@ -73,7 +79,15 @@ export function ReplayListColumn({options={options}/>)}- <div className="flex flex-col flex-1 min-h-0">{segment === 'picks' ? picksList : recordingsList}</div>+ <div className="flex flex-col flex-1 min-h-0">+ {segment === 'picks' ? (+ picksList+ ) : segment === 'collections' ? (+ <ReplayCollectionsSegment logicKey={logicKey} />+ ) : (+ recordingsList+ )}+ </div></div>)}diff --git a/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx b/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsxindex a51b55095610..c4ae2b1beb97 100644--- a/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx+++ b/frontend/src/scenes/session-recordings/playlist/ReplayListColumnWithPicks.tsx@@ -10,9 +10,11 @@ import { ReplayListColumn } from './ReplayListColumn'export function ReplayListColumnWithPicks({logicKey,recordingsList,+ collections,}: {logicKey: stringrecordingsList: ReactNode+ collections?: boolean}): JSX.Element {const picksLogic = useMountedLogic(highlightPicksLogic)const { effectiveListMode, unwatchedCount } = useValues(picksLogic)@@ -23,6 +25,7 @@ export function ReplayListColumnWithPicks({<ReplayListColumnlogicKey={logicKey}recordingsList={recordingsList}+ collections={collections}picksList={<HighlightPicksList />}picksMode={effectiveListMode}unwatchedPicksCount={unwatchedCount}diff --git a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsxindex 65f3b6e0526d..eff284e5057a 100644--- a/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx+++ b/frontend/src/scenes/session-recordings/playlist/SessionRecordingsPlaylist.tsx@@ -138,10 +138,20 @@ function WatchPlaylistColumn({ picksInList, ...props }: LayoutProps): JSX.Elemenif (isPlaylistCollapsed) {return <Playlist {...props} />}+ const collections = !props.typereturn picksInList ? (- <ReplayListColumnWithPicks logicKey={logicKey} recordingsList={<Playlist {...props} />} />+ <ReplayListColumnWithPicks+ logicKey={logicKey}+ recordingsList={<Playlist {...props} />}+ collections={collections}+ />) : (- <ReplayListColumn logicKey={logicKey} recordingsList={<Playlist {...props} />} picksMode={null} />+ <ReplayListColumn+ logicKey={logicKey}+ recordingsList={<Playlist {...props} />}+ picksMode={null}+ collections={collections}+ />)}diff --git a/frontend/src/scenes/session-recordings/playlist/replayCollectionViewLogic.ts b/frontend/src/scenes/session-recordings/playlist/replayCollectionViewLogic.tsnew file mode 100644index 000000000000..cf67f6c6b66b--- /dev/null+++ b/frontend/src/scenes/session-recordings/playlist/replayCollectionViewLogic.ts@@ -0,0 +1,38 @@+import { MakeLogicType, kea, key, listeners, path, props } from 'kea'++import { SessionRecordingPlaylistLogicProps, sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'++export interface ReplayCollectionViewLogicProps {+ shortId: string+ listProps: SessionRecordingPlaylistLogicProps+ mainListProps?: SessionRecordingPlaylistLogicProps+}++// Generated by kea-typegen. Update if you're an agent, ignore if you're human.+export interface replayCollectionViewLogicMeta {+ key: string+}++export type replayCollectionViewLogicType = MakeLogicType<+ {},+ {},+ ReplayCollectionViewLogicProps,+ replayCollectionViewLogicMeta+>++export const replayCollectionViewLogic = kea<replayCollectionViewLogicType>([+ path((key) => ['scenes', 'session-recordings', 'playlist', 'replayCollectionViewLogic', key]),+ props({} as ReplayCollectionViewLogicProps),+ key((props) => props.shortId),+ listeners(({ props }) => ({+ [sessionRecordingsPlaylistLogic(props.listProps).actionTypes.setSelectedRecordingId]: ({+ id,+ }: {+ id: string | null+ }) => {+ if (id && props.mainListProps) {+ sessionRecordingsPlaylistLogic(props.mainListProps).actions.setSelectedRecordingId(id)+ }+ },+ })),+])diff --git a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.tsindex 6ace0695d6ae..d6ff1f8e9aba 100644--- a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts+++ b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.test.ts@@ -17,6 +17,7 @@ describe('replayListColumnLogic', () => {{ chosen: null, picksMode: 'picks', expected: 'picks' },{ chosen: 'recordings', picksMode: 'picks', expected: 'recordings' },{ chosen: 'picks', picksMode: null, expected: 'recordings' },+ { chosen: 'collections', picksMode: null, expected: 'collections' },] as const)('chosen $chosen with picks $picksMode shows $expected', ({ chosen, picksMode, expected }) => {if (chosen) {logic.actions.setSegment(chosen)@@ -33,6 +34,16 @@ describe('replayListColumnLogic', () => {expect(logic.values.segment).toBe(kept)})+ it.each([+ ['closes when the viewer goes back', (l: typeof logic) => l.actions.closeCollection()],+ ['closes when the segment changes', (l: typeof logic) => l.actions.setSegment('recordings')],+ ])('an open collection %s', (_, act) => {+ logic.actions.openCollection('abc')+ expect(logic.values.openCollectionShortId).toBe('abc')+ act(logic)+ expect(logic.values.openCollectionShortId).toBeNull()+ })+it('shows the recordings when its list is filtered to a person', () => {const playlistLogicProps = { logicKey: 'person' }const column = replayListColumnLogic({ logicKey: 'person', playlistLogicProps })diff --git a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.tsindex 95c2f6ff63b5..46bd432ad488 100644--- a/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts+++ b/frontend/src/scenes/session-recordings/playlist/replayListColumnLogic.ts@@ -3,7 +3,7 @@ import posthog from 'posthog-js'import { SessionRecordingPlaylistLogicProps, sessionRecordingsPlaylistLogic } from './sessionRecordingsPlaylistLogic'-export type ReplayListSegment = 'picks' | 'recordings'+export type ReplayListSegment = 'picks' | 'recordings' | 'collections'export type ReplayListSegmentSource = 'user' | 'person-filter'export type ReplayListPicksMode = 'picks' | 'recordings' | null@@ -22,14 +22,21 @@ export interface ReplayListColumnLogicProps {// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface replayListColumnLogicValues {effectiveSegmentFor: (picksMode: ReplayListPicksMode) => ReplayListSegment+ openCollectionShortId: string | nullsegment: ReplayListSegment | null}// Generated by kea-typegen. Update if you're an agent, ignore if you're human.export interface replayListColumnLogicActions {+ closeCollection: () => {+ value: true+ }dropSegmentChoice: () => {value: true}+ openCollection: (shortId: string) => {+ shortId: string+ }setSegment: (segment: ReplayListSegment,source?: ReplayListSegmentSource@@ -68,6 +75,8 @@ export const replayListColumnLogic = kea<replayListColumnLogicType>([// Or the choice resurfaces on a later recording.dropSegmentChoice: true,settleSegment: (picksMode: ReplayListPicksMode) => ({ picksMode }),+ openCollection: (shortId: string) => ({ shortId }),+ closeCollection: true,}),reducers({// Null until the viewer picks one, so the picks logic keeps deciding where a fresh page lands.@@ -75,6 +84,14 @@ export const replayListColumnLogic = kea<replayListColumnLogicType>([null as ReplayListSegment | null,{ setSegment: (_, { segment }) => segment, dropSegmentChoice: () => null },],+ openCollectionShortId: [+ null as string | null,+ {+ openCollection: (_, { shortId }) => shortId,+ closeCollection: () => null,+ setSegment: () => null,+ },+ ],}),selectors({effectiveSegmentFor: [