 <?php
 
 /**
 * =============================================================================
 * @package         Blue Raven (Free Version)
 * @Plugin URI      https://enterrahost.com/plugins/blue-raven
 * 
 * @Author          EnterraHost
 * @Author URI      https://enterrahost.com
 * @License         GPL-2.0-or-later
 *  
 * @Copyright       (c) 2025 EnterraHost
 * @Contents        Displays a dynamic image block.
 *
 * =============================================================================
 * 
 * || INDEX:
 * ||   - IMAGE BLOCK
 * || 
 * =============================================================================
 */

if ( ! defined( 'ABSPATH' ) ) exit; 

/*
============================================================
    IMAGE BLOCK
============================================================
*/

$unique_id = uniqid() . '-' . time();
$placeholder_url = BLUERAVEN_PLUGIN_URL . 'assets/media/blue_raven_place_holder.webp';

?>
    <div class="image-block" style="margin: 2rem 0 1rem 0;" data-image-id=''>
        <div class="flex-sb">
            <div class="spacing-right">
                <img src="<?php echo esc_url($placeholder_url); ?>" alt="<?php esc_attr_e('A placeholder image', 'blue-raven'); ?>" width="150" style="cursor: pointer;" class="media-post-image">
            </div>
            <div style="width: 98%; display: flex; flex-direction: column; justify-content: space-between;">
                <div class="flex-sb">
                    <div style="align-content: center; height: 2.5rem;">
                        <input type="checkbox" id="star-thumbnail-<?php echo esc_attr($unique_id); ?>" class="br-star-checkbox" name="star-thumbnail">
                        <label for="star-thumbnail-<?php echo esc_attr($unique_id); ?>" class="br-star-label">★</label>
                    </div>
                    <button type="button" class="remove-image-block text-button" style="align-self: flex-start;">❌</button>
                </div>
                <div class="flex-right spacing-bottom" style="width: 100%;">
                    <label for="alt-text-<?php echo esc_attr($unique_id); ?>" class="text-center">
                        <h4 class="no-margin-padding spacing-right-small text-center" style='min-width: 3.5rem;'>
                            <?php esc_html_e('Alt Text', 'blue-raven'); ?>
                        </h4>
                    </label>
                    <input type="text" name="alt-text" id="alt-text-<?php echo esc_attr($unique_id); ?>" placeholder="<?php esc_attr_e('Enter alternative text', 'blue-raven'); ?>" class="br-input media-post-image-alt" style="width: 85%;">
                    <button type="button" class="enterra-button save-alt-text" style="margin-left: 1rem;">
                        <?php esc_html_e('Save', 'blue-raven'); ?>
                    </button>
                </div>
            </div>
        </div>
    </div>
<?php    