import React from 'react'
import ReactGA from 'react-ga'
import 'react-jinke-music-player/assets/index.css'
import { Provider, useDispatch } from 'react-redux'
import { createHashHistory } from 'history'
import { Admin as RAAdmin, Resource } from 'react-admin'
import dataProvider from './dataProvider'
import authProvider from './authProvider'
import { Layout, Login, Logout } from './layout'
import transcoding from './transcoding'
import player from './player'
import user from './user'
import song from './song'
import album from './album'
import artist from './artist'
import playlist from './playlist'
import { Player } from './audioplayer'
import customRoutes from './routes'
import {
themeReducer,
addToPlaylistDialogReducer,
playQueueReducer,
albumViewReducer,
activityReducer,
settingsReducer,
} from './reducers'
import createAdminStore from './store/createAdminStore'
import { i18nProvider } from './i18n'
import config from './config'
import { setDispatch, startEventStream } from './eventStream'
import { HotKeys } from 'react-hotkeys'
import { keyMap } from './hotkeys'
const history = createHashHistory()
if (config.gaTrackingId) {
ReactGA.initialize(config.gaTrackingId)
history.listen((location) => {
ReactGA.pageview(location.pathname)
})
ReactGA.pageview(window.location.pathname)
}
const App = () => (
)
const Admin = (props) => {
const dispatch = useDispatch()
if (config.devActivityPanel) {
setDispatch(dispatch)
authProvider
.checkAuth()
.then(() => startEventStream())
.catch(() => {}) // ignore if not logged in
}
return (
{(permissions) => [
,
,
,
,
permissions === 'admin' ? (
) : null,
,
permissions === 'admin' ? (
) : (
),
,
,
,
,
,
]}
)
}
const AppWithHotkeys = () => (
)
export default AppWithHotkeys