Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Zeke download csv and print pdf #1508

Merged
merged 7 commits into from
Nov 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43,583 changes: 20,229 additions & 23,354 deletions client/package-lock.json

Large diffs are not rendered by default.

11 changes: 10 additions & 1 deletion client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"precommit": "lint-staged",
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"test": "react-scripts test --env=jsdom",
"test:ci": "react-scripts test --watchAll=false",
"eject": "react-scripts eject",
"lint": "eslint -c .eslintrc.json --ignore-path .eslintignore \"**/*.{js,jsx}\"",
Expand Down Expand Up @@ -42,6 +42,7 @@
"react": "^18.1.0",
"react-aria-modal": "^5.0.0",
"react-beautiful-dnd": "^13.1.1",
"react-csv": "^2.2.2",
"react-dom": "^18.1.0",
"react-gtm-module": "^2.0.11",
"react-input-mask": "^2.0.4",
Expand Down Expand Up @@ -79,5 +80,13 @@
"lint",
"test"
]
},
"jest": {
"moduleNameMapper": {
"axios": "axios/dist/node/axios.cjs"
}
},
"volta": {
"node": "18.18.2"
}
}
9 changes: 4 additions & 5 deletions client/src/components/NavBar.test.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
import React from "react";
import { createRoot } from "react-dom/client";
import { render, screen } from "@testing-library/react";
import NavBar from "./NavBar";
import { BrowserRouter as Router } from "react-router-dom";
import "@testing-library/jest-dom";

it("renders without crashing", () => {
const container = document.getElementById("root");
const root = createRoot(container);
root.render(
render(
<Router>
<NavBar setNavbarOpen={jest.fn} account={{ email: "some-email" }} />
</Router>
);
expect(root).toBeDefined();
expect(screen.getByText("About")).toBeInTheDocument();
});
2 changes: 2 additions & 0 deletions client/src/components/PdfPrint/PdfPrint.js
Original file line number Diff line number Diff line change
Expand Up @@ -291,3 +291,5 @@ PdfPrint.propTypes = {
loginId: PropTypes.number,
dateModified: PropTypes.string || null
};

export default PdfPrint;
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import React from "react";
import { render, screen } from "@testing-library/react";
import "@testing-library/jest-dom/extend-expect";
import "@testing-library/jest-dom";
import Level0Page from "./Level0Page";

describe("Level0Page", () => {
Expand Down
43 changes: 25 additions & 18 deletions client/src/components/Projects/ProjectContextMenu.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
import React from "react";
import { useState } from "react";
import PropTypes from "prop-types";

import { createUseStyles } from "react-jss";
import {
faPrint,
faEye,
faEyeSlash,
faCamera,
faTrash,
faClone,
faFileCsv
} from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import CopyIcon from "../../images/copy.png";
import DeleteIcon from "../../images/trash.png";
import { createUseStyles } from "react-jss";

const useStyles = createUseStyles({
list: {
Expand All @@ -21,20 +22,25 @@ const useStyles = createUseStyles({
margin: 0,
padding: 0
},
listItem: { display: "flex", flexDirection: "row", padding: "0.5rem" },
listItem: {
display: "flex",
flexDirection: "row",
padding: "0.5rem",
cursor: "pointer"
},
listItemIcon: { marginRight: "0.3rem" }
});

const ProjectContextMenu = ({
project,
handleCopyModalOpen,
handleDeleteModalOpen,
handleDownloadCSV
handleDownloadCsv,
handlePrintPdf
}) => {
const [projectVisibility, SetProjectVisibility] = useState(
project.dateHidden
);

const toggleProjectVisibility = () => {
SetProjectVisibility(!projectVisibility);
};
Expand All @@ -54,7 +60,7 @@ const ProjectContextMenu = ({
</li>
)}

<li className={classes.listItem}>
<li onClick={() => handlePrintPdf(project)} className={classes.listItem}>
<FontAwesomeIcon
icon={faPrint}
className={classes.listItemIcon}
Expand All @@ -63,7 +69,7 @@ const ProjectContextMenu = ({
Print
</li>
<li
onClick={() => handleDownloadCSV(project)}
onClick={() => handleDownloadCsv(project)}
className={classes.listItem}
>
<FontAwesomeIcon
Expand All @@ -77,10 +83,10 @@ const ProjectContextMenu = ({
onClick={() => handleCopyModalOpen(project)}
className={classes.listItem}
>
<img
src={CopyIcon}
alt={`Duplicate Project #${project.id} Icon`}
<FontAwesomeIcon
icon={faClone}
className={classes.listItemIcon}
alt={`Duplicate Project #${project.id} Icon`}
/>
Duplicate
</li>
Expand Down Expand Up @@ -115,19 +121,19 @@ const ProjectContextMenu = ({
>
{project.dateTrashed ? (
<>
<img
src={DeleteIcon}
alt={`Remove Project #${project.id} from Trash Icon`}
<FontAwesomeIcon
icon={faTrash}
className={classes.listItemIcon}
alt={`Remove Project #${project.id} from Trash Icon`}
/>
Remove from Trash
</>
) : (
<>
<img
src={DeleteIcon}
alt={`Move Project #${project.id} to Trash Icon`}
<FontAwesomeIcon
icon={faTrash}
className={classes.listItemIcon}
alt={`Move Project #${project.id} to Trash Icon`}
/>
Move to Trash
</>
Expand All @@ -141,7 +147,8 @@ ProjectContextMenu.propTypes = {
project: PropTypes.object,
handleCopyModalOpen: PropTypes.func,
handleDeleteModalOpen: PropTypes.func,
handleDownloadCSV: PropTypes.func
handleDownloadCsv: PropTypes.func,
handlePrintPdf: PropTypes.func
};

export default ProjectContextMenu;
Loading