Skip to content

Commit

Permalink
Added onClick function to ProjectContextMenu.js component to toggle p… (
Browse files Browse the repository at this point in the history
#1486)

* Added onClick function to ProjectContextMenu.js component to toggle project.dateHidden value.

* Undo undesired changes to package-lock

---------

Co-authored-by: John Darragh <[email protected]>
  • Loading branch information
joelfuelling and entrotech authored Oct 26, 2023
1 parent ef1e700 commit 2a74e40
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions client/src/components/Projects/ProjectContextMenu.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import React from "react";
import { useState } from "react";
import PropTypes from "prop-types";
import {
faPrint,
Expand Down Expand Up @@ -29,6 +30,14 @@ const ProjectContextMenu = ({
handleCopyModalOpen,
handleDeleteModalOpen
}) => {
const [projectVisibility, SetProjectVisibility] = useState(
project.dateHidden
);

const toggleProjectVisibility = () => {
SetProjectVisibility(!projectVisibility);
};

const classes = useStyles();

return (
Expand Down Expand Up @@ -71,8 +80,11 @@ const ProjectContextMenu = ({
/>
Duplicate
</li>
<li className={classes.listItem}>
{project.dateHidden ? (
<li
onClick={() => toggleProjectVisibility(project)}
className={classes.listItem}
>
{projectVisibility ? (
<>
<FontAwesomeIcon
icon={faEyeSlash}
Expand Down

0 comments on commit 2a74e40

Please sign in to comment.