From 15035c5a4ad1e30b6e9f2f5479c5d033f0395ddb Mon Sep 17 00:00:00 2001 From: jasquat Date: Mon, 31 Oct 2022 16:03:14 -0400 Subject: [PATCH] some more changes... navigation bar is broken due to header container w/ burnettk --- spiffworkflow-frontend/src/App.tsx | 20 +- .../src/components/NavigationBar.tsx | 204 +++++++++++++----- spiffworkflow-frontend/src/index.css | 4 +- .../src/routes/ProcessModelEditDiagram.tsx | 8 +- 4 files changed, 161 insertions(+), 75 deletions(-) diff --git a/spiffworkflow-frontend/src/App.tsx b/spiffworkflow-frontend/src/App.tsx index 0684465e1..4a078c21e 100644 --- a/spiffworkflow-frontend/src/App.tsx +++ b/spiffworkflow-frontend/src/App.tsx @@ -1,6 +1,6 @@ import { useMemo, useState } from 'react'; // @ts-ignore -// import { Container } from '@carbon/react'; +import { Content } from '@carbon/react'; import { BrowserRouter, Routes, Route } from 'react-router-dom'; import ErrorContext from './contexts/ErrorContext'; @@ -46,14 +46,14 @@ export default function App() { ); } + // return ( - -
- {errorTag} - - - + + + + {errorTag} +
} /> @@ -69,9 +69,9 @@ export default function App() { />
-
-
-
+ + +
); } diff --git a/spiffworkflow-frontend/src/components/NavigationBar.tsx b/spiffworkflow-frontend/src/components/NavigationBar.tsx index 2f70ff0c8..606a21184 100644 --- a/spiffworkflow-frontend/src/components/NavigationBar.tsx +++ b/spiffworkflow-frontend/src/components/NavigationBar.tsx @@ -1,72 +1,158 @@ -// @ts-ignore -import { Button } from '@carbon/react'; -import { Navbar, Nav, Container } from 'react-bootstrap'; +import { + Header, + Theme, + HeaderName, + HeaderContainer, + HeaderNavigation, + HeaderMenuItem, + HeaderMenu, + // @ts-ignore +} from '@carbon/react'; +import { useEffect, useState } from 'react'; +import { Navbar, Nav } from 'react-bootstrap'; +import { useLocation } from 'react-router-dom'; // @ts-expect-error TS(2307) FIXME: Cannot find module '../logo.svg' or its correspond... Remove this comment to see the full error message import logo from '../logo.svg'; import UserService from '../services/UserService'; // for ref: https://react-bootstrap.github.io/components/navbar/ export default function NavigationBar() { - const navElements = null; + // const navElements = null; + // + // const handleLogout = () => { + // UserService.doLogout(); + // }; + // + // const handleLogin = () => { + // UserService.doLogin(); + // }; + // + // const loginLink = () => { + // if (!UserService.isLoggedIn()) { + // return ( + // + // + // + // + // + // ); + // } + // return null; + // }; + // + // const logoutLink = () => { + // if (UserService.isLoggedIn()) { + // return ( + // + // + // Signed in as: {UserService.getUsername()} + // + // + // + // + // + // ); + // } + // return null; + // }; - const handleLogout = () => { - UserService.doLogout(); - }; + const location = useLocation(); + const [activeKey, setActiveKey] = useState(''); - const handleLogin = () => { - UserService.doLogin(); - }; - - const loginLink = () => { - if (!UserService.isLoggedIn()) { - return ( - - - - - - ); + useEffect(() => { + let newActiveKey = '/admin/process-groups'; + if (location.pathname.match(/^\/admin\/messages\b/)) { + newActiveKey = '/admin/messages'; + } else if (location.pathname.match(/^\/admin\/process-instances\b/)) { + newActiveKey = '/admin/process-instances'; + } else if (location.pathname.match(/^\/admin\/secrets\b/)) { + newActiveKey = '/admin/secrets'; + } else if (location.pathname.match(/^\/admin\/authentications\b/)) { + newActiveKey = '/admin/authentications'; + } else if (location.pathname === '/') { + newActiveKey = '/'; + } else if (location.pathname.match(/^\/tasks\b/)) { + newActiveKey = '/'; } - return null; + setActiveKey(newActiveKey); + }, [location]); + + const isActivePage = (menuItemPath: string) => { + return activeKey === menuItemPath; }; - const logoutLink = () => { - if (UserService.isLoggedIn()) { - return ( - - - Signed in as: {UserService.getUsername()} - - - - - - ); - } - return null; - }; + // return ( + // + // + // + // + // logo + // + // + // + // + // + // {loginLink()} + // {logoutLink()} + // + // + // + // ); - return ( - - - - logo - - - - - - {loginLink()} - {logoutLink()} - - - ); + // + //
+ // + // [Platform] + // + // + // Link 1 + // Link 2 + // Link 3 + // + // Sub-link 1 + // Sub-link 2 + // Sub-link 3 + // + // + //
+ //
+ if (activeKey) { + return ( + + +
+ + logo + + + + Home + + + Processes + + + Process Instances + + +
+
+
+ ); + } + return null; } diff --git a/spiffworkflow-frontend/src/index.css b/spiffworkflow-frontend/src/index.css index fd156c236..32a712d5a 100644 --- a/spiffworkflow-frontend/src/index.css +++ b/spiffworkflow-frontend/src/index.css @@ -20,8 +20,8 @@ span.bjs-crumb { } .app-logo { - height: 35%; - width: 35%; + height: 90%; + width: 90%; margin-top: 1em; margin-bottom: 1em; } diff --git a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx index aa1eafc69..9ca0754ab 100644 --- a/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx +++ b/spiffworkflow-frontend/src/routes/ProcessModelEditDiagram.tsx @@ -1,8 +1,8 @@ import { useContext, useEffect, useRef, useState } from 'react'; import { useNavigate, useParams, useSearchParams } from 'react-router-dom'; // @ts-ignore -import { Button, Modal, Stack } from '@carbon/react'; -import Container from 'react-bootstrap/Container'; +import { Button, Modal, Stack, Content } from '@carbon/react'; +// import Container from 'react-bootstrap/Container'; import Row from 'react-bootstrap/Row'; import Col from 'react-bootstrap/Col'; @@ -463,7 +463,7 @@ export default function ProcessModelEditDiagram() { } return (
- +