Skip to content

Commit

Permalink
add test subpage and put it on header
Browse files Browse the repository at this point in the history
  • Loading branch information
wilczeqqqq committed Apr 6, 2023
1 parent c918f91 commit 60cfbe2
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 1 deletion.
17 changes: 17 additions & 0 deletions src/main/webapp/app/modules/test/test-website.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { Row } from 'reactstrap';
import React from 'react';

export const TestWebsite = () => {
return (
<>
<Row>
<h2>Here you can add your mockup implementation. Good luck :)</h2>
</Row>
<Row>
<h3>Remember to change "TestWebsite" module and header component to the proper name</h3>
</Row>
</>
);
};

export default TestWebsite;
9 changes: 9 additions & 0 deletions src/main/webapp/app/routes.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import PrivateRoute from 'app/shared/auth/private-route';
import ErrorBoundaryRoutes from 'app/shared/error/error-boundary-routes';
import PageNotFound from 'app/shared/error/page-not-found';
import { AUTHORITIES } from 'app/config/constants';
import TestWebsite from 'app/modules/test/test-website';

const loading = <div>loading ...</div>;

Expand All @@ -34,6 +35,14 @@ const AppRoutes = () => {
<Route index element={<Home />} />
<Route path="login" element={<Login />} />
<Route path="logout" element={<Logout />} />
<Route
path="test-website"
element={
<PrivateRoute hasAnyAuthorities={[AUTHORITIES.ADMIN, AUTHORITIES.USER]}>
<TestWebsite />
</PrivateRoute>
}
/>
<Route path="account">
<Route
path="*"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,11 @@ export const Home = () => (
</NavLink>
</NavItem>
);

export const TestWebsite = () => (
<NavItem>
<NavLink tag={Link} to="/test-website" className="d-flex align-items-center">
<span>Test Website</span>
</NavLink>
</NavItem>
);
3 changes: 2 additions & 1 deletion src/main/webapp/app/shared/layout/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import React, { useState } from 'react';
import { Navbar, Nav, NavbarToggler, Collapse } from 'reactstrap';
import LoadingBar from 'react-redux-loading-bar';

import { Home, Brand } from './header-components';
import { Home, Brand, TestWebsite } from './header-components';
import { AdminMenu, EntitiesMenu, AccountMenu } from '../menus';

export interface IHeaderProps {
Expand Down Expand Up @@ -40,6 +40,7 @@ const Header = (props: IHeaderProps) => {
<Collapse isOpen={menuOpen} navbar>
<Nav id="header-tabs" className="ms-auto" navbar>
<Home />
{props.isAuthenticated && <TestWebsite />}
{props.isAuthenticated && <EntitiesMenu />}
{props.isAuthenticated && props.isAdmin && (
<AdminMenu showOpenAPI={props.isOpenAPIEnabled} showDatabase={!props.isInProduction} />
Expand Down

0 comments on commit 60cfbe2

Please sign in to comment.