Notifications broadcast from GitHub
This commit is contained in:
@ -38,9 +38,10 @@ class App extends React.Component{
|
||||
}
|
||||
|
||||
componentDidMount(){
|
||||
this.props.pusherActions.connect();
|
||||
this.props.mopidyActions.connect();
|
||||
this.props.spotifyActions.connect();
|
||||
this.props.pusherActions.connect()
|
||||
this.props.mopidyActions.connect()
|
||||
this.props.spotifyActions.connect()
|
||||
this.props.uiActions.getBroadcasts()
|
||||
|
||||
if (this.props.spotify_authorized){
|
||||
|
||||
@ -199,8 +200,8 @@ class App extends React.Component{
|
||||
<Notifications
|
||||
uiActions={this.props.uiActions}
|
||||
notifications={this.props.notifications}
|
||||
processes={this.props.processes}
|
||||
load_queue={this.props.load_queue} />
|
||||
processes={this.props.processes}
|
||||
broadcasts={this.props.broadcasts} />
|
||||
{this.props.debug_info ? <DebugInfo /> : null}
|
||||
</div>
|
||||
);
|
||||
@ -215,6 +216,7 @@ class App extends React.Component{
|
||||
|
||||
const mapStateToProps = (state, ownProps) => {
|
||||
return {
|
||||
broadcasts: (state.ui.broadcasts ? state.ui.broadcasts : []),
|
||||
volume: (state.mopidy.volume ? state.mopidy.volume : false),
|
||||
notifications: (state.ui.notifications ? state.ui.notifications : []),
|
||||
processes: (state.ui.processes ? state.ui.processes : {}),
|
||||
|
||||
@ -1,6 +1,26 @@
|
||||
|
||||
import * as helpers from '../../helpers'
|
||||
|
||||
export function getBroadcasts(){
|
||||
return (dispatch, getState) => {
|
||||
var config = {
|
||||
method: 'GET',
|
||||
url: 'https://gist.githubusercontent.com/jaedb/b677dccf80daf3ccb2ef12e96e495677/raw'
|
||||
}
|
||||
$.ajax(config).then(
|
||||
response => {
|
||||
dispatch({
|
||||
type: 'BROADCASTS_LOADED',
|
||||
broadcasts: JSON.parse(response)
|
||||
})
|
||||
},
|
||||
(xhr, status, error) => {
|
||||
console.error('Could not fetch broadcasts from GitHub')
|
||||
}
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
export function showContextMenu(data){
|
||||
data.position_x = data.e.clientX
|
||||
data.position_y = data.e.clientY
|
||||
|
||||
@ -4,6 +4,9 @@ import * as helpers from '../../helpers'
|
||||
export default function reducer(ui = {}, action){
|
||||
switch (action.type) {
|
||||
|
||||
case 'BROADCASTS_LOADED':
|
||||
return Object.assign({}, ui, {broadcasts: action.broadcasts});
|
||||
|
||||
case 'LAZY_LOADING':
|
||||
return Object.assign({}, ui, { lazy_loading: action.start });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user