Skip to content

Commit

Permalink
fix: show other recordings in playlist (#25104)
Browse files Browse the repository at this point in the history
  • Loading branch information
daibhin authored Sep 23, 2024
1 parent e1c0eb6 commit 8c4939d
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 3 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions frontend/src/lib/components/Playlist/Playlist.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export type PlaylistProps<T> = {
// Optionally select the first item in the list. Only works in controlled mode
selectInitialItem?: boolean
onSelect?: (item: T) => void
onChangeSections?: (activeKeys: string[]) => void
'data-attr'?: string
activeItemId?: string
}
Expand All @@ -67,6 +68,7 @@ export function Playlist<
listEmptyState,
selectInitialItem,
onSelect,
onChangeSections,
'data-attr': dataAttr,
}: PlaylistProps<T>): JSX.Element {
const [controlledActiveItemId, setControlledActiveItemId] = useState<T['id'] | null>(
Expand Down Expand Up @@ -111,6 +113,7 @@ export function Playlist<
onClickCollapse={() => setListCollapsed(true)}
activeItemId={activeItemId}
setActiveItemId={onChangeActiveItem}
onChangeSections={onChangeSections}
emptyState={listEmptyState}
/>
)}
Expand Down Expand Up @@ -146,6 +149,7 @@ function List<
setActiveItemId,
headerActions = [],
sections,
onChangeSections,
activeItemId,
onScrollListEdge,
loading,
Expand All @@ -158,6 +162,7 @@ function List<
setActiveItemId: (item: T) => void
headerActions: PlaylistProps<T>['headerActions']
sections: PlaylistProps<T>['sections']
onChangeSections?: (activeKeys: string[]) => void
onScrollListEdge: PlaylistProps<T>['onScrollListEdge']
loading: PlaylistProps<T>['loading']
emptyState: PlaylistProps<T>['listEmptyState']
Expand Down Expand Up @@ -254,6 +259,7 @@ function List<
),
className: 'p-0',
}))}
onChange={onChangeSections}
multiple
embedded
size="small"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ export function SessionRecordingsPlaylist(props: SessionRecordingPlaylistLogicPr
activeSessionRecordingId,
hasNext,
} = useValues(logic)
const { maybeLoadSessionRecordings, summarizeSession, setSelectedRecordingId, setFilters } = useActions(logic)
const { maybeLoadSessionRecordings, summarizeSession, setSelectedRecordingId, setFilters, setShowOtherRecordings } =
useActions(logic)

const { featureFlags } = useValues(featureFlagLogic)
const isTestingSaved = featureFlags[FEATURE_FLAGS.SAVED_NOT_PINNED] === 'test'
Expand Down Expand Up @@ -108,6 +109,7 @@ export function SessionRecordingsPlaylist(props: SessionRecordingPlaylistLogicPr
title="Recordings"
embedded={!!notebookNode}
sections={sections}
onChangeSections={(activeSections) => setShowOtherRecordings(activeSections.includes('other'))}
headerActions={[
{
key: 'settings',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -308,7 +308,7 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
summarizeSession: (id: SessionRecordingType['id']) => ({ id }),
loadNext: true,
loadPrev: true,
toggleShowOtherRecordings: (show?: boolean) => ({ show }),
setShowOtherRecordings: (show: boolean) => ({ show }),
}),
propsChanged(({ actions, props }, oldProps) => {
// If the defined list changes, we need to call the loader to either load the new items or change the list
Expand Down Expand Up @@ -445,7 +445,7 @@ export const sessionRecordingsPlaylistLogic = kea<sessionRecordingsPlaylistLogic
{
loadPinnedRecordingsSuccess: (state, { pinnedRecordings }) =>
pinnedRecordings.length === 0 ? true : state,
toggleShowOtherRecordings: (state, { show }) => (show === undefined ? !state : show),
setShowOtherRecordings: (_, { show }) => show,
},
],
unusableEventsInFilter: [
Expand Down

0 comments on commit 8c4939d

Please sign in to comment.