Move file sharing into a separate tab

This commit is contained in:
Torjus
2018-07-30 14:47:57 +02:00
parent 730c4e23c7
commit 5138673fea
14 changed files with 127 additions and 69 deletions
-9
View File
@@ -17,15 +17,6 @@ const chatmessages = (state = [], action) =>
return [ ...state, message ];
}
case 'ADD_NEW_USER_FILE':
{
const { file } = action.payload;
const message = createNewFile(file, 'client', 'Me', undefined);
return [ ...state, message ];
}
case 'ADD_NEW_RESPONSE_MESSAGE':
{
const { message } = action.payload;
-12
View File
@@ -8,16 +8,4 @@ export function createNewMessage(text, sender, name, picture)
sender,
picture
};
}
export function createNewFile(file, sender, name, picture)
{
return {
type : 'file',
file,
time : Date.now(),
name,
sender,
picture
};
}
+3 -1
View File
@@ -8,6 +8,7 @@ import notifications from './notifications';
import chatmessages from './chatmessages';
import chatbehavior from './chatbehavior';
import toolarea from './toolarea';
import sharing from './sharing';
const reducers = combineReducers(
{
@@ -19,7 +20,8 @@ const reducers = combineReducers(
notifications,
chatmessages,
chatbehavior,
toolarea
toolarea,
sharing
});
export default reducers;
+16
View File
@@ -0,0 +1,16 @@
const sharing = (state = [], action) =>
{
switch (action.type)
{
case 'SEND_FILE':
return [ ...state, { ...action.payload, me: true }];
case 'ADD_FILE':
return [ ...state, action.payload ];
default:
return state;
}
};
export default sharing;