HEX
Server: Apache
System: Linux webd006.cluster128.gra.hosting.ovh.net 6.18.42-ovh-vps-grsec-zfs+ #1 SMP PREEMPT_DYNAMIC Wed Aug 5 15:59:48 CEST 2026 x86_64
User: zwafgyp (177615)
PHP: 7.4.33
Disabled: _dyuweyrj4,_dyuweyrj4r,dl
Upload Files
File: /home/zwafgyp/lacalita/wp-content/plugins/chaty-pro/src/modules/header.js
import compose from "../compose";
import saveButton from '../components/save-button';

import withLayoutChange from "../hoc/with-layout-change";
const $ = window.jQuery;

function header( props ) {

    const $header = $('.chaty-header');
    const $widgetBody = $('#chaty-widget-body-tab');

    if( $header.length === 0 ) return;

    /**
     * on wordpress sidebar change, change the header position 
     * @props style = { left: value, top: value, width: value }
     */ 
    props.onLayoutChange( style => {
        $header.css(style);
        $widgetBody.css('margin-top', `${style.content}px`)
    })

    // bring content into view
    $header.find('.chaty-tab').on('click', function(){
        if( $header.css('position') === 'fixed' ) {
            window.scrollTo({
                top: $header.outerHeight() + 32 + 'px',
                left: 0,
                behavior: 'smooth'
            });
        }
    })

    // save button handler
    saveButton();

};

export default compose(
    withLayoutChange()
)( header )