This commit is contained in:
mgabdev
2020-03-14 13:31:29 -04:00
parent d78dd971c0
commit 65af72faae
81 changed files with 1101 additions and 662 deletions

View File

@@ -1,25 +0,0 @@
import {
ALERT_SHOW,
ALERT_DISMISS,
ALERT_CLEAR,
} from '../actions/alerts';
import { Map as ImmutableMap, List as ImmutableList } from 'immutable';
const initialState = ImmutableList([]);
export default function alerts(state = initialState, action) {
switch(action.type) {
case ALERT_SHOW:
return state.push(ImmutableMap({
key: state.size > 0 ? state.last().get('key') + 1 : 0,
title: action.title,
message: action.message,
}));
case ALERT_DISMISS:
return state.filterNot(item => item.get('key') === action.alert.key);
case ALERT_CLEAR:
return state.clear();
default:
return state;
}
};

View File

@@ -2,7 +2,6 @@ import { combineReducers } from 'redux-immutable';
import popover from './popover';
import timelines from './timelines';
import meta from './meta';
import alerts from './alerts';
import { loadingBarReducer } from 'react-redux-loading-bar';
import modal from './modal';
import user_lists from './user_lists';
@@ -43,7 +42,6 @@ const reducers = {
popover,
timelines,
meta,
alerts,
loadingBar: loadingBarReducer,
modal,
user_lists,

View File

@@ -7,20 +7,17 @@ import {
const initialState = Immutable.Map({
popoverType: null,
placement: null,
keyboard: false
})
export default function popoverMenu(state = initialState, action) {
switch (action.type) {
case POPOVER_OPEN:
console.log("POPOVER_OPEN:", action)
return {
popoverType: action.popoverType,
popoverProps: action.popoverProps,
}
case POPOVER_CLOSE:
console.log("POPOVER_CLOSE:", action)
return initialState;
return initialState
default:
return state
}

View File

@@ -1,6 +1,6 @@
import {
REBLOG_REQUEST,
REBLOG_FAIL,
REPOST_REQUEST,
REPOST_FAIL,
FAVORITE_REQUEST,
FAVORITE_FAIL,
UNFAVORITE_REQUEST,
@@ -42,9 +42,9 @@ export default function statuses(state = initialState, action) {
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'favourited'], false);
case UNFAVORITE_REQUEST:
return state.setIn([action.status.get('id'), 'favourited'], false);
case REBLOG_REQUEST:
case REPOST_REQUEST:
return state.setIn([action.status.get('id'), 'reblogged'], true);
case REBLOG_FAIL:
case REPOST_FAIL:
return state.get(action.status.get('id')) === undefined ? state : state.setIn([action.status.get('id'), 'reblogged'], false);
case STATUS_MUTE_SUCCESS:
return state.setIn([action.id, 'muted'], true);