quintodrome/ui/src/App.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

75 lines
2.1 KiB
JavaScript
Raw Normal View History

import React from 'react'
2020-03-31 10:04:10 -08:00
import { Provider } from 'react-redux'
import { createHashHistory } from 'history'
import { Admin, Resource } from 'react-admin'
2020-01-20 05:54:29 -09:00
import dataProvider from './dataProvider'
import authProvider from './authProvider'
import { Layout, Login } from './layout'
import transcoding from './transcoding'
2020-03-12 05:38:07 -08:00
import player from './player'
2020-01-19 16:40:18 -09:00
import user from './user'
import song from './song'
import album from './album'
import artist from './artist'
2020-03-11 15:46:46 -08:00
import { Player, playQueueReducer } from './audioplayer'
import { albumViewReducer } from './album/albumState'
import customRoutes from './routes'
import themeReducer from './personal/themeReducer'
2020-03-31 10:04:10 -08:00
import createAdminStore from './store/createAdminStore'
2020-05-02 13:44:24 -08:00
import { i18nProvider } from './i18n'
2020-02-07 05:40:52 -09:00
2020-03-31 10:04:10 -08:00
const history = createHashHistory()
2020-04-08 09:20:02 -08:00
const App = () => (
<Provider
store={createAdminStore({
authProvider,
dataProvider,
history,
customReducers: {
queue: playQueueReducer,
albumView: albumViewReducer,
2020-04-26 10:50:44 -08:00
theme: themeReducer,
},
2020-04-08 09:20:02 -08:00
})}
>
<Admin
dataProvider={dataProvider}
authProvider={authProvider}
i18nProvider={i18nProvider}
customRoutes={customRoutes}
history={history}
layout={Layout}
loginPage={Login}
>
2020-04-08 09:20:02 -08:00
{(permissions) => [
<Resource name="album" {...album} options={{ subMenu: 'library' }} />,
2020-05-05 11:44:05 -08:00
<Resource name="artist" {...artist} options={{ subMenu: 'library' }} />,
2020-04-08 09:20:02 -08:00
<Resource name="song" {...song} options={{ subMenu: 'library' }} />,
permissions === 'admin' ? (
<Resource name="user" {...user} options={{ subMenu: 'settings' }} />
) : null,
<Resource
name="player"
{...player}
options={{ subMenu: 'settings' }}
/>,
permissions === 'admin' ? (
2020-03-31 10:04:10 -08:00
<Resource
2020-04-08 09:20:02 -08:00
name="transcoding"
{...transcoding}
options={{ subMenu: 'settings' }}
2020-04-08 09:20:02 -08:00
/>
) : (
<Resource name="transcoding" />
),
2020-05-01 14:29:50 -08:00
<Resource name="albumSong" />,
<Resource name="translation" />,
2020-04-26 10:50:44 -08:00
<Player />,
2020-04-08 09:20:02 -08:00
]}
</Admin>
</Provider>
)
export default App