<?php
/**
 * View for shared navigation within Rules/Categories
 *
 * @since      1.0.0
 *
 * @package    PersonalizeWP
 * @subpackage PersonalizeWP/Admin/Partials
 */

use PersonalizeWP\Admin\PageRules;
use PersonalizeWP\Admin\PageCategories;

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

$current_page  = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no site changes here.
$is_rules_page = PageRules::SLUG === $current_page;
$is_cats_page  = PageCategories::SLUG === $current_page;
?>

<nav class="header-nav">
	<ul class="nav-list">
		<li>
			<a class="nav-link <?php echo $is_rules_page ? esc_attr( 'is-active' ) : ''; ?>" href="<?php echo esc_url( admin_url( PageRules::$index_url ) ); ?>"> <?php esc_html_e( 'Rules', 'personalizewp' ); ?></a>
		</li>
		<li>
			<a class="nav-link <?php echo $is_cats_page ? esc_attr( 'is-active' ) : ''; ?>" href="<?php echo esc_url( admin_url( PageCategories::$index_url ) ); ?>"> <?php esc_html_e( 'Categories', 'personalizewp' ); ?></a>
		</li>
	</ul>
</nav>
