forked from AugurProject/augur-ui
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
set of notification component changes
- Loading branch information
1 parent
fc375dd
commit 10ab7e7
Showing
11 changed files
with
231 additions
and
159 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,139 +1,169 @@ | ||
import React from 'react'; | ||
import React, { Component, PropTypes } from 'react'; | ||
|
||
import classnames from 'classnames'; | ||
|
||
import Link from 'modules/link/components/link'; | ||
import AugurLogoIcon from 'modules/common/components/augur-logo-icon'; | ||
import SideBarFilterIcon from 'modules/common/components/side-bar-filter-icon'; | ||
import NotificationsContainer from 'modules/notifications/container'; | ||
|
||
import { ACCOUNT, MARKETS, TRANSACTIONS, MY_POSITIONS, MY_MARKETS, MY_REPORTS, AUTHENTICATION } from 'modules/app/constants/views'; | ||
import { FAVORITES, PENDING_REPORTS } from 'modules/markets/constants/markets-subset'; | ||
|
||
// NOTE -- first child div is there to pass up a ref so that other methods can | ||
// acquire the row height of the navs in the footer | ||
const Nav = (p) => { | ||
function collapseFooter() { | ||
if (p.updateIsFooterCollapsed) { | ||
p.updateIsFooterCollapsed(true); | ||
|
||
export default class Nav extends Component { | ||
static propTypes = { | ||
updateIsFooterCollapsed: PropTypes.func | ||
} | ||
|
||
constructor(props) { | ||
super(props); | ||
|
||
this.state = { | ||
isNotificationsVisible: false | ||
}; | ||
|
||
this.collapseFooter = this.collapseFooter.bind(this); | ||
} | ||
|
||
collapseFooter() { | ||
if (this.props.updateIsFooterCollapsed) { | ||
this.props.updateIsFooterCollapsed(true); | ||
} | ||
} | ||
|
||
return ( | ||
<nav className={`app-nav ${p.className ? p.className : ''}`}> | ||
<div ref={p.navRef && p.navRef} /> | ||
{p.isSideBarAllowed && !p.isSideBarPersistent && | ||
<button | ||
className="app-nav-link unstyled" | ||
onClick={p.toggleSideBar} | ||
> | ||
{p.isSideBarCollapsed ? <SideBarFilterIcon /> : <i className="fa fa-remove" />} | ||
</button> | ||
} | ||
<div className="augur-brand"> | ||
<Link {...p.topicsLink} > | ||
<AugurLogoIcon /> | ||
</Link> | ||
</div> | ||
<Link | ||
{...p.allMarketsLink} | ||
onClick={() => { | ||
p.allMarketsLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', { active: ((p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader == null) })} | ||
> | ||
<i className="nav-icon fa fa-line-chart" /> | ||
Markets | ||
</Link> | ||
{p.logged && !!p.numFavorites && | ||
<Link | ||
{...p.favoritesLink} | ||
onClick={() => { | ||
p.favoritesLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', { active: (p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader === FAVORITES })} | ||
> | ||
<i className="nav-icon fa fa-star" /> | ||
<span className="nav-count">{p.numFavorites} </span> | ||
Favorites | ||
</Link> | ||
} | ||
{p.logged && !!p.numPendingReports && | ||
<Link | ||
{...p.pendingReportsLink} | ||
onClick={() => { | ||
p.pendingReportsLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', { active: (p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader === PENDING_REPORTS })} | ||
> | ||
<i className="nav-icon fa fa-copy" /> | ||
<span className="nav-count">{p.numPendingReports} </span> | ||
Pending Reports | ||
</Link> | ||
} | ||
{p.logged && !!p.portfolioTotals && | ||
<Link | ||
{...p.myPositionsLink} | ||
onClick={() => { | ||
p.myPositionsLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', MY_POSITIONS, { active: [MY_POSITIONS, MY_MARKETS, MY_REPORTS].indexOf(p.activeView) > -1 })} | ||
> | ||
<i className="nav-icon fa fa-money" /> | ||
Portfolio | ||
</Link> | ||
} | ||
{p.logged && | ||
<Link | ||
{...p.transactionsLink} | ||
onClick={() => { | ||
p.transactionsLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', TRANSACTIONS, { active: p.activeView === TRANSACTIONS }, { working: p.isTransactionsWorking })} | ||
> | ||
<i className="nav-icon fa fa-tasks" /> | ||
{!!p.numTransactionsWorking && | ||
<span className="nav-count">{p.numTransactionsWorking} </span> | ||
} | ||
{p.transactionsTotals.title} | ||
</Link> | ||
} | ||
{p.logged && | ||
<Link | ||
{...p.accountLink} | ||
onClick={() => { | ||
p.accountLink.onClick(); | ||
collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', ACCOUNT, { active: p.activeView === ACCOUNT })} | ||
> | ||
<i className="nav-icon fa fa-cog" /> | ||
Account | ||
</Link> | ||
} | ||
{!p.logged && | ||
render() { | ||
const p = this.props; | ||
const s = this.state; | ||
|
||
return ( | ||
<nav className={`app-nav ${p.className ? p.className : ''}`}> | ||
<div ref={p.navRef && p.navRef} /> | ||
{p.isSideBarAllowed && !p.isSideBarPersistent && | ||
<button | ||
className="app-nav-link unstyled" | ||
onClick={p.toggleSideBar} | ||
> | ||
{p.isSideBarCollapsed ? <SideBarFilterIcon /> : <i className="fa fa-remove" />} | ||
</button> | ||
} | ||
<div className="augur-brand"> | ||
<Link {...p.topicsLink} > | ||
<AugurLogoIcon /> | ||
</Link> | ||
</div> | ||
{p.logged && | ||
<button | ||
className="unstyled button-notifications app-nav-link" | ||
onClick={() => this.setState({ isNotificationsVisible: !s.isNotificationsVisible })} | ||
> | ||
<i className="fa fa-bell-o" /> | ||
</button> | ||
} | ||
<Link | ||
{...p.authLink} | ||
{...p.allMarketsLink} | ||
onClick={() => { | ||
p.authLink.onClick(); | ||
collapseFooter(); | ||
p.allMarketsLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', AUTHENTICATION, { active: p.activeView === AUTHENTICATION })} | ||
className={classnames('app-nav-link', { active: ((p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader == null) })} | ||
> | ||
<div className="nav-icon-google-translate-fix"> | ||
<i className="nav-icon"> | ||
<AugurLogoIcon /> | ||
</i> | ||
</div> | ||
Sign Up / Login | ||
<i className="nav-icon fa fa-line-chart" /> | ||
Markets | ||
</Link> | ||
} | ||
</nav> | ||
); | ||
}; | ||
|
||
export default Nav; | ||
{p.logged && !!p.numFavorites && | ||
<Link | ||
{...p.favoritesLink} | ||
onClick={() => { | ||
p.favoritesLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', { active: (p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader === FAVORITES })} | ||
> | ||
<i className="nav-icon fa fa-star" /> | ||
<span className="nav-count">{p.numFavorites} </span> | ||
Favorites | ||
</Link> | ||
} | ||
{p.logged && !!p.numPendingReports && | ||
<Link | ||
{...p.pendingReportsLink} | ||
onClick={() => { | ||
p.pendingReportsLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', { active: (p.activeView === MARKETS || (!!parseInt(p.activeView, 10) && Number.isInteger(parseInt(p.activeView, 10)))) && p.marketsInfo.selectedMarketsHeader === PENDING_REPORTS })} | ||
> | ||
<i className="nav-icon fa fa-copy" /> | ||
<span className="nav-count">{p.numPendingReports} </span> | ||
Pending Reports | ||
</Link> | ||
} | ||
{p.logged && !!p.portfolioTotals && | ||
<Link | ||
{...p.myPositionsLink} | ||
onClick={() => { | ||
p.myPositionsLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', MY_POSITIONS, { active: [MY_POSITIONS, MY_MARKETS, MY_REPORTS].indexOf(p.activeView) > -1 })} | ||
> | ||
<i className="nav-icon fa fa-money" /> | ||
Portfolio | ||
</Link> | ||
} | ||
{p.logged && | ||
<Link | ||
{...p.transactionsLink} | ||
onClick={() => { | ||
p.transactionsLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', TRANSACTIONS, { active: p.activeView === TRANSACTIONS }, { working: p.isTransactionsWorking })} | ||
> | ||
<i className="nav-icon fa fa-tasks" /> | ||
{p.numTransactionsWorking ? | ||
<span className="nav-count">{p.numTransactionsWorking} Transactions Working</span> : | ||
<span>Transactions</span> | ||
} | ||
</Link> | ||
} | ||
{p.logged && | ||
<Link | ||
{...p.accountLink} | ||
onClick={() => { | ||
p.accountLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', ACCOUNT, { active: p.activeView === ACCOUNT })} | ||
> | ||
<i className="nav-icon fa fa-cog" /> | ||
Account | ||
</Link> | ||
} | ||
{!p.logged && | ||
<Link | ||
{...p.authLink} | ||
onClick={() => { | ||
p.authLink.onClick(); | ||
this.collapseFooter(); | ||
}} | ||
className={classnames('app-nav-link', AUTHENTICATION, { active: p.activeView === AUTHENTICATION })} | ||
> | ||
<div className="nav-icon-google-translate-fix"> | ||
<i className="nav-icon"> | ||
<AugurLogoIcon /> | ||
</i> | ||
</div> | ||
Sign Up / Login | ||
</Link> | ||
} | ||
{p.logged && s.isNotificationsVisible && | ||
<NotificationsContainer /> | ||
} | ||
</nav> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import React from 'react'; | ||
|
||
const Notification = p => ( | ||
<span>Notification</span> | ||
); | ||
|
||
export default Notification; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#notifications_view { | ||
.border(true); | ||
|
||
background-color: @color-white; | ||
bottom: 0; | ||
margin: 0; | ||
position: absolute; | ||
transform: translateY(100%); | ||
width: 300px; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.