<?php

if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly

require_once REACTIFY_BLOCK_INCLUDES_PATH . '/ajax.php';

if ( ! function_exists( 'reactify_scripts' ) ) :

    function reactify_scripts() {
    	/**
         * Enqueue scripts and styles.
         */
        wp_enqueue_style( 'reactify-style', REACTIFY_BLOCK_INCLUDES_URL . '/assets/css/wp-reactions.css', array(), REACTIFY_BLOCK_VERSION );

        wp_enqueue_style( 'reactify-responsive-style', REACTIFY_BLOCK_INCLUDES_URL . '/assets/css/wp-responsive.css', array(), REACTIFY_BLOCK_VERSION );
        
        wp_enqueue_script( 'reactify-scripts', REACTIFY_BLOCK_INCLUDES_URL . '/assets/js/wp-reaction-scripts.js', array( 'jquery' ), REACTIFY_BLOCK_VERSION, true );

        wp_localize_script( 'reactify-scripts', 'RF_JSObject',
            array(
                'ajaxUrl'          => admin_url( 'admin-ajax.php' ),
                '_wpnonce'         => wp_create_nonce( 'reactify-nonce' ),
            )
        );
    }
    
endif;
    
add_action( 'wp_enqueue_scripts', 'reactify_scripts' );


if ( ! function_exists( 'reactify_admin_scripts' ) ) :

    /**
     * Enqueue admin scripts and styles.
     */
    function reactify_admin_scripts( $hook ) {

        wp_enqueue_style( 'reactify-admin-style', REACTIFY_BLOCK_INCLUDES_URL . '/assets/css/wp-admin-reactions.css', array(), REACTIFY_BLOCK_VERSION );

        wp_enqueue_style( 'reactify-admin-dashboard-style', REACTIFY_BLOCK_INCLUDES_URL . '/assets/css/wp-admin-dashboard.css', array(), REACTIFY_BLOCK_VERSION );

        wp_enqueue_style( 'reactify-admin-responsive-style', REACTIFY_BLOCK_INCLUDES_URL . '/assets/css/wp-admin-responsive.css', array(), REACTIFY_BLOCK_VERSION );

        wp_enqueue_style( 'reactify-box-icons', REACTIFY_BLOCK_INCLUDES_URL . '/assets/library/box-icons/css/boxicons.min.css', array(), REACTIFY_BLOCK_VERSION );

        wp_enqueue_script( 'reactify-admin-scripts', REACTIFY_BLOCK_INCLUDES_URL . '/assets/js/reaction-admin.js', array( 'jquery' ), REACTIFY_BLOCK_VERSION, true );

        wp_enqueue_script( 'jquery-ui-sortable' );

        wp_localize_script( 'reactify-admin-scripts', 'RF_JSObject',
            array(
                'ajaxUrl'       => admin_url( 'admin-ajax.php' ),
                'emojiBaseUrl'  => REACTIFY_BLOCK_INCLUDES_URL . '/assets/images',
                '_wpnonce'      => wp_create_nonce( 'reactify-nonce' ),
            )
        );
    }

endif;

add_action( 'admin_enqueue_scripts', 'reactify_admin_scripts' );