Skip to content

Commit

Permalink
fix(frontend): Unify frontend
Browse files Browse the repository at this point in the history
  • Loading branch information
fabiodmota committed May 7, 2024
1 parent 68d8d48 commit 03f30cc
Show file tree
Hide file tree
Showing 10 changed files with 393 additions and 28 deletions.
21 changes: 15 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,28 @@ All notable changes to this project (both backend and frontend) will be document

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).


## [1.4.0] - [unreleased]
## [2.0.0] - [unreleased]

### Frontend

#### Fix
- Update Report and Table components from catena-x lib
- Configure css with new update components

#### Added
- Create `NegotiationPage` component to provide a user interface for triggering negotiations, displaying negotiation statuses, and managing catalog items.
- Implement `fetchCatalogItems` and `triggerNegotiation` service functions to interact with backend endpoints for retrieving catalog items and initiating negotiations.
- Introduce dynamic status icons in the negotiation table to reflect the real-time status of each negotiation, enhancing user feedback and interaction.
- Added SnackBar for Report Table and Ratings for error and success messages


### Changed
- Update `UserInfo` component to conditionally display the negotiation page link in the user menu based on user roles, enhancing role-based access control.
- Modify the negotiation initiation process to reset item statuses to "Pending" before sending requests, providing clearer feedback on ongoing negotiations.
- Refine error handling in the negotiation process to alert users of failures and log errors for debugging purposes.

### Fixed
- Resolve visual feedback issue where status icons would not reset to default state after re-initiating negotiations.
- Update Report and Table components from catena-x lib
- Configure css with new update components


## [1.3.2] - [2024-04-17]

### Backend
Expand Down
2 changes: 1 addition & 1 deletion backend/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</parent>
<groupId>org.eclipse.tractusx</groupId>
<artifactId>value-added-service</artifactId>
<version>1.4.0</version>
<version>2.0.0</version>
<name>vas-country-risk-backend</name>
<description>Project to Validate Country Risks Score</description>
<properties>
Expand Down
8 changes: 4 additions & 4 deletions frontend/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions frontend/package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "dashboard-app",
"version": "1.4.0",
"version": "2.0.0",
"license": "Apache-2.0",
"private": true,
"dependencies": {
"react-dropzone": "^14.2.3",
"@catena-x/portal-shared-components": "2.1.40",
"@catena-x/portal-shared-components": "^2.1.40",
"@emotion/react": "^11.11.1",
"@emotion/styled": "^11.11.0",
"@mui/icons-material": "5.10.6",
Expand Down Expand Up @@ -70,7 +70,7 @@
"@babel/preset-react": "^7.23.3",
"babel-jest": "^29.7.0",
"follow-redirects": ">=1.15.4",
"postcss": "^8.4.38"
"postcss": "^8.4.31"
},
"overrides": {
"react-simple-maps": {
Expand All @@ -81,7 +81,7 @@
"@svgr/webpack": "7.0.0"
},
"resolve-url-loader": {
"postcss": "^8.4.38"
"postcss": "^8.4.31"
},
"eslint": "8.32.0",
"keycloak-js": "20.0.5",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ import AboutPage from "./components/dashboard/AboutCard/AboutPage";
import { FooterPortal } from "./components/dashboard/Footer/FooterPortal";
import ErrorPageCR from "./components/dashboard/ErrorPage/ErrorPageCR";
import SignOut from "./components/dashboard/SignOut";
import NegotiationPage from "./components/dashboard/NegotiationPage/NegotiationPage";

function App() {
return (
Expand All @@ -53,6 +54,10 @@ function App() {
<Route path="/about" element={<AboutPage />} />
<Route path="/error" element={<ErrorPageCR />} />
<Route path="/logout" element={<SignOut />} />
<Route
path="/negotiation"
element={<NegotiationPage />}
/>
</Routes>
<FooterPortal />
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,25 +18,25 @@
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/

import { useRef, useState } from "react";
import { useState, useRef, useContext } from "react";
import {
UserAvatar,
UserMenu,
UserNav,
LanguageSwitch,
} from "@catena-x/portal-shared-components";
import LogoutIcon from "@mui/icons-material/Logout";
import UserService from "../../../services/UserService";
import SignOut from "../../SignOut/index";
import "./UserInfo.scss";
import {
getLogoutLink,
getAboutLink,
getNegotiationLink,
} from "../../../services/EnvironmentService";
import { CompanyUserContext } from "../../../../contexts/companyuser";

export const UserInfo = () => {
const [menuOpen, setMenuOpen] = useState(false);
const wrapperRef = useRef(null);
const { companyUser } = useContext(CompanyUserContext);

const openCloseMenu = () => setMenuOpen((prevVal) => !prevVal);

Expand All @@ -48,6 +48,28 @@ export const UserInfo = () => {

const logoutHref = getLogoutLink();

// Dynamically construct menu items based on user roles
let menuItems = [
{
href: logoutHref,
title: "Logout",
},
];

// Add negotiation link for users with Negotiator or Admin roles
if (
companyUser.roles.includes("Negotiator") ||
companyUser.roles.includes("Admin")
) {
menuItems = [
{
href: getNegotiationLink(),
title: "Negotiation",
},
...menuItems,
];
}

return (
<div className="UserInfo">
<div ref={wrapperRef}>
Expand All @@ -60,16 +82,10 @@ export const UserInfo = () => {
userRole={UserService.getCompany()}
onClickAway={onClickAway}
>
<UserNav
divider
items={[
{
href: logoutHref,
title: "Logout",
},
]}
/>
<UserNav divider items={menuItems} />
</UserMenu>
</div>
);
};

export default UserInfo;
Loading

0 comments on commit 03f30cc

Please sign in to comment.