Skip to content

Commit

Permalink
refactor(structure): update banner text
Browse files Browse the repository at this point in the history
  • Loading branch information
RitaDias committed Sep 20, 2024
1 parent 250b61c commit 9e5165f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
2 changes: 1 addition & 1 deletion packages/sanity/src/structure/i18n/resources.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ const structureLocaleStrings = defineLocalesResources('structure', {
'banners.live-edit-draft-banner.publish.tooltip': 'Publish to continue editing',
/** The text content for the live edit document when it's a draft */
'banners.live-edit-draft-banner.text':
'This live document cannot be edited while a draft version of it exists. Publish or discard the draft in order to continue live editing it.',
'The type <strong>{{schemaType}}</strong> has <code>liveEdit</code> enabled, but a draft version of this document exists. Publish or discard the draft in order to continue live editing it.',
/** The text for the permission check banner if the user only has one role, and it does not allow updating this document */
'banners.permission-check-banner.missing-permission_create_one':
'Your role <Roles/> does not have permissions to create this document.',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {ErrorOutlineIcon} from '@sanity/icons'
import {useTelemetry} from '@sanity/telemetry/react'
import {Flex, Text} from '@sanity/ui'
import {useCallback, useEffect, useState} from 'react'
import {isDraftId, useDocumentOperation, useTranslation} from 'sanity'
import {isDraftId, Translate, useDocumentOperation, useTranslation} from 'sanity'

import {Button} from '../../../../../ui-components'
import {structureLocaleNamespace} from '../../../../i18n'
Expand All @@ -14,7 +14,7 @@ import {
import {Banner} from './Banner'

export function DraftLiveEditBanner(): JSX.Element | null {
const {displayed, documentId} = useDocumentPane()
const {displayed, documentId, schemaType} = useDocumentPane()
const {t} = useTranslation(structureLocaleNamespace)
const [isPublishing, setPublishing] = useState(false)
const [isDiscarding, setDiscarding] = useState(false)
Expand Down Expand Up @@ -50,7 +50,11 @@ export function DraftLiveEditBanner(): JSX.Element | null {
content={
<Flex align="center" justify="space-between" gap={1}>
<Text size={1} weight="medium">
{t('banners.live-edit-draft-banner.text')}
<Translate
t={t}
i18nKey={'banners.live-edit-draft-banner.text'}
values={{schemaType: schemaType.title}}
/>
</Text>
<Button
onClick={handlePublish}
Expand Down

0 comments on commit 9e5165f

Please sign in to comment.