import { createElement, Component, useContext } from '@wordpress/element' import { sprintf, __ } from 'ct-i18n' import { Link, NavLink, useLocation } from 'react-router-dom' import ctEvents from 'ct-events' const Navigation = () => { const location = useLocation() const userNavigationLinks = [] const endUserNavigationLinks = [] ctEvents.trigger('ct:dashboard:navigation-links', userNavigationLinks) ctEvents.trigger( 'ct:dashboard:end-navigation-links', endUserNavigationLinks ) // Filter out @reach/router specific props and handle active states const filterLinkProps = (props, path) => { const { getProps, ...validProps } = props if (getProps && typeof getProps === 'function') { const currentPath = location.pathname const normalizedPath = path.startsWith('/') ? path : `/${path}` const normalizedCurrent = currentPath.startsWith('/') ? currentPath : `/${currentPath}` const isPartiallyCurrent = normalizedCurrent.startsWith(normalizedPath) || (normalizedPath !== '/' && normalizedCurrent.includes(normalizedPath)) const isCurrent = normalizedCurrent === normalizedPath || (normalizedPath === '/' && normalizedCurrent === '/') const activeProps = getProps({ isPartiallyCurrent, isCurrent }) return { ...validProps, ...activeProps } } return validProps } let hasPlugins = !ctDashboardLocalizations.plugin_data.hide_plugins_tab return (