diff --git a/client/app/Root.jsx b/client/app/Root.jsx index 707e644..c9b8cb2 100644 --- a/client/app/Root.jsx +++ b/client/app/Root.jsx @@ -14,7 +14,7 @@ class Root extends Component { - + diff --git a/client/app/components/admin/Admin.jsx b/client/app/components/admin/Admin.jsx index 8594c11..31a451d 100644 --- a/client/app/components/admin/Admin.jsx +++ b/client/app/components/admin/Admin.jsx @@ -29,7 +29,7 @@ class AdminComponent extends React.Component { fetchJSON('https://apollo.kevinmidboe.com/api/v1/plex/requests/all', 'GET') .then(result => { this.setState({ - requested_objects: result.requestedItems + requested_objects: result.requestedItems.reverse() }) }) } @@ -49,18 +49,25 @@ class AdminComponent extends React.Component { return } - let display = undefined - if (this.props.match.params.search && this.state.requested_objects !== '') { - display = this.state.requested_objects[this.props.match.params.search] + let selectedRequest = undefined; + let listItemSelected = undefined; + + const requestParam = this.props.match.params.request; + if (requestParam && this.state.requested_objects !== '') { + selectedRequest = this.state.requested_objects[requestParam] + listItemSelected = requestParam } return (
- +
- +
) diff --git a/client/app/components/admin/AdminRequestInfo.jsx b/client/app/components/admin/AdminRequestInfo.jsx index fa7c36e..dd508de 100644 --- a/client/app/components/admin/AdminRequestInfo.jsx +++ b/client/app/components/admin/AdminRequestInfo.jsx @@ -35,7 +35,7 @@ class AdminRequestInfo extends Component { minHeight: '450px', } } - const request = this.props.display; + const request = this.props.selectedRequest; if (request) { return ( diff --git a/client/app/components/admin/Sidebar.jsx b/client/app/components/admin/Sidebar.jsx index 09dc4ab..5d001b0 100644 --- a/client/app/components/admin/Sidebar.jsx +++ b/client/app/components/admin/Sidebar.jsx @@ -3,12 +3,23 @@ import { Link } from 'react-router-dom'; class SidebarComponent extends Component { + generateListElements(index, item) { + if (index == this.props.listItemSelected) + return ( + {item.name} + ) + else + return ( + {item.name} + ) + } + displayRequestedElementsInfo() { if (this.props.requested_objects) { - let element = this.props.requested_objects.map((item, index) => { + let requestedElement = this.props.requested_objects.map((item, index) => { return ( - {item.name} + { this.generateListElements(index, item) } {item.status} {item.requested_date} @@ -25,7 +36,7 @@ class SidebarComponent extends Component { - {element} + {requestedElement} )