Automatically generate route layout
mcproger opened this issue · comments
Artem Lomonosov commented
Right now we have hardcoded routing layout. It would be nice if we taught ke to generate layout from admin classes and their url attribute.
// App.js
const newAppSettings = [
{
// there will be provider with resource url attribute. It will be used to generate routing layout in LayoutComposer
admin: new AppealAdmin(),
additionalDetailComponents: additionalDetailComponents,
additionalListComponents: additionalListComponents,
},
{
admin: new PatientAdmin(),
additionalDetailComponents: additionalDetailComponents,
additionalListComponents: additionalListComponents,
},
]
const newApp = () => <Ke settings={newAppSettings} />
// LayoutComposer.jsx (pseudo code)
const LayoutComposer = (props) => {
props.map((element) => {
<Router exact path={element.admin.provider.url}>
<RenderList admin={element.admin} additionalListComponents={additionalListComponents}>
</Router>
)}
}