Skip to content

Commit

Permalink
stop reversing every actions array
Browse files Browse the repository at this point in the history
  • Loading branch information
dctalbot committed Nov 22, 2019
1 parent 8f99a3f commit 41cd2fe
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 32 deletions.
10 changes: 5 additions & 5 deletions web/src/app/schedules/ScheduleNewOverrideFAB.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ export default class ScheduleNewOverrideFAB extends React.PureComponent {
}

actions = [
{
label: 'Temporarily Add a User',
onClick: () => this.props.onClick('add'),
icon: <AccountPlus />,
},
{
label: 'Temporarily Replace a User',
onClick: () => this.props.onClick('replace'),
Expand All @@ -19,11 +24,6 @@ export default class ScheduleNewOverrideFAB extends React.PureComponent {
onClick: () => this.props.onClick('remove'),
icon: <AccountMinus />,
},
{
label: 'Temporarily Add a User',
onClick: () => this.props.onClick('add'),
icon: <AccountPlus />,
},
]

render() {
Expand Down
10 changes: 5 additions & 5 deletions web/src/app/schedules/ScheduleRuleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -119,16 +119,16 @@ export default class ScheduleRuleList extends React.PureComponent {
<SpeedDial
label='Add Assignment'
actions={[
{
label: 'Add Rotation',
onClick: () => this.setState({ createType: 'rotation' }),
icon: <AccountMultiplePlus />,
},
{
label: 'Add User',
onClick: () => this.setState({ createType: 'user' }),
icon: <AccountPlus />,
},
{
label: 'Add Rotation',
onClick: () => this.setState({ createType: 'rotation' }),
icon: <AccountMultiplePlus />,
},
]}
/>
</PageActions>
Expand Down
10 changes: 5 additions & 5 deletions web/src/app/users/UserDetails.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,16 +86,16 @@ export default function UserDetails(props) {
<SpeedDial
label='Add Items'
actions={[
{
label: 'Add Contact Method',
icon: <SettingsPhone />,
onClick: () => setCreateCM(true),
},
{
label: 'Add Notification Rule',
icon: <AddAlarm />,
onClick: () => setCreateNR(true),
},
{
label: 'Add Contact Method',
icon: <SettingsPhone />,
onClick: () => setCreateCM(true),
},
]}
/>
)}
Expand Down
31 changes: 14 additions & 17 deletions web/src/app/util/SpeedDial.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,23 +37,20 @@ export default function CustomSpeedDial(props) {
open={open}
className={classes.speedDial}
>
{props.actions
.slice() // TODO why this?
.reverse() // TODO why this? If we cut this line, we have to reorder the action arrays everywhere else (3 instances)
.map((action, idx) => (
<SpeedDialAction
key={idx}
icon={action.icon}
tooltipTitle={action.label}
tooltipOpen
classes={{ staticTooltipLabel: classes.staticTooltipLabel }}
aria-label={action.label}
onClick={() => {
setOpen(false)
action.onClick()
}}
/>
))}
{props.actions.map((action, idx) => (
<SpeedDialAction
key={idx}
icon={action.icon}
tooltipTitle={action.label}
tooltipOpen
classes={{ staticTooltipLabel: classes.staticTooltipLabel }}
aria-label={action.label}
onClick={() => {
setOpen(false)
action.onClick()
}}
/>
))}
</SpeedDial>
)
}
Expand Down

0 comments on commit 41cd2fe

Please sign in to comment.