2019-04-20 18:52:07 +00:00
|
|
|
import { openModal } from 'flavours/glitch/actions/modal';
|
|
|
|
import { connect } from 'react-redux';
|
2019-08-26 16:24:10 +00:00
|
|
|
import { defineMessages, injectIntl } from 'react-intl';
|
2019-04-20 18:52:07 +00:00
|
|
|
import Header from '../components/header';
|
2022-10-11 08:41:15 +00:00
|
|
|
import { logOut } from 'flavours/glitch/utils/log_out';
|
2019-08-26 16:24:10 +00: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 18:52:07 +00: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 16:19:35 +00:00
|
|
|
onSettingsClick (e) {
|
2019-04-20 18:52:07 +00:00
|
|
|
e.preventDefault();
|
|
|
|
e.stopPropagation();
|
|
|
|
dispatch(openModal('SETTINGS', {}));
|
|
|
|
},
|
2019-08-26 16:24:10 +00:00
|
|
|
onLogout () {
|
|
|
|
dispatch(openModal('CONFIRM', {
|
|
|
|
message: intl.formatMessage(messages.logoutMessage),
|
|
|
|
confirm: intl.formatMessage(messages.logoutConfirm),
|
2021-08-06 10:14:13 +00:00
|
|
|
closeWhenConfirm: false,
|
2019-08-26 16:24:10 +00:00
|
|
|
onConfirm: () => logOut(),
|
|
|
|
}));
|
|
|
|
},
|
2019-04-20 18:52:07 +00:00
|
|
|
});
|
|
|
|
|
2019-08-26 16:24:10 +00:00
|
|
|
export default injectIntl(connect(mapStateToProps, mapDispatchToProps)(Header));
|