fix: empty publish dropdown when localization is false (#9106)
Closes https://github.com/payloadcms/payload/issues/9092
This commit is contained in:
committed by
GitHub
parent
9a970d21a9
commit
3e954f45c7
@@ -126,27 +126,30 @@ export const DefaultPublishButton: React.FC<{ label?: string }> = ({ label: labe
|
|||||||
disabled={!canPublish}
|
disabled={!canPublish}
|
||||||
onClick={publish}
|
onClick={publish}
|
||||||
size="medium"
|
size="medium"
|
||||||
SubMenuPopupContent={({ close }) =>
|
SubMenuPopupContent={
|
||||||
localization
|
localization
|
||||||
? localization.locales.map((locale) => {
|
? ({ close }) =>
|
||||||
const formattedLabel =
|
localization.locales.map((locale) => {
|
||||||
typeof locale.label === 'string'
|
const formattedLabel =
|
||||||
? locale.label
|
typeof locale.label === 'string'
|
||||||
: locale.label && locale.label[i18n?.language]
|
? locale.label
|
||||||
|
: locale.label && locale.label[i18n?.language]
|
||||||
|
|
||||||
const isActive = typeof locale === 'string' ? locale === code : locale.code === code
|
const isActive = typeof locale === 'string' ? locale === code : locale.code === code
|
||||||
|
|
||||||
if (isActive) {
|
if (isActive) {
|
||||||
return (
|
return (
|
||||||
<PopupList.ButtonGroup key={locale.code}>
|
<PopupList.ButtonGroup key={locale.code}>
|
||||||
<PopupList.Button onClick={() => [publishSpecificLocale(locale.code), close()]}>
|
<PopupList.Button
|
||||||
{t('version:publishIn', { locale: formattedLabel || locale.code })}
|
onClick={() => [publishSpecificLocale(locale.code), close()]}
|
||||||
</PopupList.Button>
|
>
|
||||||
</PopupList.ButtonGroup>
|
{t('version:publishIn', { locale: formattedLabel || locale.code })}
|
||||||
)
|
</PopupList.Button>
|
||||||
}
|
</PopupList.ButtonGroup>
|
||||||
})
|
)
|
||||||
: null
|
}
|
||||||
|
})
|
||||||
|
: undefined
|
||||||
}
|
}
|
||||||
type="button"
|
type="button"
|
||||||
>
|
>
|
||||||
|
|||||||
Reference in New Issue
Block a user