Skip to content

Commit 0061ebd

Browse files
committed
Playlist Track: Show upload spinner inline
1 parent 121e579 commit 0061ebd

4 files changed

Lines changed: 21 additions & 2 deletions

File tree

packages/block-library/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
### Bug Fixes
1919

2020
- Footnotes: Treat unreadable `footnotes` post meta as no footnotes instead of throwing, so the block shows its placeholder rather than the block crash warning ([#81201](https://github.com/WordPress/gutenberg/pull/81201)).
21+
- Playlist Track: Show the upload loading indicator inline with the track row.
2122
- Playlist: Improve handling of declarative waveform player configuration ([#81342](https://github.com/WordPress/gutenberg/pull/81342)).
2223

2324
### Internal

packages/block-library/src/playlist-track/edit.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,6 @@ const PlaylistTrackEdit = ( {
251251
</PanelBody>
252252
</InspectorControls>
253253
<li { ...blockProps }>
254-
{ !! temporaryURL && <Spinner /> }
255254
<button
256255
className="wp-block-playlist-track__button"
257256
onClick={ () => setCurrentTrackClientId( clientId ) }
@@ -300,6 +299,9 @@ const PlaylistTrackEdit = ( {
300299
</span>
301300
) }
302301
{ length }
302+
{ !! temporaryURL && (
303+
<Spinner className="wp-block-playlist-track__spinner" />
304+
) }
303305
</span>
304306
<span className="screen-reader-text">{ __( 'Play' ) }</span>
305307
</button>

packages/block-library/src/playlist-track/style.scss

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,11 @@
4343
object-fit: cover;
4444
}
4545

46+
.wp-block-playlist-track__spinner {
47+
flex: 0 0 auto;
48+
margin: 0;
49+
}
50+
4651
.wp-block-playlist-track__content {
4752
flex: 1 1 0;
4853
min-width: 0;
@@ -60,6 +65,9 @@
6065
}
6166

6267
.wp-block-playlist-track__length {
68+
display: flex;
69+
align-items: center;
70+
justify-content: flex-end;
6371
margin-left: auto;
6472
font-size: 0.85em;
6573
opacity: 0.7;

packages/block-library/src/playlist-track/test/edit.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { fireEvent, render, screen } from '@testing-library/react';
1+
import { fireEvent, render, screen, within } from '@testing-library/react';
22
import { useDispatch } from '@wordpress/data';
33
import PlaylistTrackEdit from '../edit';
44
import { PlaylistContext } from '../../playlist/context';
@@ -169,6 +169,7 @@ describe( 'PlaylistTrackEdit', () => {
169169
renderEdit( {
170170
attributes: {
171171
blob: 'blob:https://example.com/temporary-track',
172+
length: undefined,
172173
src: undefined,
173174
},
174175
} );
@@ -178,6 +179,13 @@ describe( 'PlaylistTrackEdit', () => {
178179
url: 'blob:https://example.com/temporary-track',
179180
} )
180181
);
182+
const trackButton = screen.getByRole( 'button', {
183+
name: /Song One/,
184+
} );
185+
186+
expect(
187+
within( trackButton ).getByRole( 'presentation', { hidden: true } )
188+
).toBeInTheDocument();
181189
} );
182190

183191
it( 'preserves the current track source when a replacement upload fails', () => {

0 commit comments

Comments
 (0)