Add a link to auth server for admins

This commit is contained in:
Tanner Collin 2019-01-28 16:42:33 -07:00
parent 6a448aca85
commit 909a7645ff
5 changed files with 118 additions and 90 deletions

29
webclient/src/Admin.js Normal file
View File

@ -0,0 +1,29 @@
import React, { Component } from 'react';
import { Breadcrumb, Dropdown, Header, Icon, Item, Menu, Segment, Input } from 'semantic-ui-react'
import { Link } from 'react-router-dom';
class Admin extends Component {
render() {
const data = this.props.data;
const match = this.props.match;
return (
<div>
<Breadcrumb size='large'>
<Breadcrumb.Section active>Admin</Breadcrumb.Section>
</Breadcrumb>
<Item.Group link unstackable divided>
<Item as='a' href='https://tools-auth.protospace.ca'>
<Item.Content>
<Item.Header>Auth Server</Item.Header>
<Item.Description>Manage tools, members, courses, and firmware</Item.Description>
</Item.Content>
</Item>
</Item.Group>
</div>
);
}
}
export default Admin;

View File

@ -235,7 +235,7 @@ class App extends Component {
{user.profile.selected_courses ?
<div>
<Route exact path='/' render={props =>
<Categories {...props} data={toolData} />
<Categories {...props} data={toolData} user={user} />
} />
<Route exact path='/:category' render={props =>

View File

@ -1,14 +1,16 @@
import React, { Component } from 'react';
import { Breadcrumb, Dropdown, Header, Icon, Item, Menu, Segment, Input } from 'semantic-ui-react'
import { Breadcrumb, Container, Dropdown, Header, Icon, Item, Menu, Segment, Input } from 'semantic-ui-react'
import { Link } from 'react-router-dom';
import Admin from './Admin';
class Categories extends Component {
render() {
const data = this.props.data;
const user = this.props.user;
const match = this.props.match;
return (
<div>
<Container>
<Breadcrumb size='large'>
<Breadcrumb.Section active>Categories</Breadcrumb.Section>
</Breadcrumb>
@ -25,7 +27,8 @@ class Categories extends Component {
</Item>
)}
</Item.Group>
</div>
{user.profile.lockout_admin && <Admin />}
</Container>
);
}
}

View File

@ -13,7 +13,6 @@ class Category extends Component {
);
return (
<div>
<Container>
<Breadcrumb size='large'>
<Breadcrumb.Section link as={Link} to='/'>Categories</Breadcrumb.Section>
@ -42,7 +41,6 @@ class Category extends Component {
)}
</Item.Group>
</Container>
</div>
);
}
}

View File

@ -43,7 +43,6 @@ 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>
@ -101,7 +100,6 @@ class Tool extends Component {
<p>{tool.notes}</p>
</Segment>
</Container>
</div>
);
}
}