|
|
|
@ -43,65 +43,63 @@ class Tool extends Component { |
|
|
|
|
const approved = user.profile.authorized_tools.includes(tool.slug); |
|
|
|
|
|
|
|
|
|
return ( |
|
|
|
|
<div> |
|
|
|
|
<Container> |
|
|
|
|
<Breadcrumb size='large'> |
|
|
|
|
<Breadcrumb.Section link as={Link} to='/'>Categories</Breadcrumb.Section> |
|
|
|
|
<Breadcrumb.Divider icon='right angle' /> |
|
|
|
|
<Breadcrumb.Section link as={Link} to={'/' + category.slug}>{category.name}</Breadcrumb.Section> |
|
|
|
|
<Breadcrumb.Divider icon='right angle' /> |
|
|
|
|
<Breadcrumb.Section active>{tool.name}</Breadcrumb.Section> |
|
|
|
|
</Breadcrumb> |
|
|
|
|
<Container> |
|
|
|
|
<Breadcrumb size='large'> |
|
|
|
|
<Breadcrumb.Section link as={Link} to='/'>Categories</Breadcrumb.Section> |
|
|
|
|
<Breadcrumb.Divider icon='right angle' /> |
|
|
|
|
<Breadcrumb.Section link as={Link} to={'/' + category.slug}>{category.name}</Breadcrumb.Section> |
|
|
|
|
<Breadcrumb.Divider icon='right angle' /> |
|
|
|
|
<Breadcrumb.Section active>{tool.name}</Breadcrumb.Section> |
|
|
|
|
</Breadcrumb> |
|
|
|
|
|
|
|
|
|
<Segment> |
|
|
|
|
<Image src={tool.photo} size='medium' centered rounded /> |
|
|
|
|
<Segment textAlign='center' basic> |
|
|
|
|
<p>Status: {decodedStatus.msg}</p> |
|
|
|
|
<div> |
|
|
|
|
<Button color='green' |
|
|
|
|
disabled={!approved || !decodedStatus.canArm} |
|
|
|
|
onClick={() => requestInterlock({toolSlug: tool.slug, action: 'arm',})} |
|
|
|
|
> |
|
|
|
|
<Icon name='lightning' /> Arm |
|
|
|
|
</Button> |
|
|
|
|
<Button color='red' |
|
|
|
|
disabled={!approved || !decodedStatus.canDisarm} |
|
|
|
|
onClick={() => requestInterlock({toolSlug: tool.slug, action: 'disarm',})} |
|
|
|
|
> |
|
|
|
|
<Icon name='stop' /> Disarm |
|
|
|
|
</Button> |
|
|
|
|
<br /> |
|
|
|
|
{approved || <Label basic color='red' pointing> |
|
|
|
|
Not authorized! Please take the xyz course. |
|
|
|
|
</Label>} |
|
|
|
|
</div> |
|
|
|
|
</Segment> |
|
|
|
|
<Segment> |
|
|
|
|
<Image src={tool.photo} size='medium' centered rounded /> |
|
|
|
|
<Segment textAlign='center' basic> |
|
|
|
|
<p>Status: {decodedStatus.msg}</p> |
|
|
|
|
<div> |
|
|
|
|
<Button color='green' |
|
|
|
|
disabled={!approved || !decodedStatus.canArm} |
|
|
|
|
onClick={() => requestInterlock({toolSlug: tool.slug, action: 'arm',})} |
|
|
|
|
> |
|
|
|
|
<Icon name='lightning' /> Arm |
|
|
|
|
</Button> |
|
|
|
|
<Button color='red' |
|
|
|
|
disabled={!approved || !decodedStatus.canDisarm} |
|
|
|
|
onClick={() => requestInterlock({toolSlug: tool.slug, action: 'disarm',})} |
|
|
|
|
> |
|
|
|
|
<Icon name='stop' /> Disarm |
|
|
|
|
</Button> |
|
|
|
|
<br /> |
|
|
|
|
{approved || <Label basic color='red' pointing> |
|
|
|
|
Not authorized! Please take the xyz course. |
|
|
|
|
</Label>} |
|
|
|
|
</div> |
|
|
|
|
</Segment> |
|
|
|
|
|
|
|
|
|
<Table basic='very' unstackable> |
|
|
|
|
<Table.Body> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Cat</Table.Cell> |
|
|
|
|
<Table.Cell>Meow</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Dog</Table.Cell> |
|
|
|
|
<Table.Cell warning> |
|
|
|
|
<Icon name='attention' /> |
|
|
|
|
Bark |
|
|
|
|
</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Bird</Table.Cell> |
|
|
|
|
<Table.Cell>Chrip</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
</Table.Body> |
|
|
|
|
</Table> |
|
|
|
|
<Table basic='very' unstackable> |
|
|
|
|
<Table.Body> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Cat</Table.Cell> |
|
|
|
|
<Table.Cell>Meow</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Dog</Table.Cell> |
|
|
|
|
<Table.Cell warning> |
|
|
|
|
<Icon name='attention' /> |
|
|
|
|
Bark |
|
|
|
|
</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
<Table.Row> |
|
|
|
|
<Table.Cell>Bird</Table.Cell> |
|
|
|
|
<Table.Cell>Chrip</Table.Cell> |
|
|
|
|
</Table.Row> |
|
|
|
|
</Table.Body> |
|
|
|
|
</Table> |
|
|
|
|
|
|
|
|
|
<Header as='h4'>Notes</Header> |
|
|
|
|
<p>{tool.notes}</p> |
|
|
|
|
</Segment> |
|
|
|
|
</Container> |
|
|
|
|
</div> |
|
|
|
|
<Header as='h4'>Notes</Header> |
|
|
|
|
<p>{tool.notes}</p> |
|
|
|
|
</Segment> |
|
|
|
|
</Container> |
|
|
|
|
); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|