Refactor stateActions for better overview.

This commit is contained in:
Håvar Aambø Fosstveit
2019-11-05 11:53:21 +01:00
parent a9be34aea7
commit 8ab1475fea
31 changed files with 667 additions and 873 deletions
@@ -3,7 +3,7 @@ import
createNewMessage
} from './helper';
const chatmessages = (state = [], action) =>
const chat = (state = [], action) =>
{
switch (action.type)
{
@@ -30,14 +30,9 @@ const chatmessages = (state = [], action) =>
return [ ...state, ...chatHistory ];
}
case 'DROP_MESSAGES':
{
return [];
}
default:
return state;
}
};
export default chatmessages;
export default chat;
-7
View File
@@ -85,13 +85,6 @@ const files = (state = {}, action) =>
return { ...state, [magnetUri]: newFile };
}
case 'REMOVE_FILE':
{
const { magnetUri } = action.payload;
return state.filter((file) => file.magnetUri !== magnetUri);
}
default:
return state;
}
-7
View File
@@ -116,13 +116,6 @@ const room = (state = initialState, action) =>
return { ...state, torrentSupport: supported };
}
case 'TOGGLE_SETTINGS':
{
const showSettings = !state.showSettings;
return { ...state, showSettings };
}
case 'TOGGLE_JOINED':
{
const joined = !state.joined;
+2 -2
View File
@@ -7,7 +7,7 @@ import lobbyPeers from './lobbyPeers';
import consumers from './consumers';
import peerVolumes from './peerVolumes';
import notifications from './notifications';
import chatmessages from './chatmessages';
import chat from './chat';
import toolarea from './toolarea';
import files from './files';
import settings from './settings';
@@ -21,7 +21,7 @@ export default combineReducers({
consumers,
peerVolumes,
notifications,
chatmessages,
chat,
toolarea,
files,
settings