Skip to content

Commit

Permalink
Merge pull request #460 from CBIIT/CRDCDH-1584
Browse files Browse the repository at this point in the history
CRDCDH-1584 Navbar UX QA
  • Loading branch information
Alejandro-Vega authored Sep 9, 2024
2 parents 6eb3db3 + 62a503e commit add19a3
Show file tree
Hide file tree
Showing 42 changed files with 518 additions and 513 deletions.
Binary file removed public/css/fonts/Inter-Bold.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-Bold.woff2
Binary file not shown.
Binary file removed public/css/fonts/Inter-ExtraBold.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-ExtraBold.woff2
Binary file not shown.
Binary file removed public/css/fonts/Inter-Light.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-Light.woff2
Binary file not shown.
Binary file removed public/css/fonts/Inter-Medium.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-Medium.woff2
Binary file not shown.
Binary file removed public/css/fonts/Inter-Regular.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-Regular.woff2
Binary file not shown.
Binary file removed public/css/fonts/Inter-SemiBold.woff
Binary file not shown.
Binary file removed public/css/fonts/Inter-SemiBold.woff2
Binary file not shown.
Binary file removed public/css/fonts/OpenSans-VariableFont.ttf
Binary file not shown.
Binary file removed public/css/fonts/Poppins-Bold.ttf
Binary file not shown.
Binary file removed public/css/fonts/Poppins-Light.ttf
Binary file not shown.
Binary file removed public/css/fonts/Poppins-Medium.ttf
Binary file not shown.
Binary file removed public/css/fonts/Poppins-Regular.ttf
Binary file not shown.
Binary file removed public/css/fonts/Poppins-SemiBold.ttf
Binary file not shown.
Binary file removed public/css/fonts/ReemKufi-VariableFont_wght.ttf
Binary file not shown.
81 changes: 0 additions & 81 deletions public/css/index.css

This file was deleted.

File renamed without changes
Binary file removed src/assets/dataSubmissions/dashboard_banner.png
Binary file not shown.
36 changes: 0 additions & 36 deletions src/assets/history/submissionRequest/index.tsx

This file was deleted.

65 changes: 65 additions & 0 deletions src/components/DataSubmissions/CopyAdornment.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
import { render } from "@testing-library/react";
import { axe } from "jest-axe";
import userEvent from "@testing-library/user-event";
import CopyAdornment from "./CopyAdornment";

const mockWriteText = jest.fn();
Object.assign(navigator, {
clipboard: {
writeText: mockWriteText,
},
});

describe("Accessibility", () => {
it("should not have any violations", async () => {
const { container } = render(<CopyAdornment _id="abc-123-this-is-a-id" />);

expect(await axe(container)).toHaveNoViolations();
});

it("should not have any violations (no _ID)", async () => {
const { container } = render(<CopyAdornment _id={null} />);

expect(await axe(container)).toHaveNoViolations();
});
});

describe("Implementation Requirements", () => {
beforeEach(() => {
jest.clearAllMocks();
});

it("should render the Submission ID and copy button", () => {
const { getByTestId } = render(<CopyAdornment _id="abc-123-this-is-a-id" />);

expect(getByTestId("data-submission-id-value")).toBeInTheDocument();
expect(getByTestId("data-submission-id-value")).toHaveTextContent("abc-123-this-is-a-id");

expect(getByTestId("data-submission-copy-id-button")).toBeInTheDocument();
expect(getByTestId("data-submission-copy-id-button")).toBeEnabled();
});

it("should copy the ID to the clipboard when clicking the copy button", () => {
const { getByTestId } = render(<CopyAdornment _id="abc-123-this-is-a-id" />);

userEvent.click(getByTestId("data-submission-copy-id-button"));

expect(mockWriteText).toHaveBeenCalledWith("abc-123-this-is-a-id");
});

it("should not copy the ID to the clipboard when no _ID is provided", () => {
const { getByTestId } = render(<CopyAdornment _id={null} />);

userEvent.click(getByTestId("data-submission-copy-id-button"), null, {
skipPointerEventsCheck: true,
});

expect(mockWriteText).not.toHaveBeenCalled();
});

it("should disable the copy button when no _ID is provided", () => {
const { getByTestId } = render(<CopyAdornment _id={null} />);

expect(getByTestId("data-submission-copy-id-button")).toBeDisabled();
});
});
90 changes: 90 additions & 0 deletions src/components/DataSubmissions/CopyAdornment.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { FC, memo } from "react";
import { IconButton, Stack, styled, Typography } from "@mui/material";
import { isEqual } from "lodash";
import { ReactComponent as CopyIconSvg } from "../../assets/icons/copy_icon_2.svg";

const StyledCopyWrapper = styled(Stack)({
height: "42px",
width: "fit-content",
minWidth: "508px",
padding: "11px 20px",
borderRadius: "8px 8px 0px 0px",
border: "1.25px solid #6DADDB",
borderBottom: 0,
background: "#fff",
color: "#125868",
});

const StyledCopyLabel = styled(Typography)({
fontFamily: "'Nunito', 'Rubik', sans-serif",
fontSize: "12px",
fontStyle: "normal",
fontWeight: 800,
lineHeight: "19.6px",
letterSpacing: "0.24px",
textTransform: "uppercase",
userSelect: "none",
});

const StyledCopyValue = styled(Typography)({
fontFamily: "'Nunito', 'Rubik', sans-serif",
fontSize: "16px",
fontStyle: "normal",
fontWeight: 400,
lineHeight: "19.6px",
letterSpacing: "0.32px",
userSelect: "all",
});

const StyledCopyIDButton = styled(IconButton)({
padding: 0,
"&.MuiIconButton-root.Mui-disabled": {
color: "#B0B0B0",
},
marginLeft: "auto !important",
});

type Props = {
/**
* The Data Submission ID
*
* @note This is passed as a prop instead of using the SubmissionContext to prevent a delay in displaying the ID
*/
_id: string;
};

/**
* Provides Data Submission ID display and copy functionality
*
* @returns {React.FC}
*/
const CopyAdornment: FC<Props> = ({ _id }) => {
const handleCopyID = () => {
if (!_id) {
return;
}

navigator.clipboard.writeText(_id);
};

return (
<StyledCopyWrapper direction="row" spacing={1.625} alignItems="center">
<StyledCopyLabel data-testid="data-submission-id-label" variant="body1">
SUBMISSION ID:
</StyledCopyLabel>
<StyledCopyValue data-testid="data-submission-id-value" variant="body1">
{_id}
</StyledCopyValue>
<StyledCopyIDButton
data-testid="data-submission-copy-id-button"
aria-label="Copy ID"
onClick={handleCopyID}
disabled={!_id}
>
<CopyIconSvg />
</StyledCopyIDButton>
</StyledCopyWrapper>
);
};

export default memo(CopyAdornment, isEqual);
2 changes: 1 addition & 1 deletion src/components/DataSubmissions/DataSubmissionIconMap.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Rejected from "../../assets/history/dataSubmission/rejected.svg";
import Completed from "../../assets/history/dataSubmission/completed.svg";
import Archived from "../../assets/history/dataSubmission/archived.svg";
import Canceled from "../../assets/history/dataSubmission/canceled.svg";
import { IconType } from "../Shared/HistoryDialog";
import { IconType } from "../HistoryDialog";

/**
* Map of ApplicationStatus to Icon for History Modal
Expand Down
21 changes: 11 additions & 10 deletions src/components/DataSubmissions/DataSubmissionSummary.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,16 @@ describe("DataSubmissionSummary History Dialog Tests", () => {

fireEvent.click(getByText("Full History"));

const elements = getAllByTestId("history-item");
expect(elements[0]).toHaveTextContent(/ARCHIVED/i);
expect(elements[0]).toHaveTextContent("1/9/2023");
expect(elements[1]).toHaveTextContent(/COMPLETED/i);
expect(elements[1]).toHaveTextContent("1/8/2023");
expect(elements[2]).toHaveTextContent(/RELEASED/i);
expect(elements[2]).toHaveTextContent("1/7/2023");
expect(elements[8]).toHaveTextContent(/NEW/i);
expect(elements[8]).toHaveTextContent("1/1/2023");
const dates = getAllByTestId(/history-item-\d-date/i);
const statuses = getAllByTestId(/history-item-\d-status/i);
expect(statuses[0]).toHaveTextContent(/ARCHIVED/i);
expect(dates[0]).toHaveTextContent("1/9/2023");
expect(statuses[1]).toHaveTextContent(/COMPLETED/i);
expect(dates[1]).toHaveTextContent("1/8/2023");
expect(statuses[2]).toHaveTextContent(/RELEASED/i);
expect(dates[2]).toHaveTextContent("1/7/2023");
expect(statuses[8]).toHaveTextContent(/NEW/i);
expect(dates[8]).toHaveTextContent("1/1/2023");
});

it("closes the History dialog with the close button", async () => {
Expand Down Expand Up @@ -238,7 +239,7 @@ describe("DataSubmissionSummary History Dialog Tests", () => {
fireEvent.click(getByText("Full History"));

await waitFor(() => {
const items = getAllByTestId("history-item-date");
const items = getAllByTestId(/history-item-\d-date/);
expect(new Date(items[0].textContent).getTime()).toBeGreaterThan(
new Date(items[1].textContent).getTime()
);
Expand Down
2 changes: 1 addition & 1 deletion src/components/DataSubmissions/DataSubmissionSummary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { isEqual } from "lodash";
import SubmissionHeaderProperty, { StyledValue } from "./SubmissionHeaderProperty";
import Tooltip from "./Tooltip";
import { ReactComponent as EmailIconSvg } from "../../assets/icons/email_icon.svg";
import HistoryDialog from "../Shared/HistoryDialog";
import HistoryDialog from "../HistoryDialog";
import DataSubmissionIconMap from "./DataSubmissionIconMap";
import ReviewCommentsDialog from "../Shared/ReviewCommentsDialog";
import { SortHistory } from "../../utils";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import React from "react";
import { styled } from "@mui/material";
import Logo from "./components/LogoDesktop";
import NavBar from "./components/NavbarDesktop";
import Logo from "./LogoDesktop";
import NavBar from "./NavbarDesktop";

const HeaderBanner = styled("div")({
width: "100%",
Expand All @@ -15,7 +14,7 @@ const HeaderContainer = styled("div")({
});

const Header = () => (
<HeaderBanner>
<HeaderBanner data-testid="navigation-header-desktop">
<HeaderContainer>
<Logo />
</HeaderContainer>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
import React, { HTMLProps, useEffect, useState } from "react";
import { NavLink, Link, useNavigate, useLocation } from "react-router-dom";
import { styled } from "@mui/material";
import Logo from "./components/LogoMobile";
import menuClearIcon from "../../assets/header/Menu_Cancel_Icon.svg";
import rightArrowIcon from "../../assets/header/Right_Arrow.svg";
import leftArrowIcon from "../../assets/header/Left_Arrow.svg";
import { navMobileList, navbarSublists } from "../../config/globalHeaderData";
import { GenerateApiTokenRoles } from "../../config/AuthRoles";
import { useAuthContext } from "../Contexts/AuthContext";
import GenericAlert from "../GenericAlert";
import APITokenDialog from "../../content/users/APITokenDialog";
import UploaderToolDialog from "../UploaderToolDialog";
import Logo from "./LogoMobile";
import menuClearIcon from "../../../assets/header/Menu_Cancel_Icon.svg";
import rightArrowIcon from "../../../assets/header/Right_Arrow.svg";
import leftArrowIcon from "../../../assets/header/Left_Arrow.svg";
import { navMobileList, navbarSublists } from "../../../config/globalHeaderData";
import { GenerateApiTokenRoles } from "../../../config/AuthRoles";
import { useAuthContext } from "../../Contexts/AuthContext";
import GenericAlert from "../../GenericAlert";
import APITokenDialog from "../../../content/users/APITokenDialog";
import UploaderToolDialog from "../../UploaderToolDialog";

const HeaderBanner = styled("div")({
width: "100%",
Expand Down Expand Up @@ -212,7 +212,7 @@ const Header = () => {
<GenericAlert open={showLogoutAlert}>
<span>You have been logged out.</span>
</GenericAlert>
<HeaderBanner>
<HeaderBanner data-testid="navigation-header-mobile">
<HeaderContainer>
<Logo />
<div className="headerLowerContainer">
Expand Down
Loading

0 comments on commit add19a3

Please sign in to comment.