mirror of
https://github.com/He4eT/elseifplayer.git
synced 2026-05-04 17:07:22 +00:00
54 lines
1.2 KiB
JavaScript
54 lines
1.2 KiB
JavaScript
import { h, render } from 'preact'
|
|
import { Route, Router, Switch } from 'wouter-preact'
|
|
|
|
import {
|
|
useHashLocation,
|
|
extractView
|
|
} from '~/src/utils/utils.routing'
|
|
import {
|
|
useThemeEngine
|
|
} from '~/src/themes/themes'
|
|
|
|
import HomeView from '~/src/views/HomeView'
|
|
import PlayerView from '~/src/views/PlayerView'
|
|
|
|
import '@fontsource/open-sans'
|
|
import '~/src/style/base.css'
|
|
|
|
function App () {
|
|
const themeEngine = useThemeEngine()
|
|
const [location] = useHashLocation()
|
|
|
|
return (
|
|
<Router hook={useHashLocation}>
|
|
<div className={[
|
|
'app',
|
|
extractView(location),
|
|
themeEngine.currentTheme].join(' ')}>
|
|
|
|
<Switch>
|
|
<Route path='/'>
|
|
<HomeView {...{
|
|
themeEngine
|
|
}} />
|
|
</Route>
|
|
<Route path='/play/:theme/:encodedUrl'>
|
|
{params => <PlayerView {...{
|
|
setTheme: themeEngine.setTheme,
|
|
...params
|
|
}} />}
|
|
</Route>
|
|
<Route path='/top100'>
|
|
top100
|
|
</Route>
|
|
<Route>
|
|
404
|
|
</Route>
|
|
</Switch>
|
|
|
|
</div>
|
|
</Router>
|
|
)
|
|
}
|
|
|
|
render(<App />, document.getElementById('root'))
|