File size: 818 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { useDispatch } from 'react-redux';
import { recordTrackForPost, recordAction } from 'calypso/reader/stats';
import { showSelectedPost } from 'calypso/reader/utils';
import Post from './post';

export default function EmptySearchRecommendedPost( {
	post,
	postKey,
	streamKey,
	fixedHeaderHeight,
} ) {
	const dispatch = useDispatch();

	function handlePostClick() {
		recordTrackForPost( 'calypso_reader_recommended_post_clicked', post, {
			recommendation_source: 'empty-search',
		} );
		recordAction( 'search_page_rec_post_click' );
		dispatch(
			showSelectedPost( {
				postKey: postKey,
				streamKey,
			} )
		);
	}
	if ( ! post ) {
		return null;
	}

	return (
		<Post
			post={ post }
			handleClick={ handlePostClick }
			fixedHeaderHeight={ fixedHeaderHeight }
			streamKey={ streamKey }
		/>
	);
}