adminjs
adminjs copied to clipboard
[Bug]: Can't add labels for custom pages
What happened?
I was hoping to add labels for my custom pages to replace the default link text, which seems to use the property name passed to AdminJSOptions.pages.
Unfortunately the documented example for the pages property in AdminJSOptions cannot be implemented because AdminPage lacks a label property.
Bug prevalence
Whenever I add a custom page
AdminJS dependencies version
"@adminjs/express": "^5.1.0",
"@adminjs/prisma": "^3.0.1",
"adminjs": "^6.8.3",
"tslib": "^2.5.0"
Relevant code that's giving you issues
const options: AdminJSOptions = {
// ...
pages: {
MyCustomPage: {
component: Components.MyCustomPage,
label: 'My custom page', // TS error: 'label' does not exist in type 'AdminPage'
},
},
// ...
}
I also encountered the same issue.
It appears to function with options.locale.translations.
new AdminJS({
// ...
locale: {
language: "en",
availableLanguages: ["en"],
translations: {
en: {
pages: {
samplePage: "This is Sample Page",
},
},
},
},
// ...
});