import MapSearchIcon from 'mdi-react/MapSearchIcon';
import * as React from 'react';
import { Redirect, Route, Switch } from 'react-router';
import { HeroPage } from '../../components/HeroPage';
import { OrgAccountProfilePage } from './OrgAccountProfilePage';
import { OrgAccountSidebar } from './OrgAccountSidebar';
const NotFoundPage = () => (React.createElement(HeroPage, { icon: MapSearchIcon, title: "404: Not Found", subtitle: "Sorry, the requested organization page was not found." }));
/**
 * Renders a layout of a sidebar and a content area to display pages related to
 * an organization's settings.
 */
export const OrgAccountArea = props => {
    if (props.location.pathname === props.match.path) {
        return React.createElement(Redirect, { to: `${props.match.path}/profile` });
    }
    if (!props.authenticatedUser) {
        return null;
    }
    const transferProps = {
        authenticatedUser: props.authenticatedUser,
        org: props.org,
        onOrganizationUpdate: props.onOrganizationUpdate,
        isLightTheme: props.isLightTheme,
        extensions: props.extensions,
    };
    return (React.createElement("div", { className: "org-settings-area area" },
        React.createElement(OrgAccountSidebar, Object.assign({}, props, { className: "area__sidebar" })),
        React.createElement("div", { className: "area__content" },
            React.createElement(Switch, null,
                React.createElement(Route, { path: `${props.match.path}/profile`, key: "hardcoded-key" // see https://github.com/ReactTraining/react-router/issues/4578#issuecomment-334489490
                    , exact: true, 
                    // tslint:disable-next-line:jsx-no-lambda
                    render: routeComponentProps => (React.createElement(OrgAccountProfilePage, Object.assign({}, routeComponentProps, transferProps))) }),
                React.createElement(Route, { component: NotFoundPage })))));
};
//# sourceMappingURL=OrgAccountArea.js.map