github.com/freiheit-com/kuberpult@v1.24.2-0.20240328135542-315d5630abe6/services/frontend-service/src/ui/App/PageRoutes.tsx (about)

     1  /*This file is part of kuberpult.
     2  
     3  Kuberpult is free software: you can redistribute it and/or modify
     4  it under the terms of the Expat(MIT) License as published by
     5  the Free Software Foundation.
     6  
     7  Kuberpult is distributed in the hope that it will be useful,
     8  but WITHOUT ANY WARRANTY; without even the implied warranty of
     9  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    10  MIT License for more details.
    11  
    12  You should have received a copy of the MIT License
    13  along with kuberpult. If not, see <https://directory.fsf.org/wiki/License:Expat>.
    14  
    15  Copyright 2023 freiheit.com*/
    16  import { Home } from '../Pages/Home/Home';
    17  import { EnvironmentsPage } from '../Pages/Environments/EnvironmentsPage';
    18  import { ReleasesPage } from '../Pages/Releases/ReleasesPage';
    19  import { LocksPage } from '../Pages/Locks/LocksPage';
    20  import { Routes as ReactRoutes, Route, Navigate } from 'react-router-dom';
    21  import { ProductVersionPage } from '../Pages/ProductVersion/ProductVersionPage';
    22  import { CommitInfoPage } from '../Pages/CommitInfo/CommitInfoPage';
    23  
    24  const routes = [
    25      {
    26          path: `/ui/environments/*`,
    27          element: <EnvironmentsPage />,
    28      },
    29      {
    30          path: `/ui/locks/*`,
    31          element: <LocksPage />,
    32      },
    33      {
    34          path: `/ui/home/*`,
    35          element: <Home />,
    36      },
    37      {
    38          path: `/ui/home/releases/:appName`,
    39          element: <ReleasesPage />,
    40      },
    41      {
    42          path: `/ui/environments/productVersion/*`,
    43          element: <ProductVersionPage />,
    44      },
    45      {
    46          path: `/ui/commits/:commit`,
    47          element: <CommitInfoPage />,
    48      },
    49      {
    50          path: `/ui/commits/`,
    51          element: <CommitInfoPage />,
    52      },
    53      {
    54          path: `/*`,
    55          element: <Navigate replace to="/ui/home" />,
    56      },
    57  ];
    58  
    59  export const PageRoutes: React.FC = () => (
    60      <ReactRoutes>
    61          {routes.map((route) => (
    62              <Route key={route.path} path={route.path} element={route.element} />
    63          ))}
    64      </ReactRoutes>
    65  );