<?php

use Tangibledesign\Framework\Widgets\General\UserProfileWidget;

/* @var UserProfileWidget $mhCurrentWidget */
global $mhCurrentWidget;

$mhUser = $mhCurrentWidget->getUser();
if (!$mhUser) {
    return;
}

$mhUserImage = $mhUser->getImage();
?>
<div class="myhome-profile myhome-profile--single">
    <a
            class="myhome-profile__link-profile"
            href="<?php echo esc_url($mhUser->getUrl()); ?>"
    ></a>

    <div class="myhome-profile__image-wrapper">
        <?php if ($mhUserImage) : ?>
            <img
                    src="<?php echo esc_url($mhUserImage->getImageUrl()); ?>"
                    alt="<?php echo esc_attr($mhUser->getDisplayName()); ?>"
            >
        <?php endif; ?>
    </div>

    <div class="myhome-profile__details">
        <div class="myhome-profile__hidden">
            <?php if ($mhUser->hasSocialProfiles()) : ?>
                <div class="myhome-profile__social-icon">
                    <div class="myhome-social-profiles">
                        <?php if (!empty($mhUser->getFacebookProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getFacebookProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-facebook-f"></i>
                            </a>
                        <?php endif; ?>

                        <?php if (!empty($mhUser->getTwitterProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getTwitterProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-twitter"></i>
                            </a>
                        <?php endif; ?>

                        <?php if (!empty($mhUser->getLinkedInProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getLinkedInProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-linkedin"></i>
                            </a>
                        <?php endif; ?>

                        <?php if (!empty($mhUser->getInstagramProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getInstagramProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-instagram"></i>
                            </a>
                        <?php endif; ?>

                        <?php if (!empty($mhUser->getYouTubeProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getYouTubeProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-youtube"></i>
                            </a>
                        <?php endif; ?>

                        <?php if (!empty($mhUser->getTiktokProfile())) : ?>
                            <a
                                    class="myhome-social-profiles__single"
                                    href="<?php echo esc_url($mhUser->getTiktokProfile()); ?>"
                                    target="_blank"
                            >
                                <i class="fab fa-youtube"></i>
                            </a>
                        <?php endif; ?>
                    </div>
                </div>
            <?php endif; ?>
        </div>
    </div>
</div>
