'use client'

import {createContext, useContext, useState} from 'react'
import PropTypes from 'prop-types'

const CurrentTrackContext = createContext([null, () => {}])

export function CurrentTrackProvider({children}) {
  const state = useState(null)

  return (
    <CurrentTrackContext.Provider value={state}>
      {children}
    </CurrentTrackContext.Provider>
  )
}

export function useCurrentTrack() {
  return useContext(CurrentTrackContext)
}

CurrentTrackProvider.propTypes = {
  children: PropTypes.node.isRequired
}
