<?php
/**
 * View for shared navigation within Visitor Profiles/Recent Events
 *
 * @since      3.3.0
 *
 * @package    PersonalizeWP
 * @subpackage PersonalizeWP/Admin/Partials
 */

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

use PersonalizeWP\Admin\PageContacts;
use PersonalizeWP\Admin\PageActivities;
use PersonalizeWP\Admin\PageDataExport;

$current_page     = isset( $_REQUEST['page'] ) ? sanitize_text_field( wp_unslash( $_REQUEST['page'] ) ) : false; // phpcs:ignore WordPress.Security.NonceVerification.Recommended -- no site changes here.
$is_recent_events = PageActivities::SLUG === $current_page;
$is_profiles      = PageContacts::SLUG === $current_page;
$is_data_export   = PageDataExport::SLUG === $current_page;

// URLs for navigation
$recent_events_url = admin_url( add_query_arg( [ 'page' => PageActivities::SLUG ], 'admin.php' ) );
$profiles_url      = admin_url( add_query_arg( [ 'page' => PageContacts::SLUG ], 'admin.php' ) );
$data_export_url   = admin_url( add_query_arg( [ 'page' => PageDataExport::SLUG ], 'admin.php' ) );
?>

<nav class="header-nav">
	<ul class="nav-list">
		<li>
			<a class="nav-link <?php echo $is_recent_events ? esc_attr( 'is-active' ) : ''; ?>" href="<?php echo esc_url( $recent_events_url ); ?>">
				<?php esc_html_e( 'Recent Events', 'personalizewp' ); ?>
			</a>
		</li>
		<li>
			<a class="nav-link <?php echo $is_profiles ? esc_attr( 'is-active' ) : ''; ?>" href="<?php echo esc_url( $profiles_url ); ?>">
				<?php esc_html_e( 'Visitor Profiles', 'personalizewp' ); ?>
			</a>
		</li>
		<li>
			<a class="nav-link <?php echo $is_data_export ? esc_attr( 'is-active' ) : ''; ?>" href="<?php echo esc_url( $data_export_url ); ?>">
				<?php esc_html_e( 'Data Export', 'personalizewp' ); ?>
			</a>
		</li>
	</ul>
</nav>
