<?php
if ( ! defined( 'ABSPATH' ) ) {
	exit; // Prevent direct access to the script.
}

global $current_user;

$profile_id   = $args['profile_id'] ?? gigneo_active_profile_id();
$profile_name = gigneo_profile_name( $profile_id );
$thumbnail_id = ! empty( $profile_id ) ? get_post_thumbnail_id( $profile_id ) : '';
$cover_image  = gigneo_post_meta( $profile_id, '_gigneo_pm_cover_image' );
?>
<div id="gn-profile-media" class="gn-profile-setting-media-wrapper">
	<!--Cover-->
	<div id="gn-profile-cover-image" class="gn-profile-cover">
		<?php gigneo_attachment_image_src( $cover_image, 'full' ); ?>
		<input type="hidden" name="cover_image" value="<?php echo esc_attr( $cover_image ); ?>" />
		<button id="gn-change-profile-cover" type="button" class="gn-change-profile-cover-btn">
			<i class="hi hi-camera" aria-hidden="true"></i>
		</button>
	</div>
	<!--Profile-->
	<div class="gn-profile-image-wrapper">
		<div id="gn-profile-image" class="gn-profile-image">
			<?php gigneo_attachment_image_src( $thumbnail_id, 'medium', 'profile' ); ?>
			<input type="hidden" name="profile_image" value="<?php echo esc_attr( $thumbnail_id ); ?>" />
			<button id="gn-change-profile-image" type="button" class="gn-change-profile-image-btn"><i
					class="hi hi-camera" aria-hidden="true"></i></button>
		</div>
		<div class="gn-profile-info">
			<div class="gn-name-wrapper">
				<h3 class="gn-name"><?php echo esc_html( $profile_name ); ?></h3>
				<?php gigneo_verification_badge( $profile_id, true ); ?>
			</div>
			<p class="gn-email"><?php echo esc_html( $current_user->user_email ); ?></p>
		</div>
		<div class="gn-profile-media-actions">
			<a href="<?php echo esc_url( get_permalink( $profile_id ) ); ?>" target="_blank"
				class="gn-btn gn-btn-outline-grey gn-btn-sm"><?php echo esc_html__( 'View profile', 'gigneo' ); ?><i
					class="hi hi-arrow-up-right"></i></a>
		</div>
	</div>
</div>