Added page title.

merge-requests/7/head
Menaka Jayawardena 7 years ago
parent c34ab35e6c
commit 62f19e7411

@ -39,11 +39,12 @@ class BaseLayout extends Component {
this.logout = this.logout.bind(this); this.logout = this.logout.bind(this);
this.closeModal = this.closeModal.bind(this); this.closeModal = this.closeModal.bind(this);
this.onClickPlatforms = this.onClickPlatforms.bind(this); this.onClickPlatforms = this.onClickPlatforms.bind(this);
this.onClickApplications = this.onClickApplications.bind(this);
this.state = { this.state = {
notifications: 0, notifications: 0,
user: 'Admin', user: 'Admin',
openModal: false, openModal: false,
currentPage: "Applications", currentPage: "",
logo: {} logo: {}
}; };
} }
@ -80,10 +81,25 @@ class BaseLayout extends Component {
onClickPlatforms() { onClickPlatforms() {
window.location.href = "/publisher/assets/platforms"; window.location.href = "/publisher/assets/platforms";
this.setState({currentPage: "Platforms"}); this.setState({currentPage: "Platforms"})
}
onClickApplications() {
window.location.href = "/publisher/assets/apps";
}
getCurrentPageTitle() {
let href = window.location.href;
if (href.indexOf("apps") !== -1) {
return "Applications";
} else if (href.indexOf("platforms") !== -1) {
return "Platforms"
} }
}
render() { render() {
const userName = this.state.user._userName[0]; const userName = this.state.user._userName[0];
return ( return (
@ -138,13 +154,21 @@ class BaseLayout extends Component {
<Col> <Col>
<div id="sub-title"> <div id="sub-title">
{/*TODO: Add the current page title*/} {/*TODO: Add the current page title*/}
{/*{window.location.pathname}*/} {this.getCurrentPageTitle()}
</div> </div>
</Col> </Col>
<Col> <Col>
<div className="platform-link-placeholder"> <div className="platform-link-placeholder">
{this.getCurrentPageTitle() === "Applications" ?
<Button className="custom-flat grey" onClick={this.onClickPlatforms}> <Button className="custom-flat grey" onClick={this.onClickPlatforms}>
<i className="fw fw-settings"></i> Platforms</Button> <i className="fw fw-settings"></i>
Platforms
</Button> :
<Button className="custom-flat grey" onClick={this.onClickApplications}>
<i className="fw fw-application"></i>
Applications
</Button>
}
</div> </div>
</Col> </Col>
</Row> </Row>

Loading…
Cancel
Save