/* * MIT License * * Copyright (c) 2020-present Cloudogu GmbH and Contributors * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ import React from "react"; import { Redirect, Route, Switch, withRouter } from "react-router-dom"; import { Links, Me } from "@scm-manager/ui-types"; import Overview from "../repos/containers/Overview"; import Users from "../users/containers/Users"; import Login from "../containers/Login"; import Logout from "../containers/Logout"; import { ErrorBoundary, ProtectedRoute } from "@scm-manager/ui-components"; import { binder, ExtensionPoint } from "@scm-manager/ui-extensions"; import CreateUser from "../users/containers/CreateUser"; import SingleUser from "../users/containers/SingleUser"; import RepositoryRoot from "../repos/containers/RepositoryRoot"; import Groups from "../groups/containers/Groups"; import SingleGroup from "../groups/containers/SingleGroup"; import CreateGroup from "../groups/containers/CreateGroup"; import Admin from "../admin/containers/Admin"; import Profile from "./Profile"; import NamespaceRoot from "../repos/namespaces/containers/NamespaceRoot"; import ImportLog from "../repos/importlog/ImportLog"; import CreateRepositoryRoot from "../repos/containers/CreateRepositoryRoot"; import styled from "styled-components"; type Props = { me: Me; authenticated?: boolean; links: Links; }; type StyledMainProps = { isSmallHeader: boolean; }; const StyledMain = styled.div.attrs((props) => ({}))` min-height: calc(100vh - ${(props) => (props.isSmallHeader ? 250 : 210)}px); `; class Main extends React.Component { render() { const { authenticated, me, links } = this.props; const redirectUrlFactory = binder.getExtension("main.redirect", this.props); let url = "/"; if (authenticated) { url = "/repos/"; } if (redirectUrlFactory) { url = redirectUrlFactory(this.props); } if (!me) { url = "/login"; } return ( ); } } export default withRouter(Main);