import { useZocksStore } from '../../../app'
import { changeParticipantsView, ParticipantsViewType, selectCurrentParticipantsView } from '../../../store'
import { useZocksDispatch } from '../../../app/hooks'

export const useViewSwitcher = () => {
  const dispatch = useZocksDispatch()
  const currentView = useZocksStore(selectCurrentParticipantsView)
  const changeView = (newView: ParticipantsViewType) => dispatch(changeParticipantsView(newView))

  return {
    currentView,
    changeView,
  }
}
