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

[UTOPIA-1328] Removed delete comments btn in Complete status #1431

Merged
merged 2 commits into from
Aug 1, 2023
Merged
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
55 changes: 28 additions & 27 deletions src/frontend/src/components/public/CommentsSidebar/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,7 @@ import { HttpRequest } from '../../../utils/http-request.util';
import Modal from '../../../components/common/Modal';
import Messages from './messages';
import { useLocation } from 'react-router-dom';
import { AppStorage } from '../../../utils/storage';
import { getGUID } from '../../../utils/helper.util';
import { PiaStatuses } from '../../../constant/constant';
import { statusList } from '../../../utils/status';
const CommentSidebar = ({
pia,
Expand All @@ -35,6 +33,7 @@ const CommentSidebar = ({
useEffect(() => {
if (!pia?.status) return;

// Allow adding new comments and use of "more" menu including delete comment.
const allowComment = statusList(pia)?.[pia.status]?.comments || false;
setEnableComments(allowComment);
}, [pia]);
Expand Down Expand Up @@ -127,31 +126,33 @@ const CommentSidebar = ({
{getDateTime(stringToDate(comment.updatedAt))}
</span>
</p>
<div className="d-flex mx-1 position-absolute top-0 start-100 translate-middle-x">
<button
className="mx-2 bcgovbtn bcgovbtn__tertiary"
type="button"
data-bs-toggle="dropdown"
aria-expanded={false}
aria-label="Comment Options Button"
>
<FontAwesomeIcon icon={faEllipsisH} fontSize="large" />
</button>
<ul
aria-label="Comment Options Menu"
className="dropdown-menu border-1 shadow-sm"
>
<li role="button">
<button
onClick={() => handleDeleteComment(comment.id)}
className="dropdown-item"
disabled={comment.createdByGuid !== getGUID()}
>
Delete
</button>
</li>
</ul>
</div>
{enableComments && (
<div className="d-flex mx-1 position-absolute top-0 start-100 translate-middle-x">
<button
className="mx-2 bcgovbtn bcgovbtn__tertiary"
type="button"
data-bs-toggle="dropdown"
aria-expanded={false}
aria-label="Comment Options Button"
>
<FontAwesomeIcon icon={faEllipsisH} fontSize="large" />
</button>
<ul
aria-label="Comment Options Menu"
className="dropdown-menu border-1 shadow-sm"
>
<li role="button">
<button
onClick={() => handleDeleteComment(comment.id)}
className="dropdown-item"
disabled={comment.createdByGuid !== getGUID()}
>
Delete
</button>
</li>
</ul>
</div>
)}
</div>
<div>
{comment.isActive ? (
Expand Down
Loading