<?php
if ( ! class_exists( 'PWP\Core' ) && ! PWP_EDD::is_wpcom() && ! PWP_EDD::is_woo() ) {
	require get_theme_file_path() . '/inc/pwp-dashboard/need-pwp-plugin.php'; // phpcs:ignore WPThemeReview.CoreFunctionality.FileInclude.FileIncludeFound
	return;
}
?>

<?php if ( ! class_exists( 'PWP\Core' ) && PWP_EDD::is_wpcom() || ! class_exists( 'PWP\Core' ) && PWP_EDD::is_woo() ) { // Display alternate content if WP.com ?>

    <h2 class="wp-block-heading alignwide has-pwp-huge-font-size"><?php echo esc_html__( 'PortfolioWP Setup', 'portfolio-wp' ); ?></h2>

    <p style="font-size:clamp(0.875rem, 0.875rem + ((1vw - 0.2rem) * 0.444), 1.15rem);" class="alignwide"><?php echo esc_html__( 'Just some helpful links and services to get you up and running faster.', 'portfolio-wp' ); ?></p>
    
    <div id="pwp-setup-wpcom" class="wp-block-group alignwide is-layout-constrained wp-block-group-is-layout-constrained">

        <div class="pwp-admin-blocks-container alignwide">

            <div class="pwp-admin-block">
                <div class="pwp-admin-block-content">
                    <span class="pwp-admin-block-icon"><i class="fa-solid fa-arrow-down"></i></span>
                    <h4 class="wp-block-heading has-normal-font-size"><?php echo esc_html__( 'Demo Content', 'portfolio-wp' ); ?></h4>
                    <p><?php echo esc_html__( 'Download the demo content file. Install the content under ', 'portfolio-wp' ) . '<i>' . esc_html__( 'Tools > Import', 'portfolio-wp' ) . '</i>' . esc_html__( ' within the WordPress dashboard in order to setup your theme like the ', 'portfolio-wp' ) . '<a href="' . esc_url( 'https://portfoliowp.com/demo/' ) . '" target="_blank">' . esc_html__( 'demo', 'portfolio-wp' ) . '</a>.'; ?>
                    </p>
                </div>
                <div class="wp-block-button wp-block-button__width-100 has-small-font-size">
                    <a class="wp-block-button__link has-text-align-center wp-element-button" href="<?php echo esc_url( 'https://portfoliowp.com/wp-content/demo-content/pwp-demo-content.zip' ); ?>"><?php echo esc_html__( 'Download Demo Content', 'portfolio-wp' ); ?></a>
                </div>
            </div>

            <div class="pwp-admin-block">
                <div class="pwp-admin-block-content">
                    <span class="pwp-admin-block-icon"><i class="fa-solid fa-book"></i></span>
                    <h4 class="wp-block-heading has-normal-font-size"><?php echo esc_html__( 'Setup Instructions', 'portfolio-wp' ); ?></h4>
                    <p><?php echo esc_html__( 'Need a little help getting started? Check out the theme setup instructions on our website to stay on track. We\'ll get you up and running!', 'portfolio-wp' ); ?></p>
                </div>
                <div class="wp-block-button wp-block-button__width-100 has-small-font-size">
                    <a class="wp-block-button__link has-text-align-center wp-element-button" target="_blank" href="<?php echo esc_url( 'https://portfoliowp.com/documentation/' ); ?>"><?php echo esc_html__( 'View Setup Instructions', 'portfolio-wp' ); ?></a>
                </div>
            </div>

            <?php if ( PWP_EDD::is_wpcom() ) { ?>
            
                <div class="pwp-admin-block">
                    <div class="pwp-admin-block-content">
                        <span class="pwp-admin-block-icon"><i class="fa-solid fa-wrench"></i></span>
                        <h4 class="wp-block-heading has-normal-font-size"><?php echo esc_html__( 'Setup Service', 'portfolio-wp' ); ?></h4>
                        <p><?php echo esc_html__( 'Get some peace of mind and hire the professionals to setup your website as it appears in the theme demo. We\'ll even add your logo and change the colors.', 'portfolio-wp' ); ?></p>
                    </div>
                    <div class="wp-block-button wp-block-button__width-100 has-small-font-size">
                        <a class="wp-block-button__link has-text-align-center wp-element-button" href="<?php echo esc_url( 'https://portfoliowp.com/theme-setup/' ); ?>"><?php echo esc_html__( 'Theme Setup Service | $199', 'portfolio-wp' ); ?></a>
                    </div>
                </div>

            <?php } else { ?>

                <?php
                $installed = pwp_is_plugin_installed( 'portfolio-wp-plugin' );
                $active = is_plugin_active( 'portfolio-wp-plugin' );
                ?>

                <div class="pwp-admin-block">
                    <div class="pwp-admin-block-content">
                        <span class="pwp-admin-block-icon"><i class="fa-solid fa-wrench"></i></span>
                        <h4 class="wp-block-heading has-normal-font-size"><?php echo esc_html__( 'Setup Wizard', 'portfolio-wp' ); ?></h4>
                        <p><?php echo esc_html__( 'Click the button below to install the PortfolioWP Plugin and enable the setup wizard, and we\'ll walk you through the steps to setup your theme exactly like the demo.', 'portfolio-wp' ); ?></p>
                    </div>
                    <div class="wp-block-button wp-block-button__width-100 has-small-font-size">
                        <form method="post" action="">
                            <input type="hidden" name="pwp_install_plugin" value="1">
                            <input type="hidden" name="pwp_plugins_to_install[]" value="portfolio-wp-plugin" checked="checked" />
                            <?php
                            wp_nonce_field( 'pwp_install_plugin_nonce', 'pwp_install_plugin_nonce_field' );
                            $button_text = $installed && ! $active ? __( 'Activate PortfolioWP Plugin', 'portfolio-wp' ) : __( 'Install & Activate PortfolioWP Plugin', 'portfolio-wp' );
                            $custom_classes = 'wp-block-button__link has-text-align-center wp-element-button';
                            submit_button( $button_text, $custom_classes, '', false );
                            ?>
                        </form>
                    </div>
                </div>
            
            <?php } ?>

        </div>

    </div>
    
<?php } else { ?>

    <h2 class="wp-block-heading alignwide has-pwp-huge-font-size"><?php echo esc_html__( 'PortfolioWP Setup Wizard', 'portfolio-wp' ); ?></h2>

    <div id="pwp-react-importer" class="alignwide"><?php echo esc_html__( 'Loading...', 'portfolio-wp' ); ?></div>

<?php } ?>