Added chat badge displaying unread messages
This commit is contained in:
1 parent
5c1de30468
commit
85750d305f
4 files changed
+46
-10
No files matched your search
@@ -12,8 +12,9 @@ const chatbehavior = (state = initialState, action) =>
|
||||
case 'TOGGLE_CHAT':
|
||||
{
|
||||
const showChat = !state.showChat;
|
||||
const badge = 0;
|
||||
|
||||
return { ...state, showChat };
|
||||
return { ...state, showChat, badge };
|
||||
}
|
||||
|
||||
case 'TOGGLE_INPUT_DISABLED':
|
||||
@@ -23,6 +24,10 @@ const chatbehavior = (state = initialState, action) =>
|
||||
return { ...state, disabledInput };
|
||||
}
|
||||
|
||||
case 'INCREASE_BADGE':
|
||||
{
|
||||
return { ...state, badge: state.badge + (state.showChat ? 0 : 1) };
|
||||
}
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -338,6 +338,13 @@ export const toggleChat = () =>
|
||||
};
|
||||
};
|
||||
|
||||
export const increaseBadge = () =>
|
||||
{
|
||||
return {
|
||||
type : 'INCREASE_BADGE'
|
||||
};
|
||||
};
|
||||
|
||||
export const toggleInputDisabled = () =>
|
||||
{
|
||||
return {
|
||||
|
||||
Reference in new issue
Block a user