Skip to content

Commit

Permalink
Fix logic of hide/unhide context menu on My Projects
Browse files Browse the repository at this point in the history
  • Loading branch information
entrotech committed Nov 21, 2023
1 parent f6618d0 commit 00fd131
Showing 1 changed file with 6 additions and 17 deletions.
23 changes: 6 additions & 17 deletions client/src/components/Projects/ProjectContextMenu.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import React, { useContext } from "react";
import UserContext from "../../contexts/UserContext";
import { useState } from "react";
import PropTypes from "prop-types";

import { createUseStyles } from "react-jss";
Expand Down Expand Up @@ -43,13 +42,6 @@ const ProjectContextMenu = ({
}) => {
const userContext = useContext(UserContext);
const account = userContext.account;
const [projectVisibility, SetProjectVisibility] = useState(
project.dateHidden
);
const toggleProjectVisibility = () => {
SetProjectVisibility(!projectVisibility);
};

const classes = useStyles();

return (
Expand Down Expand Up @@ -99,27 +91,24 @@ const ProjectContextMenu = ({
Duplicate
</li>
{project.loginId !== account.id ? null : (
<li
onClick={() => toggleProjectVisibility(project)}
className={classes.listItem}
>
{projectVisibility ? (
<li onClick={() => handleHide(project)} className={classes.listItem}>
{project.dateHidden ? (
<>
<FontAwesomeIcon
icon={faEyeSlash}
icon={faEye}
className={classes.listItemIcon}
alt={`Unhide Project #${project.id} as CSV Icon`}
alt={`Hide Project #${project.id} as CSV Icon`}
/>
Unhide
</>
) : (
<>
<FontAwesomeIcon
icon={faEye}
icon={faEyeSlash}
className={classes.listItemIcon}
alt={`Hide Project #${project.id} as CSV Icon`}
/>
Hide from View
Hide
</>
)}
</li>
Expand Down

0 comments on commit 00fd131

Please sign in to comment.