diff --git a/src/renderer/src/components/VirtualList/dynamic.tsx b/src/renderer/src/components/VirtualList/dynamic.tsx index 07fe5b1703..e2644fea35 100644 --- a/src/renderer/src/components/VirtualList/dynamic.tsx +++ b/src/renderer/src/components/VirtualList/dynamic.tsx @@ -81,6 +81,16 @@ export interface DynamicVirtualListProps extends InheritedVirtualizerOptions * Hide the scrollbar automatically when scrolling is stopped */ autoHideScrollbar?: boolean + + /** + * Header content to display above the list + */ + header?: React.ReactNode + + /** + * Additional CSS class name for the container + */ + className?: string } function DynamicVirtualList(props: DynamicVirtualListProps) { @@ -95,6 +105,8 @@ function DynamicVirtualList(props: DynamicVirtualListProps) { itemContainerStyle, scrollerStyle, autoHideScrollbar = false, + header, + className, ...restOptions } = props @@ -189,7 +201,7 @@ function DynamicVirtualList(props: DynamicVirtualListProps) { return ( (props: DynamicVirtualListProps) { ...(horizontal ? { width: size ?? '100%' } : { height: size ?? '100%' }), ...scrollerStyle }}> + {header}
= ({ agentId }) => { } return ( - - - {t('agent.session.add.title')} - - {/* h-9 */} - 9 * 4} - scrollerStyle={{ - // FIXME: This component only supports CSSProperties - overflowX: 'hidden' - }} - autoHideScrollbar> - {(session) => ( - handleDeleteSession(session.id)} - onPress={() => setActiveSessionId(agentId, session.id)} - /> - )} - - + 9 * 4} + // FIXME: This component only supports CSSProperties + scrollerStyle={{ overflowX: 'hidden' }} + autoHideScrollbar + header={ + + {t('agent.session.add.title')} + + }> + {(session) => ( + handleDeleteSession(session.id)} + onPress={() => setActiveSessionId(agentId, session.id)} + /> + )} + ) } -const Container = styled(Scrollbar)` +const StyledVirtualList = styled(DynamicVirtualList)` display: flex; flex-direction: column; padding: 12px 10px; - overflow-x: hidden; height: 100%; -` +` as typeof DynamicVirtualList export default memo(Sessions)