Skip to content
Snippets Groups Projects
Commit bef731d6 authored by Nithya's avatar Nithya
Browse files
Function and variable names updated
parent f9c8203f
No related branches found
No related tags found
1 merge request!209Resolve TMSS-297
......@@ -23,7 +23,7 @@ class App extends Component {
layoutMode: 'static',
currentMenu: '',
currentPath: '/',
currentPageName:'',
PageTitle:'',
staticMenuInactive: false,
overlayMenuActive: false,
mobileMenuActive: false,
......@@ -32,7 +32,7 @@ class App extends Component {
this.onToggleMenu = this.onToggleMenu.bind(this);
this.onSidebarClick = this.onSidebarClick.bind(this);
this.onMenuItemClick = this.onMenuItemClick.bind(this);
this.setCurrentPageName = this.setCurrentPageName.bind(this);
this.setPageTitle = this.setPageTitle.bind(this);
this.menu = [
{label: 'Dashboard', icon: 'pi pi-fw pi-home', to:'/dashboard'},
......@@ -90,9 +90,9 @@ class App extends Component {
return window.innerWidth > 1024;
}
setCurrentPageName(currentPageName) {
if (currentPageName !== this.state.currentPageName) {
this.setState({ currentPageName })
setPageTitle(PageTitle) {
if (PageTitle !== this.state.PageTitle) {
this.setState({ PageTitle })
}
}
......@@ -116,9 +116,9 @@ class App extends Component {
<Router basename={ this.state.currentPath }>
<AppMenu model={this.menu} onMenuItemClick={this.onMenuItemClick} />
<div className="layout-main">
<AppBreadCrumbWithRouter setCurrentPageName={this.setCurrentPageName} />
<AppBreadCrumbWithRouter setPageTitle={this.setPageTitle} />
{/* Display current pagename */}
<h2>{this.state.currentPageName}</h2>
<h2>{this.state.PageTitle}</h2>
<RoutedContent />
</div>
</Router>
......
......@@ -27,13 +27,13 @@ export class AppBreadcrumb extends Component {
onRoute() {
const { breadcrumbs } = this.state;
const { setCurrentPageName } = this.props;
const { setPageTitle } = this.props;
const currentRoute = routes.find(route => matchPath(this.props.location.pathname, {path: route.path, exact: true, strict: true}));
//for intial route ,there wont be any route object so it failed
if(!currentRoute){
return;
}
setCurrentPageName(currentRoute.pageTitle);
setPageTitle(currentRoute.pageTitle);
if (!breadcrumbs.length) {
this.setState({ breadcrumbs: [{...this.props.location, name: currentRoute.name}] });
return;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment