2019-04-20 11:52:07 -07:00
|
|
|
import { openModal } from 'flavours/glitch/actions/modal';
|
|
|
|
import { connect } from 'react-redux';
|
2019-08-26 09:24:10 -07:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-04-20 11:52:07 -07:00
|
|
|
import Header from '../components/header';
|
2022-10-11 01:41:15 -07:00
|
|
|
import { logOut } from 'flavours/glitch/utils/log_out';
|
2019-08-26 09:24:10 -07:00
|
|
|
|
|
|
|
const messages = defineMessages({
|
|
|
|
logoutMessage: { id: 'confirmations.logout.message', defaultMessage: 'Are you sure you want to log out?' },
|
|
|
|
logoutConfirm: { id: 'confirmations.logout.confirm', defaultMessage: 'Log out' },
|
|
|
|
});
|
2019-04-20 11:52:07 -07:00
|
|
|
|
|
|
|
const mapStateToProps = state => {
|
|
|
|
return {
|
|
|
|
columns: state.getIn(['settings', 'columns']),
|
|
|
|
unreadNotifications: state.getIn(['notifications', 'unread']),
|
|
|
|
showNotificationsBadge: state.getIn(['local_settings', 'notifications', 'tab_badge']),
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
const mapDispatchToProps = (dispatch, { intl }) => ({
|
2019-04-23 09:19:35 -07:00
|
|
|
onSettingsClick (e) {
|
2019-04-20 11:52:07 -07:00
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
dispatch(openModal('SETTINGS', {}));
|
|
|
|
},
|
2019-08-26 09:24:10 -07:00
|
|
|
onLogout () {
|
|
|
|
dispatch(openModal('CONFIRM', {
|
|
|
|
message: intl.formatMessage(messages.logoutMessage),
|
|
|
|
confirm: intl.formatMessage(messages.logoutConfirm),
|
2021-08-06 03:14:13 -07:00
|
|
|
closeWhenConfirm: false,
|
2019-08-26 09:24:10 -07:00
|
|
|
onConfirm: () => logOut(),
|
|
|
|
}));
|
|
|
|
},
|
2019-04-20 11:52:07 -07:00
|
|
|
});
|
|
|
|
|
2019-08-26 09:24:10 -07:00
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Header));
|