import { createElement, Component } from '@wordpress/element' import { Provider, getDefaultValue } from './context' import createHashSource from 'hash-source' import Heading from './Heading' import { Router, Link, Location, LocationProvider, createHistory } from '@reach/router' import ctEvents from 'ct-events' import { Transition, animated } from 'react-spring' import Navigation from './Navigation' import Home from './screens/Home' import SystemStatus from './screens/SystemStatus' import RecommendedPlugins from './screens/RecommendedPlugins' import Changelog from './screens/Changelog' let history = createHistory(createHashSource()) /* ctEvents.on('ct:dashboard:routes', r => r.push({ Component: () =>
hello
, path: '/test' }) ) */ const SpringRouter = ({ children }) => ( {({ location }) => ( location.pathname} from={{ opacity: 0 }} enter={[{ opacity: 1 }]} leave={[{ opacity: 0 }]} config={(key, phase) => { return phase === 'leave' ? { duration: 300 } : { delay: 300, duration: 300 } }}> {location => props => ( {children} )} )} ) const FadeTransitionRouter = props => ( {({ location }) => ( {/* the only difference between a router animation and any other animation is that you have to pass the location to the router so the old screen renders the "old location" */} {props.children} )} ) export default class Dashboard extends Component { render() { const userRoutes = [] ctEvents.trigger('ct:dashboard:routes', userRoutes) return (
{userRoutes.map(({ Component, path }) => ( ))}
) } }