This is probably very simple but I'm just not seeing it.
I have a custom route that mimics somewhat the payload dashboard page using a button component like so:
import React from 'react'
import { DefaultTemplate } from 'payload/components/templates'
import { useConfig } from 'payload/components/utilities'
import { AdminView } from 'payload/config'
import { Button, Card } from 'payload/components/elements'
import { useHistory } from 'react-router-dom'
import './index.scss'
const baseClass = 'thing-ui'
const CustomUi :AdminView = () => {
const { routes: { admin: adminRoute } } = useConfig()
const { push } = useHistory()
return (
<DefaultTemplate className={baseClass}>
<Card
title={'Example'}
id={`card-example`}
onClick={() => push({ pathname: `${adminRoute}/custom/thing` })}
actions={(
<Button
el="link"
to={`${adminRoute}/custom/thing`}
icon="plus"
round
buttonStyle="icon-label"
iconStyle="with-border"
/>
)}
/>
</DefaultTemplate>
)
}
export default CustomUi
When I click this button, the url changes, but it doesn't change to the actual page to the next custom route component I configured.
Scratching my head on why this would be...I think I'll just avoid extra routes for now I suppose but if anyone has any thoughts I'd appreciate them.