Skip to content

Commit

Permalink
noSettings parameter to remove Settings button and dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
zalmoxisus committed Aug 1, 2016
1 parent fd3ad00 commit 64b6689
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/app/components/Button.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export default class Button extends React.Component {
theme: PropTypes.oneOfType([
PropTypes.object,
PropTypes.string
]).isRequired
])
};

static defaultProps = {
Expand Down
21 changes: 13 additions & 8 deletions src/app/components/ButtonBar.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ export default class ButtonBar extends Component {
saveSettings: PropTypes.func.isRequired,
importState: PropTypes.func.isRequired,
exportState: PropTypes.func.isRequired,
socketOptions: PropTypes.object
socketOptions: PropTypes.object,
noSettings: PropTypes.bool
};

constructor() {
Expand Down Expand Up @@ -58,14 +59,18 @@ export default class ButtonBar extends Component {
<SliderButton isOpen={this.props.sliderIsOpen} onClick={this.props.toggleSlider} />
<ImportButton importState={this.props.importState} />
<ExportButton exportState={this.props.exportState} />
<Button Icon={SettingsIcon} onClick={this.openSettings}>Settings</Button>
{!this.props.noSettings &&
<Button Icon={SettingsIcon} onClick={this.openSettings}>Settings</Button>
}
<Button Icon={HelpIcon} onClick={this.openHelp}>How to use</Button>
<Settings
isOpen={this.state.settingsOpened}
close={this.closeSettings}
saveSettings={this.props.saveSettings}
socketOptions={this.props.socketOptions}
/>
{!this.props.noSettings &&
<Settings
isOpen={this.state.settingsOpened}
close={this.closeSettings}
saveSettings={this.props.saveSettings}
socketOptions={this.props.socketOptions}
/>
}
</div>
);
}
Expand Down
25 changes: 12 additions & 13 deletions src/app/containers/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export default class App extends Component {
autoReconnect: PropTypes.bool,
secure: PropTypes.bool
}),
noButtonBar: PropTypes.bool
noSettings: PropTypes.bool
};

constructor() {
Expand Down Expand Up @@ -172,18 +172,17 @@ export default class App extends Component {
key={`Dispatcher-${key}`}
/>
}
{!this.props.noButtonBar &&
<ButtonBar
openModal={this.openModal} closeModal={this.closeModal}
toggleDispatcher={this.toggleDispatcher}
dispatcherIsOpen={this.state.dispatcherIsOpen}
toggleSlider={this.toggleSlider}
sliderIsOpen={this.state.sliderIsOpen}
saveSettings={this.saveSettings}
importState={importState} exportState={exportState}
socketOptions={this.socketOptions}
/>
}
<ButtonBar
openModal={this.openModal} closeModal={this.closeModal}
toggleDispatcher={this.toggleDispatcher}
dispatcherIsOpen={this.state.dispatcherIsOpen}
toggleSlider={this.toggleSlider}
sliderIsOpen={this.state.sliderIsOpen}
saveSettings={this.saveSettings}
importState={importState} exportState={exportState}
socketOptions={this.socketOptions}
noSettings={this.props.noSettings}
/>
</div>
);
}
Expand Down

0 comments on commit 64b6689

Please sign in to comment.