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

Podcast Player: Fix missing replace button #15508

Merged
merged 2 commits into from
Apr 23, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 24 additions & 11 deletions extensions/blocks/podcast-player/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ import {
RangeControl,
TextControl,
Toolbar,
ToolbarGroup,
withNotices,
ToggleControl,
Spinner,
Expand Down Expand Up @@ -235,16 +236,6 @@ const PodcastPlayerEdit = ( {
);
}

const toolbarControls = [
{
title: __( 'Edit Podcast Feed URL', 'jetpack' ),
onClick: () => setIsEditing( true ),
extraProps: {
children: __( 'Replace', 'jetpack' ),
},
},
];

// Loading state for fetching the feed.
if ( ! feedData.tracks || ! feedData.tracks.length ) {
return (
Expand All @@ -266,7 +257,29 @@ const PodcastPlayerEdit = ( {
return (
<>
<BlockControls>
<Toolbar controls={ toolbarControls } />
{ /* @todo Fallback can be removed when WP 5.4 is the minimum supported version. */ }
obenland marked this conversation as resolved.
Show resolved Hide resolved
{ ToolbarGroup ? (
<ToolbarGroup>
<Button
aria-label={ __( 'Edit Podcast Feed URL', 'jetpack' ) }
onClick={ () => setIsEditing( true ) }
>
{ __( 'Replace', 'jetpack' ) }
</Button>
</ToolbarGroup>
) : (
<Toolbar
controls={ [
{
title: __( 'Edit Podcast Feed URL', 'jetpack' ),
obenland marked this conversation as resolved.
Show resolved Hide resolved
onClick: () => setIsEditing( true ),
extraProps: {
children: __( 'Replace', 'jetpack' ),
},
},
] }
/>
) }
</BlockControls>
<InspectorControls>
<PanelBody title={ __( 'Podcast settings', 'jetpack' ) }>
Expand Down