withTranslationMaintenance button not visible
What could be the issue if the maintenance button doesn't show in Sanity Studio?
Hey @sven5 👋
I'm not a maintainer, but I recently faced the exact same problem. In my case it didn't show up because I had defined my own desk-structure.js (or .ts), which was overriding the default Sanity desk structure that the plugin extends (AFAIK). As I needed the custom desk structure for other stuff, I didn't want to remove it, which would probably have solved the issue.
Turns out there is a MaintenanceTab component, but unfortunately it isn't exported via the parts system like in other Sanity plugins, so I wasn't able to import and add it to my desk structure directly. However, I was able to find the module where the plugin extends the desk structure, and there's an exported function getMaintenanceListItem which returns the ListItem that the plugin appends to the desk structure if the withTranslationsMaintenance option is set to true in the config.
In my case, desk-structure.ts looked something like this:
import S from "@sanity/desk-tool/structure-builder";
// ... other imports
export default () =>
S.list()
.id("__root__")
.title("Content")
.items([
S.listItem()
.title("Pages")
.schemaType("page")
.child(S.documentTypeList("page").title("Pages")),
// ... other listItems
]);
The only change that was needed was to import the getMaintenanceListItem function and call it in a place where the structure builder expects a listItem:
import S from "@sanity/desk-tool/structure-builder";
// ... other imports
import { getMaintenanceListItem } from "@sanity/document-internationalization/lib/structure";
export default () =>
S.list()
.id("__root__")
.title("Content")
.items([
S.listItem()
.title("Pages")
.schemaType("page")
.child(S.documentTypeList("page").title("Pages")),
// ... other listItems
S.divider(),
getMaintenanceListItem(),
]);
I'm pretty sure it's not even necessary to enable the withTranslationsMaintenance option in the plugin's settings if you add it manually to your desk structure, as I didn't see any other notable references to it in the code, but I left it on anyway, just to be sure.
Hope that helps!