Removed some unused code, and cleaned up some ternary operations.
parent
580b3b88e3
commit
ea85041d78
|
|
@ -23,7 +23,6 @@ class Chat extends Component
|
||||||
const {
|
const {
|
||||||
roomClient,
|
roomClient,
|
||||||
senderPlaceHolder,
|
senderPlaceHolder,
|
||||||
disabledInput,
|
|
||||||
autofocus,
|
autofocus,
|
||||||
displayName,
|
displayName,
|
||||||
picture
|
picture
|
||||||
|
|
@ -53,7 +52,6 @@ class Chat extends Component
|
||||||
className='new-message'
|
className='new-message'
|
||||||
name='message'
|
name='message'
|
||||||
placeholder={senderPlaceHolder}
|
placeholder={senderPlaceHolder}
|
||||||
disabled={disabledInput}
|
|
||||||
autoFocus={autofocus}
|
autoFocus={autofocus}
|
||||||
autoComplete='off'
|
autoComplete='off'
|
||||||
/>
|
/>
|
||||||
|
|
@ -72,7 +70,6 @@ Chat.propTypes =
|
||||||
{
|
{
|
||||||
roomClient : PropTypes.any.isRequired,
|
roomClient : PropTypes.any.isRequired,
|
||||||
senderPlaceHolder : PropTypes.string,
|
senderPlaceHolder : PropTypes.string,
|
||||||
disabledInput : PropTypes.bool,
|
|
||||||
autofocus : PropTypes.bool,
|
autofocus : PropTypes.bool,
|
||||||
displayName : PropTypes.string,
|
displayName : PropTypes.string,
|
||||||
picture : PropTypes.string
|
picture : PropTypes.string
|
||||||
|
|
@ -88,7 +85,6 @@ Chat.defaultProps =
|
||||||
const mapStateToProps = (state) =>
|
const mapStateToProps = (state) =>
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
disabledInput : state.chatbehavior.disabledInput,
|
|
||||||
displayName : state.me.displayName,
|
displayName : state.me.displayName,
|
||||||
picture : state.me.picture
|
picture : state.me.picture
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -16,9 +16,9 @@ const ListMe = ({ me }) =>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className='indicators'>
|
<div className='indicators'>
|
||||||
{me.raisedHand && (
|
<If condition={me.raisedHand}>
|
||||||
<div className='icon raise-hand on' />
|
<div className='icon raise-hand on' />
|
||||||
)}
|
</If>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</li>
|
</li>
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,9 @@ const TabHeader = ({ currentToolTab, setToolTab, id, name, badge }) => (
|
||||||
>
|
>
|
||||||
{name}
|
{name}
|
||||||
|
|
||||||
{badge > 0 && (
|
<If condition={badge > 0}>
|
||||||
<span className='badge'>{badge}</span>
|
<span className='badge'>{badge}</span>
|
||||||
)}
|
</If>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,11 +59,11 @@ class ToolArea extends React.Component
|
||||||
/>
|
/>
|
||||||
<p>Toolbox</p>
|
<p>Toolbox</p>
|
||||||
</span>
|
</span>
|
||||||
{!toolAreaOpen && unread > 0 && (
|
<If condition={!toolAreaOpen && unread > 0}>
|
||||||
<span className={classNames('badge', { long: unread >= 10 })}>
|
<span className={classNames('badge', { long: unread >= 10 })}>
|
||||||
{unread}
|
{unread}
|
||||||
</span>
|
</span>
|
||||||
)}
|
</If>
|
||||||
</div>
|
</div>
|
||||||
<div className='tab-headers'>
|
<div className='tab-headers'>
|
||||||
<TabHeader
|
<TabHeader
|
||||||
|
|
|
||||||
|
|
@ -1,36 +0,0 @@
|
||||||
const initialState =
|
|
||||||
{
|
|
||||||
showChat : false,
|
|
||||||
disabledInput : false,
|
|
||||||
badge : 0
|
|
||||||
};
|
|
||||||
|
|
||||||
const chatbehavior = (state = initialState, action) =>
|
|
||||||
{
|
|
||||||
switch (action.type)
|
|
||||||
{
|
|
||||||
case 'TOGGLE_CHAT':
|
|
||||||
{
|
|
||||||
const showChat = !state.showChat;
|
|
||||||
const badge = 0;
|
|
||||||
|
|
||||||
return { ...state, showChat, badge };
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'TOGGLE_INPUT_DISABLED':
|
|
||||||
{
|
|
||||||
const disabledInput = !state.disabledInput;
|
|
||||||
|
|
||||||
return { ...state, disabledInput };
|
|
||||||
}
|
|
||||||
|
|
||||||
case 'INCREASE_BADGE':
|
|
||||||
{
|
|
||||||
return { ...state, badge: state.badge + (state.showChat ? 0 : 1) };
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default chatbehavior;
|
|
||||||
|
|
@ -6,7 +6,6 @@ import peers from './peers';
|
||||||
import consumers from './consumers';
|
import consumers from './consumers';
|
||||||
import notifications from './notifications';
|
import notifications from './notifications';
|
||||||
import chatmessages from './chatmessages';
|
import chatmessages from './chatmessages';
|
||||||
import chatbehavior from './chatbehavior';
|
|
||||||
import toolarea from './toolarea';
|
import toolarea from './toolarea';
|
||||||
import files from './files';
|
import files from './files';
|
||||||
|
|
||||||
|
|
@ -19,7 +18,6 @@ const reducers = combineReducers(
|
||||||
consumers,
|
consumers,
|
||||||
notifications,
|
notifications,
|
||||||
chatmessages,
|
chatmessages,
|
||||||
chatbehavior,
|
|
||||||
toolarea,
|
toolarea,
|
||||||
files
|
files
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,19 +0,0 @@
|
||||||
const sharing = (state = [], action) =>
|
|
||||||
{
|
|
||||||
switch (action.type)
|
|
||||||
{
|
|
||||||
case 'SEND_FILE':
|
|
||||||
return [ ...state, { ...action.payload, me: true } ];
|
|
||||||
|
|
||||||
case 'ADD_FILE':
|
|
||||||
return [ ...state, action.payload ];
|
|
||||||
|
|
||||||
case 'ADD_FILE_HISTORY':
|
|
||||||
return [ ...action.payload.fileHistory, ...state ];
|
|
||||||
|
|
||||||
default:
|
|
||||||
return state;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
export default sharing;
|
|
||||||
Loading…
Reference in New Issue