| Server IP : 38.190.208.107 / Your IP : 216.73.217.46 Web Server : nginx/1.28.1 System : Linux ht2026040333114 6.1.0-10-amd64 #1 SMP PREEMPT_DYNAMIC Debian 6.1.37-1 (2023-07-03) x86_64 User : root ( 0) PHP Version : 8.2.28 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv,eval,assert,passthru,system,exec,shell_exec,popen,proc_open MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : /www/wwwroot/wp.9/wp-content/themes/blocksy/admin/dashboard/static/js/ |
Upload File : |
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 (
<ul className="dashboard-navigation">
<li>
<NavLink
to="/"
className={({ isActive }) => (isActive ? 'active' : '')}>
{__('Home', 'blocksy')}
</NavLink>
</li>
{userNavigationLinks.map(({ path, text, ...props }) => (
<li key={path}>
<NavLink
to={path}
{...filterLinkProps(props, path)}
className={({ isActive }) =>
isActive ? 'active' : ''
}>
{text}
</NavLink>
</li>
))}
{!ctDashboardLocalizations.plugin_data.hide_plugins_tab && (
<li>
<NavLink
to="/plugins"
className={({ isActive }) =>
isActive ? 'active' : ''
}>
{__('Useful Plugins', 'blocksy')}
</NavLink>
</li>
)}
{!ctDashboardLocalizations.plugin_data.hide_changelogs_tab && (
<li>
<NavLink
to="/changelog"
className={({ isActive }) =>
isActive ? 'active' : ''
}>
{__('Changelog', 'blocksy')}
</NavLink>
</li>
)}
{endUserNavigationLinks.map(({ path, text, ...props }) => (
<li key={path}>
<NavLink
to={path}
{...filterLinkProps(props, path)}
className={({ isActive }) =>
isActive ? 'active' : ''
}>
{text}
</NavLink>
</li>
))}
</ul>
)
}
export default Navigation