<?php
/**
 * Post comment template
 *
 * @package wpstream-theme
 */

?>
	<div id="comments" class="wpstream_single_page_comments_form">
		<?php
		comment_form();
		?>
	</div>

<?php
$args = array(
	'status'                    => 'approve',
	'number'                    => '',
	'offset'                    => '',
	'orderby'                   => 'comment_date_gmt',
	'order'                     => 'ASC',
	'post_id'                   => $post->ID,
	'include_unapproved'        => array(),
	'type'                      => '',
	'parent'                    => '',
	'post_author'               => '',
	'post_name'                 => '',
	'post_parent'               => '',
	'user_id'                   => '',
	'search'                    => '',
	'count'                     => false,
	'meta_query'                => '', //phpcs:ignore WordPress.DB.SlowDBQuery.slow_db_query_meta_query
	'date_query'                => null,
	'hierarchical'              => false,
	'update_comment_meta_cache' => true,
	'update_comment_post_cache' => true,
);

$comments = get_comments( $args );//phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited

if ( ! empty( $comments ) ) {
	echo '<div class="wpstream_single_page_comments_lists d-flex flex-column">';

	foreach ( $comments as $comment ) {//phpcs:ignore WordPress.WP.GlobalVariablesOverride.Prohibited
		?>
		<div class="wpstream_comment_box d-flex align-items-start">

			<img class="rounded-circle flex-shrink-0" src="<?php echo esc_attr( wpstream_get_author_profile_image_url_by_author_id( $comment->user_id, 48 ) ); ?>" alt="<?php echo esc_attr( $comment->comment_author ); ?>">

			<div class="wpstream_comment_text d-flex flex-column">

				<p class="m-0">
					<b><?php echo esc_html( $comment->comment_author ); ?></b>
					<span><?php echo esc_html( wpstream_get_published_duration_by_date_time( $comment->comment_date ) ); ?></span>
				</p>

				<p class="m-0"><?php echo wp_kses_post( $comment->comment_content ); ?></p>

			</div>

		</div>
	<?php }

	echo '</div>';
}
?>