import { athenaConfig, athenaConfigOptions } from '../../global/athena-config.js';
import { handleHtml } from '../../global/helpers/athena-global-helper.js';

/**
 * Append Product end Message
 *
 * @param currentPage
 * @param lastPage
 */
function appendProductEnd(currentPage, lastPage) {
    if(athenaConfig.InfiniteScrollStatus) {
        if(lastPage === currentPage) {
            let noMoreProducts = document.querySelector('.no-more-products');
            if(noMoreProducts){
                noMoreProducts.remove();
            }
            athenaConfigOptions.athenaContent.append(
                handleHtml(`
                      <div class="no-more-products product-end">
                            You have reached the end
                      </div>
                `, '.product-end')
            );
        } else {
            let noMoreProducts = document.querySelector('.no-more-products');
            if(noMoreProducts) noMoreProducts.remove();
        }
    }
}

//Exporting all Functions
export {
    appendProductEnd
}