2018-02-03 03:53:08 +00:00
|
|
|
import React, { Component } from 'react';
|
2018-02-03 06:41:30 +00:00
|
|
|
import { Breadcrumb, Container, Dropdown, Header, Icon, Item, Label, Menu, Segment, Input } from 'semantic-ui-react'
|
2018-02-03 03:53:08 +00:00
|
|
|
import { Link } from 'react-router-dom';
|
|
|
|
|
|
|
|
class Category extends Component {
|
|
|
|
render() {
|
|
|
|
const data = this.props.data;
|
2018-02-04 00:20:58 +00:00
|
|
|
const user = this.props.user;
|
2018-02-03 03:53:08 +00:00
|
|
|
const match = this.props.match;
|
|
|
|
|
|
|
|
const category = data.categories.find((x) =>
|
2018-02-04 00:20:58 +00:00
|
|
|
x.slug === match.params.category
|
2018-02-03 03:53:08 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
return (
|
2018-02-03 06:41:30 +00:00
|
|
|
<div>
|
|
|
|
<Container>
|
|
|
|
<Breadcrumb size='large'>
|
|
|
|
<Breadcrumb.Section link as={Link} to='/'>Categories</Breadcrumb.Section>
|
|
|
|
<Breadcrumb.Divider icon='right angle' />
|
|
|
|
<Breadcrumb.Section active>{category.name}</Breadcrumb.Section>
|
|
|
|
</Breadcrumb>
|
2018-02-03 03:53:08 +00:00
|
|
|
|
2018-02-03 06:41:30 +00:00
|
|
|
<Item.Group link unstackable divided>
|
|
|
|
{category.tools.map((x, n) =>
|
|
|
|
<Item as={Link} to={'/' + category.slug + '/' + x.id} key={n}>
|
|
|
|
<Item.Image size='tiny' src={x.photo} />
|
|
|
|
<Item.Content>
|
|
|
|
<Item.Header>{x.name}</Item.Header>
|
|
|
|
<Item.Description>
|
|
|
|
{user.authorizedTools.includes(x.id) ?
|
|
|
|
<Label color='green'>
|
|
|
|
<Icon name='check' /> Authorized
|
|
|
|
</Label> : <Label color='red'>
|
|
|
|
<Icon name='x' /> Unauthorized
|
|
|
|
</Label>
|
|
|
|
}
|
|
|
|
</Item.Description>
|
|
|
|
<Item.Extra>Wiki ID: {x.wikiId}</Item.Extra>
|
|
|
|
</Item.Content>
|
|
|
|
</Item>
|
|
|
|
)}
|
|
|
|
</Item.Group>
|
|
|
|
</Container>
|
|
|
|
</div>
|
2018-02-03 03:53:08 +00:00
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export default Category;
|