47 lines
1.2 KiB
JavaScript
47 lines
1.2 KiB
JavaScript
import { useLocation } from 'react-router-dom'
|
||
import DashboardSidebar from '../common/DashboardSidebar'
|
||
import { Typography } from 'antd'
|
||
|
||
const { Text } = Typography
|
||
|
||
const items = [
|
||
{
|
||
key: 'sessionstorage',
|
||
label: 'Session Storage',
|
||
icon: <Text>🗃️</Text>,
|
||
path: '/dashboard/developer/sessionstorage'
|
||
},
|
||
{
|
||
key: 'authcontextdebug',
|
||
label: 'Auth Debug',
|
||
icon: <Text>🔐</Text>,
|
||
path: '/dashboard/developer/authcontextdebug'
|
||
},
|
||
{
|
||
key: 'printservercontextdebug',
|
||
label: 'Print Server Debug',
|
||
icon: <Text>🖨️</Text>,
|
||
path: '/dashboard/developer/printservercontextdebug'
|
||
}
|
||
]
|
||
|
||
const routeKeyMap = {
|
||
'/dashboard/developer/sessionstorage': 'sessionstorage',
|
||
'/dashboard/developer/authcontext': 'authcontextdebug',
|
||
'/dashboard/developer/printservercontext': 'printservercontextdebug'
|
||
}
|
||
|
||
const DeveloperSidebar = (props) => {
|
||
const location = useLocation()
|
||
const selectedKey = (() => {
|
||
const match = Object.keys(routeKeyMap).find((path) =>
|
||
location.pathname.startsWith(path)
|
||
)
|
||
return match ? routeKeyMap[match] : 'sessionstorage'
|
||
})()
|
||
|
||
return <DashboardSidebar items={items} selectedKey={selectedKey} {...props} />
|
||
}
|
||
|
||
export default DeveloperSidebar
|