import { upperFirst } from 'lodash';
import AlertCircleIcon from 'mdi-react/AlertCircleIcon';
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 { RepositoryReleasesTagsPage } from './RepositoryReleasesTagsPage';
const NotFoundPage = () => (React.createElement(HeroPage, { icon: MapSearchIcon, title: "404: Not Found", subtitle: "Sorry, the requested repository tags page was not found." }));
/**
 * Renders pages related to repository branches.
 */
export class RepositoryReleasesArea extends React.Component {
    constructor() {
        super(...arguments);
        this.state = {};
        this.subscriptions = new Subscription();
    }
    componentWillUnmount() {
        this.subscriptions.unsubscribe();
    }
    render() {
        if (this.state.error) {
            return React.createElement(HeroPage, { icon: AlertCircleIcon, title: "Error", subtitle: upperFirst(this.state.error) });
        }
        const transferProps = {
            repo: this.props.repo,
        };
        return (React.createElement("div", { className: "repository-graph-area area--vertical" },
            React.createElement(RepoHeaderContributionPortal, { position: "nav", element: React.createElement(RepoHeaderBreadcrumbNavItem, { key: "tags" }, "Tags"), repoHeaderContributionsLifecycleProps: this.props.repoHeaderContributionsLifecycleProps }),
            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.repoMatchURL}/-/tags`, 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(RepositoryReleasesTagsPage, Object.assign({}, routeComponentProps, transferProps))) }),
                        React.createElement(Route, { key: "hardcoded-key", component: NotFoundPage }))))));
    }
}
//# sourceMappingURL=RepositoryReleasesArea.js.map