fix accountbox toggling

This commit is contained in:
Connor Turland 2017-03-12 12:47:47 -04:00
parent 9f2a61ce32
commit fb094c3392
4 changed files with 14 additions and 8 deletions

View file

@ -7,7 +7,6 @@ const Account = {
changing: false, changing: false,
init: function() { init: function() {
var self = Account var self = Account
$('.sidebarAccountIcon').click(self.toggleBox)
$('body').click(self.close) $('body').click(self.close)
}, },
toggleBox: function(event) { toggleBox: function(event) {

View file

@ -7,6 +7,7 @@ import { merge } from 'lodash'
import { notifyUser } from './index.js' import { notifyUser } from './index.js'
import ImportDialog from './ImportDialog' import ImportDialog from './ImportDialog'
import Account from './Account'
import Active from '../Active' import Active from '../Active'
import DataModel from '../DataModel' import DataModel from '../DataModel'
import { ExploreMaps, ChatView, TopicCard } from '../Views' import { ExploreMaps, ChatView, TopicCard } from '../Views'
@ -86,7 +87,8 @@ const ReactApp = {
mobileTitle: self.mobileTitle, mobileTitle: self.mobileTitle,
mobileTitleWidth: self.mobileTitleWidth, mobileTitleWidth: self.mobileTitleWidth,
mobileTitleClick: (e) => Active.Map && InfoBox.toggleBox(e), mobileTitleClick: (e) => Active.Map && InfoBox.toggleBox(e),
openInviteLightbox: () => self.openLightbox('invite') openInviteLightbox: () => self.openLightbox('invite'),
toggleAccountBox: Account.toggleBox
}, },
self.getMapProps(), self.getMapProps(),
self.getTopicProps(), self.getTopicProps(),

View file

@ -9,7 +9,8 @@ class UpperRightUI extends Component {
currentUser: PropTypes.object, currentUser: PropTypes.object,
signInPage: PropTypes.bool, signInPage: PropTypes.bool,
unreadNotificationsCount: PropTypes.number, unreadNotificationsCount: PropTypes.number,
openInviteLightbox: PropTypes.func openInviteLightbox: PropTypes.func,
onClickAccount: PropTypes.func
} }
static contextTypes = { static contextTypes = {
@ -17,7 +18,7 @@ class UpperRightUI extends Component {
} }
render () { render () {
const { currentUser, signInPage, unreadNotificationsCount, openInviteLightbox } = this.props const { currentUser, signInPage, unreadNotificationsCount, openInviteLightbox, onClickAccount } = this.props
return <div className="upperRightUI"> return <div className="upperRightUI">
{currentUser && <a href="/maps/new" target="_blank" className="addMap upperRightEl upperRightIcon"> {currentUser && <a href="/maps/new" target="_blank" className="addMap upperRightEl upperRightIcon">
<div className="tooltipsUnder"> <div className="tooltipsUnder">
@ -28,7 +29,8 @@ class UpperRightUI extends Component {
<NotificationIcon unreadNotificationsCount={unreadNotificationsCount} /> <NotificationIcon unreadNotificationsCount={unreadNotificationsCount} />
</span>} </span>}
{!signInPage && <div className="sidebarAccount upperRightEl"> {!signInPage && <div className="sidebarAccount upperRightEl">
<div className="sidebarAccountIcon"><div className="tooltipsUnder">Account</div> <div className="sidebarAccountIcon" onClick={onClickAccount}>
<div className="tooltipsUnder">Account</div>
{currentUser && <img src={currentUser.get('image')} />} {currentUser && <img src={currentUser.get('image')} />}
{!currentUser && 'SIGN IN'} {!currentUser && 'SIGN IN'}
{!currentUser && <div className="accountInnerArrow"></div>} {!currentUser && <div className="accountInnerArrow"></div>}

View file

@ -15,7 +15,8 @@ class App extends Component {
mobileTitle: PropTypes.string, mobileTitle: PropTypes.string,
mobileTitleWidth: PropTypes.number, mobileTitleWidth: PropTypes.number,
mobileTitleClick: PropTypes.func, mobileTitleClick: PropTypes.func,
openInviteLightbox: PropTypes.func openInviteLightbox: PropTypes.func,
toggleAccountBox: PropTypes.func
} }
static childContextTypes = { static childContextTypes = {
@ -30,7 +31,8 @@ class App extends Component {
render () { render () {
const { children, toast, currentUser, unreadNotificationsCount, openInviteLightbox, const { children, toast, currentUser, unreadNotificationsCount, openInviteLightbox,
mobile, mobileTitle, mobileTitleWidth, mobileTitleClick, location } = this.props mobile, mobileTitle, mobileTitleWidth, mobileTitleClick, location,
toggleAccountBox } = this.props
const { pathname } = location || {} const { pathname } = location || {}
const unauthedHome = pathname === '/' && !currentUser const unauthedHome = pathname === '/' && !currentUser
return <div className="wrapper" id="wrapper"> return <div className="wrapper" id="wrapper">
@ -43,7 +45,8 @@ class App extends Component {
{!mobile && <UpperRightUI currentUser={currentUser} {!mobile && <UpperRightUI currentUser={currentUser}
unreadNotificationsCount={unreadNotificationsCount} unreadNotificationsCount={unreadNotificationsCount}
openInviteLightbox={openInviteLightbox} openInviteLightbox={openInviteLightbox}
signInPage={pathname === '/login'} />} signInPage={pathname === '/login'}
onClickAccount={toggleAccountBox} />}
<Toast message={toast} /> <Toast message={toast} />
{!mobile && currentUser && <a className='feedback-icon' target='_blank' href='https://hylo.com/c/metamaps'></a>} {!mobile && currentUser && <a className='feedback-icon' target='_blank' href='https://hylo.com/c/metamaps'></a>}
{children} {children}