/** @jsx h */
import { Component, h, render } from 'preact';
import Tabs from './Tabs.jsx';
import Tab from './Tab.jsx';
import SystemComponentsView from './SystemComponentsView.jsx';
import SummaryView from './SummaryView.jsx';
import ProblemDescriptionView from './ProblemDescriptionView.jsx';
import SolutionDescriptionView from './SolutionDescriptionView.jsx';
import GetHelpView from './GetHelpView.jsx';
import DetailsView from './DetailsView.jsx';
class PageMain extends Component {
constructor() {
super();
this.state = { systemComponentsViewCollapsed: false };
this.Preact = {
Component: Component,
h: h,
render: render
};
this.Components = {
Tabs: Tabs,
Tab: Tab
};
this._extraTabs = [];
if (window.localStorage) {
this.state.systemComponentsViewCollapsed =
window.localStorage.getItem('_passenger_error_page_system_components_collapsed')
=== 'true';
}
}
render() {
return (
Error starting web application
{this._renderCollapseButton()}
{ this.tabs = x } }>
{this._renderExtraTabs()}
);
}
addExtraTab(key, title, component) {
this._extraTabs.push({
key: key,
title: title,
component: component
});
}
setActiveTab(key) {
this.tabs.setActiveKey(key);
}
_renderCollapseButton() {
if (this.state.systemComponentsViewCollapsed) {
return (
Expand
);
} else {
return (
Collapse
);
}
}
_renderExtraTabs() {
return this._extraTabs.map(function(spec) {
return (
{spec.component}
);
});
}
_handleExpandSystemComponentsView() {
this.setState({ systemComponentsViewCollapsed: false });
if (window.localStorage) {
try {
window.localStorage.setItem('_passenger_error_page_system_components_collapsed', 'false');
} catch (e) {
// Do nothing
}
}
}
_handleCollapseSystemComponentsView() {
this.setState({ systemComponentsViewCollapsed: true });
if (window.localStorage) {
try {
window.localStorage.setItem('_passenger_error_page_system_components_collapsed', 'true');
} catch (e) {
// Do nothing
}
}
}
}
export default PageMain;