@@ -37,7 +37,6 @@ import {
37
37
getPlaylistId ,
38
38
getRecordingMBIDFromJSPFTrack ,
39
39
isPlaylistOwner ,
40
- JSPFTrackToListen ,
41
40
LISTENBRAINZ_URI_PREFIX ,
42
41
PLAYLIST_TRACK_URI_PREFIX ,
43
42
PLAYLIST_URI_PREFIX ,
@@ -98,14 +97,12 @@ export default function PlaylistPage() {
98
97
99
98
// Ref
100
99
const socketRef = React . useRef < Socket | null > ( null ) ;
100
+ const searchInputRef = React . useRef < HTMLInputElement > ( null ) ;
101
101
102
102
// States
103
103
const [ playlist , setPlaylist ] = React . useState < JSPFPlaylist > (
104
104
playlistProps ?. playlist || { }
105
105
) ;
106
- const [ coverArtConfig , setCoverArtConfig ] = React . useState <
107
- CoverArtGridOptions
108
- > ( playlistProps ?. cover_art || { } ) ;
109
106
const { track : tracks } = playlist ;
110
107
111
108
// Functions
@@ -529,15 +526,17 @@ export default function PlaylistPage() {
529
526
</ div >
530
527
{ userHasRightToEdit && tracks && tracks . length > 10 && (
531
528
< div className = "text-center" >
532
- < a
529
+ < button
533
530
className = "btn btn-primary"
534
531
type = "button"
535
- href = "#add-track"
536
532
style = { { marginBottom : "1em" } }
533
+ onClick = { ( ) => {
534
+ searchInputRef . current ?. focus ( ) ;
535
+ } }
537
536
>
538
537
< FontAwesomeIcon icon = { faPlusCircle as IconProp } />
539
538
Add a track
540
- </ a >
539
+ </ button >
541
540
</ div >
542
541
) }
543
542
< div id = "listens row" >
@@ -573,6 +572,8 @@ export default function PlaylistPage() {
573
572
Add a track
574
573
</ span >
575
574
< SearchTrackOrMBID
575
+ ref = { searchInputRef }
576
+ autofocus = { false }
576
577
onSelectRecording = { addTrack }
577
578
expectedPayload = "trackmetadata"
578
579
/>
0 commit comments