<?php
/**
 * Replies Loop - Single Reply
 *
 * @package    bbPress
 * @subpackage Theme
 */

// Exit if accessed directly
defined( 'ABSPATH' ) || exit;
?>

<div id="post-<?php bbp_reply_id(); ?>" <?php bbp_reply_class( get_the_ID(), array( 'forum-comment' ) ); ?>>
	<?php do_action( 'bbp_theme_before_reply_author_details' ); ?>

    <?php if ( bbp_is_single_user() || bbp_is_single_user_replies() ) : // USER PROFILE PAGE LAYOUT ?>
    
        <div class="forum-post-top">
            <div class="bbp-author-wrap">
                <?php
                // Reply author Avatar
                bbp_reply_author_link( array(
                    'sep'       => '',
                    'show_role' => false,
                    'type'      => 'avatar',
                    'size'      => 40
                ) );
                ?>
                <div class="forum-post-author">
                    <div class="topic-author frmx-d-flex frmx-mb-1">
                        <?php
                        // Reply author Name
                        bbp_reply_author_link( array(
                            'sep'       => '',
                            'show_role' => false,
                            'type'      => 'name',
                        ) );
                        ?>
                        <div class="author-badge badge <?php echo sanitize_title( forumax_get_bbp_reply_user_role( bbp_get_reply_id() ) ) ?>">
                            <?php forumax_bbp_user_role_icon(); ?>
                            <span><?php echo forumax_get_bbp_reply_user_role( bbp_get_reply_id() ); ?></span>
                        </div>
                    </div>
                    <div class="forum-author-meta meta">
                        <span title="<?php bbp_reply_post_date( bbp_get_reply_id() ); ?>">
                            <?php bbp_reply_post_date( bbp_get_reply_id(), true ); ?>
                        </span>
                    </div>
                    <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
                </div>
            </div>
            <!-- Reply right side actions -->
            <div class="reply-admin-links">
                <?php if ( isset( $GLOBALS['bbp_private_replies'] ) && $GLOBALS['bbp_private_replies']->is_private( bbp_get_reply_id() ) && $GLOBALS['bbp_private_replies']->can_view_private_reply( bbp_get_reply_id() ) ) : ?>
                    <span class="private-reply-badge" title="<?php esc_attr_e( 'Private reply', 'forumax' ); ?>">
                        <?php esc_html_e( 'Private', 'forumax' ); ?>
                    </span>
                <?php endif; ?>
                <span class="reply-admin-menu-wrap">
                    <?php echo forumax_get_reply_admin_links(); ?>
                </span>
            </div>
        </div>
            <div class="comment-content">
                <?php
                do_action( 'bbp_theme_before_reply_content' );
                bbp_reply_content();
                do_action( 'bbp_theme_after_reply_content' );
                ?>
            </div>

    <?php else : // SINGLE TOPIC THREAD LAYOUT ?>

        <div class="frmx-reply-avatar">
            <?php
            // Reply author Avatar
            bbp_reply_author_link( array(
                'sep'       => '',
                'show_role' => false,
                'type'      => 'avatar',
                'size'      => 40
            ) );

            do_action( 'forumax_reply_avatar_voting', get_post( bbp_get_reply_id() ) );
            ?>
        </div>

        <div class="frmx-reply-card">
            <div class="forum-post-top">
                <div class="bbp-author-wrap">
                    <div class="forum-post-author">
                        <div class="topic-author frmx-d-flex frmx-mb-1">
                            <?php
                            // Reply author Name
                            bbp_reply_author_link( array(
                                'sep'       => '',
                                'show_role' => false,
                                'type'      => 'name',
                            ) );
                            ?>
                            <div class="author-badge badge <?php echo sanitize_title( forumax_get_bbp_reply_user_role( bbp_get_reply_id() ) ) ?>">
                                <?php forumax_bbp_user_role_icon(); ?>
                                <span><?php echo forumax_get_bbp_reply_user_role( bbp_get_reply_id() ); ?></span>
                            </div>
                        </div>

                        <div class="forum-author-meta meta">
                            <span title="<?php bbp_reply_post_date( bbp_get_reply_id() ); ?>">
                                <?php bbp_reply_post_date( bbp_get_reply_id(), true ); ?>
                            </span>
                        </div>
                        <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
                    </div>
                </div>
                <!-- Reply right side actions -->
                <div class="reply-admin-links">
                    <?php if ( isset( $GLOBALS['bbp_private_replies'] ) && $GLOBALS['bbp_private_replies']->is_private( bbp_get_reply_id() ) && $GLOBALS['bbp_private_replies']->can_view_private_reply( bbp_get_reply_id() ) ) : ?>
                        <span class="private-reply-badge" title="<?php esc_attr_e( 'Private reply', 'forumax' ); ?>">
                            <?php esc_html_e( 'Private', 'forumax' ); ?>
                        </span>
                    <?php endif; ?>
                    <span class="reply-admin-menu-wrap">
                        <?php echo forumax_get_reply_admin_links(); ?>
                    </span>
                </div>
            </div>
            <div class="comment-content">
                <?php
                do_action( 'bbp_theme_before_reply_content' );
                bbp_reply_content();
                do_action( 'bbp_theme_after_reply_content' );
                ?>
            </div>
        </div>

    <?php endif; ?>

</div>