Skip to content

Commit 66fe0de

Browse files
committed
Playlist Track: Show upload spinner inline
1 parent 121e579 commit 66fe0de

4 files changed

Lines changed: 17 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,14 +251,16 @@ 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 ) }
258257
aria-current={
259258
currentTrackClientId === clientId ? 'true' : 'false'
260259
}
261260
>
261+
{ !! temporaryURL && (
262+
<Spinner className="wp-block-playlist-track__spinner" />
263+
) }
262264
{ showImages && !! image && (
263265
<img
264266
className="wp-block-playlist-track__image"

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

Lines changed: 5 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 var(--wp--preset--spacing--20, 0.5em) 0 0;
49+
}
50+
4651
.wp-block-playlist-track__content {
4752
flex: 1 1 0;
4853
min-width: 0;

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

Lines changed: 8 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';
@@ -178,6 +178,13 @@ describe( 'PlaylistTrackEdit', () => {
178178
url: 'blob:https://example.com/temporary-track',
179179
} )
180180
);
181+
const trackButton = screen.getByRole( 'button', {
182+
name: /Song One/,
183+
} );
184+
185+
expect(
186+
within( trackButton ).getByRole( 'presentation', { hidden: true } )
187+
).toBeInTheDocument();
181188
} );
182189

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

0 commit comments

Comments
 (0)