import { RelatedPostCard } from 'calypso/blocks/reader-related-card';
import { recordTrackForPost, recordAction } from 'calypso/reader/stats';

export default function EmptySearchRecommendedSite( { post } ) {
	function handlePostClick() {
		recordTrackForPost( 'calypso_reader_recommended_site_clicked', post, {
			recommendation_source: 'empty-search-site',
		} );
		recordAction( 'search_page_rec_post_click' );
	}

	function handleSiteClick() {
		recordTrackForPost( 'calypso_reader_recommended_site_clicked', post, {
			recommendation_source: 'empty-search-site',
		} );
		recordAction( 'search_page_rec_site_click' );
	}

	const site = { title: post && post.site_name };

	/* eslint-disable  wpcalypso/jsx-classname-namespace */
	return (
		<div className="search-stream__recommendation-list-item" key={ post && post.global_ID }>
			<RelatedPostCard
				post={ post }
				site={ site }
				onSiteClick={ handleSiteClick }
				onPostClick={ handlePostClick }
			/>
		</div>
	);
}
