import MapSearchIcon from 'mdi-react/MapSearchIcon';
import * as React from 'react';
import { Route, Switch } from 'react-router';
import { Subscription } from 'rxjs';
import { HeroPage } from '../../components/HeroPage';
import { RepoHeaderBreadcrumbNavItem } from '../RepoHeaderBreadcrumbNavItem';
import { RepoHeaderContributionPortal } from '../RepoHeaderContributionPortal';
import { RepositoryBranchesAllPage } from './RepositoryBranchesAllPage';
import { RepositoryBranchesNavbar } from './RepositoryBranchesNavbar';
import { RepositoryBranchesOverviewPage } from './RepositoryBranchesOverviewPage';
const NotFoundPage = () => (React.createElement(HeroPage, { icon: MapSearchIcon, title: "404: Not Found", subtitle: "Sorry, the requested repository branches page was not found." }));
/**
 * Renders pages related to repository branches.
 */
export class RepositoryBranchesArea extends React.Component {
    constructor() {
        super(...arguments);
        this.subscriptions = new Subscription();
    }
    componentWillUnmount() {
        this.subscriptions.unsubscribe();
    }
    render() {
        const transferProps = {
            repo: this.props.repo,
        };
        return (React.createElement("div", { className: "repository-branches-area area--vertical" },
            React.createElement(RepoHeaderContributionPortal, { position: "nav", element: React.createElement(RepoHeaderBreadcrumbNavItem, { key: "branches" }, "Branches"), repoHeaderContributionsLifecycleProps: this.props.repoHeaderContributionsLifecycleProps }),
            React.createElement("div", { className: "area--vertical__navbar" },
                React.createElement(RepositoryBranchesNavbar, { className: "area--vertical__navbar-inner", repo: this.props.repo.name })),
            React.createElement("div", { className: "area--vertical__content" },
                React.createElement("div", { className: "area--vertical__content-inner" },
                    React.createElement(Switch, null,
                        React.createElement(Route, { path: `${this.props.match.url}`, 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(RepositoryBranchesOverviewPage, Object.assign({}, routeComponentProps, transferProps))) }),
                        React.createElement(Route, { path: `${this.props.match.url}/all`, 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(RepositoryBranchesAllPage, Object.assign({}, routeComponentProps, transferProps))) }),
                        React.createElement(Route, { key: "hardcoded-key", component: NotFoundPage }))))));
    }
}
//# sourceMappingURL=RepositoryBranchesArea.js.map