Browse Source

Add tooltip for why you can't run a section

develop
Alex Mikhalev 6 years ago
parent
commit
dcce9edc34
  1. 22
      client/components/RunSectionForm.tsx

22
client/components/RunSectionForm.tsx

@ -1,6 +1,6 @@
import { observer } from "mobx-react"; import { observer } from "mobx-react";
import * as React from "react"; import * as React from "react";
import { Form, Header, Icon, Segment } from "semantic-ui-react"; import { Form, Header, Icon, Segment, Popup } from "semantic-ui-react";
import { DurationView, SectionChooser } from "@client/components"; import { DurationView, SectionChooser } from "@client/components";
import { UiStore } from "@client/state"; import { UiStore } from "@client/state";
@ -30,8 +30,14 @@ export default class RunSectionForm extends React.Component<
render() { render() {
const { sectionId, duration } = this.state; const { sectionId, duration } = this.state;
const runButton = (
<Form.Button primary onClick={this.run} disabled={!this.isValid} className="runSectionForm-runButton">
<Icon name="play" />
Run
</Form.Button>
);
return ( return (
<Segment> <Segment className="runSectionForm">
<Header>Run Section</Header> <Header>Run Section</Header>
<Form> <Form>
<SectionChooser <SectionChooser
@ -45,10 +51,14 @@ export default class RunSectionForm extends React.Component<
duration={duration} duration={duration}
onDurationChange={this.onDurationChange} onDurationChange={this.onDurationChange}
/> />
<Form.Button primary onClick={this.run} disabled={!this.isValid}> {
<Icon name="play" /> this.isValid ? runButton :
Run <Popup trigger={runButton} on={["click", "hover"]} position="right center">
</Form.Button> <Popup.Content>
Select a section to run and a duration
</Popup.Content>
</Popup>
}
</Form> </Form>
</Segment> </Segment>
); );

Loading…
Cancel
Save