chore: update seo plugin (#5309)

* chore: update seo plugin

* fix translations export
This commit is contained in:
Paul
2024-03-12 18:47:14 -03:00
committed by GitHub
parent 5f093846a7
commit e091a37241
6 changed files with 12 additions and 18 deletions

View File

@@ -23,7 +23,7 @@ type MetaDescriptionProps = FormFieldBase & {
export const MetaDescription: React.FC<MetaDescriptionProps> = (props) => {
const { Label, hasGenerateDescriptionFn, path, required } = props
const { path: pathFromContext, schemaPath } = useFieldPath()
const { path: pathFromContext } = useFieldPath()
const { t } = useTranslation()

View File

@@ -23,7 +23,7 @@ type MetaImageProps = UploadInputProps & {
}
export const MetaImage: React.FC<MetaImageProps> = (props) => {
const { Label, hasGenerateImageFn, path, relationTo, required } = props || {}
const { Label, hasGenerateImageFn, relationTo, required } = props || {}
const field: FieldType<string> = useField(props as Options)

View File

@@ -28,7 +28,7 @@ type MetaTitleProps = FormFieldBase & {
export const MetaTitle: React.FC<MetaTitleProps> = (props) => {
const { Label, hasGenerateTitleFn, path, required } = props || {}
const { path: pathFromContext, schemaPath } = useFieldPath()
const { path: pathFromContext } = useFieldPath()
const { t } = useTranslation()

View File

@@ -15,7 +15,7 @@ import type {
import { MetaDescription } from './fields/MetaDescription.js'
import { MetaImage } from './fields/MetaImage.js'
import { MetaTitle } from './fields/MetaTitle.js'
import translations from './translations/index.js'
import { translations } from './translations/index.js'
import { Overview } from './ui/Overview.js'
import { Preview } from './ui/Preview.js'
@@ -139,8 +139,8 @@ const seo =
tabs: [
// append a new tab onto the end of the tabs array, if there is one at the first index
// if needed, create a new `Content` tab in the first index for this collection's base fields
...(collection?.fields?.[0]?.type === 'tabs'
? collection.fields[0]?.tabs
...(collection?.fields?.[0]?.type === 'tabs' && collection?.fields?.[0]?.tabs
? collection.fields[0].tabs
: [
{
fields: [
@@ -234,8 +234,8 @@ const seo =
tabs: [
// append a new tab onto the end of the tabs array, if there is one at the first index
// if needed, create a new `Content` tab in the first index for this global's base fields
...(global?.fields?.[0].type === 'tabs'
? global.fields[0]?.tabs
...(global?.fields?.[0].type === 'tabs' && global?.fields?.[0].tabs
? global.fields[0].tabs
: [
{
fields: [...(global?.fields || [])],
@@ -254,7 +254,7 @@ const seo =
...global,
fields: [
...seoTabs,
...(global?.fields?.[0].type === 'tabs' ? global?.fields?.slice(1) : []),
...(global?.fields?.[0].type === 'tabs' ? global.fields.slice(1) : []),
],
}
}
@@ -276,4 +276,4 @@ const seo =
}
}
export default seo
export { seo }

View File

@@ -4,10 +4,4 @@ import fa from './fa.json'
import fr from './fr.json'
import pl from './pl.json'
export default {
en,
es,
fa,
fr,
pl,
}
export const translations = { en, es, fa, fr, pl }

View File

@@ -72,7 +72,7 @@ export const LengthIndicator: React.FC<{
setBarWidth(1)
}
}
}, [minLength, maxLength, text])
}, [minLength, maxLength, text, t])
const textLength = text?.length || 0