-
Notifications
You must be signed in to change notification settings - Fork 337
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modals and DashAlert state #737
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
well done! just 2 readability things & 1 slight performance thing & we'll be ready to rock
}, | ||
|
||
main: { | ||
[ui.modalLayout[0]]: { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if we write the type out instead of referencing an array this would be easier to read
const {id: teamId, name: teamName, isPaid} = team; | ||
const hasActiveMeeting = Boolean(team && team.meetingId); | ||
const hasOverlay = hasActiveMeeting || !isPaid; | ||
const isSettings = router.isActive(`/team/${teamId}/settings`, false); | ||
initialValues.teamName = teamName; | ||
const DashHeaderInfoTitle = isSettings ? <EditTeamName initialValues={initialValues} teamName={teamName} teamId={teamId}/> : teamName; | ||
const modalLayout = hasNotificationBar ? ui.modalLayout[1] : ui.modalLayout[0]; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
referencing the array isn't very meaningful (i know i set a bad example with the notifications varList, but that's mainly for payload size). could we instead say something like `hasNotificationBar ? ui.main : ui.mainHasNotificaitonBar
if (activeMeetings.length > 0 || barType === TRIAL_EXPIRES_SOON || barType === TRIAL_EXPIRED) { | ||
this.props.dispatch(notificationBarPresent(true)); | ||
} else { | ||
this.props.dispatch(notificationBarPresent(false)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we grab hasNotificationBar
and ONLY call dispatch if nextProps.hasNotificationBar !== this.props.hasNotificationBar? Otherwise we'll be triggering a dispatch on every new prop that comes in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes! Very helpful, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@mattkrick Not sure how to set it the first time without next always equal to the current.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ackernaut here's the pattern i use:
- factor this out into its own method
- call that method from componentWillMount and componentWillReceiveProps
- from cWRP, pass in this.props and nextProps
- from cWM, pass in this.props as the nextProps param and {} for nextProps
Check out MeetingContainer
for the pattern, i do this for handleRedirects
.
Codecov Report
@@ Coverage Diff @@
## master #737 +/- ##
=========================================
+ Coverage 56.66% 56.77% +0.1%
=========================================
Files 97 97
Lines 1207 1210 +3
=========================================
+ Hits 684 687 +3
Misses 523 523
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #737 +/- ##
=========================================
+ Coverage 56.66% 56.77% +0.1%
=========================================
Files 97 97
Lines 1207 1210 +3
=========================================
+ Hits 684 687 +3
Misses 523 523
Continue to review full report at Codecov.
|
return ( | ||
<DashLayoutContainer> | ||
<DashLayoutContainer dispatch={dispatch}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
dont pass dispatch to containers, mapStateToProps
gives it to em anyways
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ackernaut is this necessary?
@@ -0,0 +1,23 @@ | |||
const NOTIFICATION_BAR_PRESENT = 'notifications/NOTIFICATION_BAR_PRESENT'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
where does this bar appear? all dashboards? meeting? i think we may wanna refactor it into a dashboard duck. we already have an entity called notifications & having a notifications duck that doesnt pertain to it is gonna get confusing.
Ok @mattkrick all changes have been made! This PR is ready. |
const title = pathname === '/me' ? 'User Dashboard' : 'User Settings'; | ||
return ( | ||
<DashboardWrapper location={pathname} title={title}> | ||
<DashboardWrapper dispatch={dispatch} location={pathname} title={title}> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
necessary?
src/universal/redux/makeReducer.js
Outdated
@@ -35,6 +36,7 @@ const appReducers = { | |||
[DEFAULT_AUTH_REDUCER_NAME]: auth, | |||
cashay: cashayReducer, | |||
form: formReducer.plugin(formPlugin), | |||
notifications: notificationReducer, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's refactor to 'dashboard' or something similar so we don't confuse the notification bar with notifications
@mattkrick what do you think about |
Ok @mattkrick third time’s the charm, eh?
|
@@ -10,7 +10,7 @@ import HTML5Backend from 'react-dnd-html5-backend'; | |||
const NewTeam = (props) => { | |||
const {dispatch, params: {newOrg}} = props; | |||
return ( | |||
<DashboardWrapper title="User Dashboard"> | |||
<DashboardWrapper dispatch={dispatch} title="User Dashboard"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ackernaut can we get rid of this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just 1 itty bitty change!
👍 |
Is this ready to merge now? |
Fixes #724