<?php
// Home Page Option Component
// This adds a floating home button to navigate back to the main dashboard

function renderHomePageOption() {
    ?>
    <div class="home-page-option">
        <button class="home-page-btn" onclick="window.location.href='index.php'" title="হোম পেজে ফিরে যান">
            <i class="fas fa-home"></i>
        </button>
    </div>
    
    <script>
        // Auto-hide home button on scroll
        let lastScrollTop = 0;
        const homeBtn = document.querySelector('.home-page-btn');
        
        window.addEventListener('scroll', function() {
            let scrollTop = window.pageYOffset || document.documentElement.scrollTop;
            
            if (scrollTop > lastScrollTop && scrollTop > 100) {
                // Scrolling down
                document.querySelector('.home-page-option').style.opacity = '0.5';
            } else {
                // Scrolling up
                document.querySelector('.home-page-option').style.opacity = '1';
            }
            
            lastScrollTop = scrollTop;
        });
        
        // Add keyboard shortcut (press 'H' to go home)
        document.addEventListener('keydown', function(e) {
            if (e.key.toLowerCase() === 'h' && e.ctrlKey) {
                e.preventDefault();
                window.location.href = 'index.php';
            }
        });
    </script>
    <?php
}
?>