Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RNMobile] [Embed block] - Unavailable preview fallback bottom sheet title update #34674

Merged
5 changes: 3 additions & 2 deletions packages/block-library/src/embed/edit.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,8 @@ const EmbedEdit = ( props ) => {
title: _x( 'Embed', 'block title' ),
icon: embedContentIcon,
};
const { icon, title } =
getEmbedInfoByProvider( providerNameSlug ) || defaultEmbedInfo;
const embedInfoByProvider = getEmbedInfoByProvider( providerNameSlug );
const { icon, title } = embedInfoByProvider || defaultEmbedInfo;

const { wasBlockJustInserted } = useSelect(
( select ) => ( {
Expand Down Expand Up @@ -256,6 +256,7 @@ const EmbedEdit = ( props ) => {
previewable={ previewable }
type={ type }
url={ url }
isDefaultEmbedInfo={ ! embedInfoByProvider }
/>
</View>
</>
Expand Down
15 changes: 10 additions & 5 deletions packages/block-library/src/embed/embed-no-preview.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ const EmbedNoPreview = ( {
isSelected,
onPress,
previewable,
isDefaultEmbedInfo,
} ) => {
const shouldRequestReview = useRef( false );
const [ isSheetVisible, setIsSheetVisible ] = useState( false );
Expand Down Expand Up @@ -172,11 +173,15 @@ const EmbedNoPreview = ( {
/>
</View>
<Text style={ sheetTitleStyle }>
{ sprintf(
// translators: %s: embed block variant's label e.g: "Twitter".
__( '%s block previews are coming soon' ),
label
) }
{ isDefaultEmbedInfo
? __( 'Embed block previews are coming soon' )
: sprintf(
// translators: %s: embed block variant's label e.g: "Twitter".
__(
'%s embed block previews are coming soon'
),
label
) }
</Text>
<Text style={ sheetDescriptionStyle }>
{ comingSoonDescription }
Expand Down
2 changes: 2 additions & 0 deletions packages/block-library/src/embed/embed-preview.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ const EmbedPreview = ( {
isProviderPreviewable,
type,
url,
isDefaultEmbedInfo,
} ) => {
const [ isCaptionSelected, setIsCaptionSelected ] = useState( false );
const { locale } = useSelect( blockEditorStore ).getSettings();
Expand Down Expand Up @@ -137,6 +138,7 @@ const EmbedPreview = ( {
isSelected={ isSelected }
onPress={ () => setIsCaptionSelected( false ) }
previewable={ previewable }
isDefaultEmbedInfo={ isDefaultEmbedInfo }
/>
) }
<BlockCaption
Expand Down