From 9e5165fa211c7655bc1b03c15f8b57f90546dee3 Mon Sep 17 00:00:00 2001 From: RitaDias Date: Fri, 20 Sep 2024 09:20:51 +0200 Subject: [PATCH] refactor(structure): update banner text --- packages/sanity/src/structure/i18n/resources.ts | 2 +- .../documentPanel/banners/DraftLiveEditBanner.tsx | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/sanity/src/structure/i18n/resources.ts b/packages/sanity/src/structure/i18n/resources.ts index 505a713a425..7b54c615215 100644 --- a/packages/sanity/src/structure/i18n/resources.ts +++ b/packages/sanity/src/structure/i18n/resources.ts @@ -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 {{schemaType}} has liveEdit 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 does not have permissions to create this document.', diff --git a/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx b/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx index bc91dc4319a..e368b852330 100644 --- a/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx +++ b/packages/sanity/src/structure/panes/document/documentPanel/banners/DraftLiveEditBanner.tsx @@ -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' @@ -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) @@ -50,7 +50,11 @@ export function DraftLiveEditBanner(): JSX.Element | null { content={ - {t('banners.live-edit-draft-banner.text')} +