Updates to Gab Deck

• Updates:
- to Gab Deck
This commit is contained in:
mgabdev
2020-12-08 00:07:04 -05:00
parent 05c5dcb581
commit 6950f67520
16 changed files with 210 additions and 115 deletions

View File

@@ -5,33 +5,20 @@ import ImmutablePropTypes from 'react-immutable-proptypes'
import ImmutablePureComponent from 'react-immutable-pure-component'
import { openPopover } from '../../actions/popover'
import { changeSetting, saveSettings } from '../../actions/settings'
import { resendUserConfirmationEmail } from '../../actions/user'
import { openModal } from '../../actions/modal'
import {
BREAKPOINT_EXTRA_SMALL,
MODAL_EMAIL_CONFIRMATION_REMINDER,
} from '../../constants'
import {
me,
meEmail,
emailConfirmed,
} from '../../initial_state'
import { me } from '../../initial_state'
import { makeGetAccount } from '../../selectors'
import Responsive from '../../features/ui/util/responsive_component'
import {
CX,
THEMES,
DEFAULT_THEME,
POPOVER_NAV_SETTINGS,
MODAL_DECK_COLUMN_ADD,
} from '../../constants'
import Avatar from '../avatar'
import BackButton from '../back_button'
import Button from '../button'
import Heading from '../heading'
import Icon from '../icon'
import NavigationBarButton from '../navigation_bar_button'
import Search from '../search'
import Text from '../text'
import Divider from '../divider'
class DeckSidebar extends ImmutablePureComponent {
@@ -47,12 +34,8 @@ class DeckSidebar extends ImmutablePureComponent {
this.props.onOpenNavSettingsPopover(this.avatarNode)
}
handleOnClickResendConfirmationEmail = () => {
const { emailConfirmationResends } = this.props
if (emailConfirmationResends % 2 === 0 && emailConfirmationResends > 0) {
this.props.onOpenEmailModal()
}
this.props.onResendUserConfirmationEmail()
handleOnOpenNewColumnModel = () => {
this.props.onOpenNewColumnModal()
}
setAvatarNode = (c) => {
@@ -60,45 +43,12 @@ class DeckSidebar extends ImmutablePureComponent {
}
render() {
const {
title,
showBackBtn,
actions,
tabs,
account,
noActions,
logoDisabled,
unreadChatsCount,
notificationCount,
} = this.props
const navigationContainerClasses = CX({
d: 1,
z4: 1,
w76PX: 1,
w100PC: 1,
})
const innerNavigationContainerClasses = CX({
d: 1,
w76PX: 1,
bgNavigation: 1,
aiCenter: 1,
z3: 1,
top0: 1,
bottom0: 1,
left0: 1,
borderRight1PX: 1,
borderColorSecondary: 1,
posFixed: 1,
})
const isHome = title === 'Home'
const { account, logoDisabled } = this.props
return (
<div className={navigationContainerClasses}>
<div className={[_s.d, _s.z4, _s.w76PX, _s.w100PC].join(' ')}>
<div className={innerNavigationContainerClasses}>
<div className={[_s.d, _s.w76PX, _s.bgNavigation, _s.aiCenter, _s.z3, _s.top0, _s.bottom0, _s.left0, _s.borderRight1PX, _s.borderColorSecondary, _s.posFixed].join(' ')}>
<div className={[_s.d, _s.flexRow, _s.w76PX, _s.h100PC].join(' ')}>
@@ -128,7 +78,7 @@ class DeckSidebar extends ImmutablePureComponent {
<Divider isSmall />
<NavigationBarButton title='&nbsp;' icon='add' />
<NavigationBarButton title='&nbsp;' icon='add' onClick={this.handleOnOpenNewColumnModel} />
</div>
<div className={[_s.d, _s.mtAuto, _s.aiCenter].join(' ')}>
@@ -159,25 +109,19 @@ class DeckSidebar extends ImmutablePureComponent {
const mapStateToProps = (state) => ({
account: makeGetAccount()(state, me),
emailConfirmationResends: state.getIn(['user', 'emailConfirmationResends'], 0),
theme: state.getIn(['settings', 'displayOptions', 'theme'], DEFAULT_THEME),
logoDisabled: state.getIn(['settings', 'displayOptions', 'logoDisabled'], false),
notificationCount: state.getIn(['notifications', 'unread']),
unreadChatsCount: state.getIn(['chats', 'chatsUnreadCount']),
})
const mapDispatchToProps = (dispatch) => ({
onOpenNavSettingsPopover(targetRef) {
dispatch(openPopover(POPOVER_NAV_SETTINGS, {
targetRef,
position: 'left-end',
position: 'right-start',
}))
},
onOpenEmailModal() {
dispatch(openModal(MODAL_EMAIL_CONFIRMATION_REMINDER))
},
onResendUserConfirmationEmail() {
dispatch(resendUserConfirmationEmail())
onOpenNewColumnModal() {
dispatch(openModal(MODAL_DECK_COLUMN_ADD))
},
onChange(key, value) {
dispatch(changeSetting(['displayOptions', key], value))
@@ -187,17 +131,8 @@ const mapDispatchToProps = (dispatch) => ({
DeckSidebar.propTypes = {
account: ImmutablePropTypes.map,
actions: PropTypes.array,
tabs: PropTypes.array,
title: PropTypes.string,
showBackBtn: PropTypes.bool,
notificationCount: PropTypes.number.isRequired,
unreadChatsCount: PropTypes.number.isRequired,
onOpenNavSettingsPopover: PropTypes.func.isRequired,
onOpenEmailModal: PropTypes.func.isRequired,
onResendUserConfirmationEmail: PropTypes.func.isRequired,
emailConfirmationResends: PropTypes.number.isRequired,
noActions: PropTypes.bool,
onOpenNewColumnModal: PropTypes.func.isRequired,
theme: PropTypes.string,
logoDisabled: PropTypes.bool,
}