webamp/js/main.js
Jordan Eldredge 47200d5611 Render the main window DOM with React
Because we pass it no props, we can safely manipulate it's DOM state, content
that it won't get rerndered out from underneath us.
2016-07-27 21:53:34 -07:00

43 lines
1.2 KiB
JavaScript

import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-redux';
import {createStore} from 'redux';
import createReducer from './reducers';
import Browser from './browser';
import MainWindow from './MainWindow.jsx';
import Winamp from './winamp';
import Hotkeys from './hotkeys';
if (new Browser(window).isCompatible) {
var winamp = Winamp;
let store = createStore(
createReducer(winamp),
window.devToolsExtension && window.devToolsExtension()
);
render(
<Provider store={store}>
<MainWindow />
</Provider>,
document.getElementById('winamp2-js')
);
winamp.dispatch = store.dispatch;
winamp.init({
volume: 50,
balance: 0,
mediaFile: {
url: process.env.NODE_ENV === 'production' ? 'https://cdn.rawgit.com/captbaritone/llama/master/llama-2.91.mp3' : 'llama-2.91.mp3',
name: "1. DJ Mike Llama - Llama Whippin' Intro"
},
skinUrl: process.env.NODE_ENV === 'production' ? 'https://cdn.rawgit.com/captbaritone/winamp-skins/master/v2/base-2.91.wsz' : 'base-2.91.wsz'
});
new Hotkeys(winamp, store);
} else {
document.getElementById('winamp').style.display = 'none';
document.getElementById('browser-compatibility').style.display = 'block';
}