diff --git a/apps/site-projects/src/components/modules/Projects/Project/EditorNotification/EditorNotification.js b/apps/site-projects/src/components/modules/Projects/Project/EditorNotification/EditorNotification.js index 39c2c215b..ffe37fc8a 100644 --- a/apps/site-projects/src/components/modules/Projects/Project/EditorNotification/EditorNotification.js +++ b/apps/site-projects/src/components/modules/Projects/Project/EditorNotification/EditorNotification.js @@ -25,17 +25,21 @@ function hasEditingAccess(user, project) { } const EditorNotification = ({ project }) => { - + const [isClosed, setIsClosed] = React.useState(false) const user = useUserDataContext().userData; - if (!hasEditingAccess(user, project)) { + if (!hasEditingAccess(user, project) || isClosed) { return (<>>); } + function closeEditor() { + setIsClosed(true) + } + return (
Head to the dashboard in Strapi to make changes to the content of this page.
diff --git a/apps/site-projects/src/components/modules/Projects/Project/Project.js b/apps/site-projects/src/components/modules/Projects/Project/Project.js
index 824d631ec..6c2555e70 100644
--- a/apps/site-projects/src/components/modules/Projects/Project/Project.js
+++ b/apps/site-projects/src/components/modules/Projects/Project/Project.js
@@ -2,6 +2,7 @@
import React, { useRef } from "react";
// import Link from "next/link";
// import Image from "next/image";
+import { DateTime } from "luxon";
import { withTheme } from "styled-components";
import { useRouter } from "next/router";
import Button from "../../../common/Button";
@@ -30,6 +31,15 @@ function isOnTeam(id, team) {
return leadersIds.includes(id) || membersIds.includes(id);
}
+function hasPassedOneMonth(dateString) {
+ const currentDate = DateTime.local();
+ const completionDate = DateTime.fromISO(dateString);
+
+ const oneMonthLater = completionDate.plus({ months: 1 });
+
+ return currentDate >= oneMonthLater;
+}
+
const Project = ({ project, theme }) => {
const router = useRouter();
const roleRef = useRef();
@@ -46,6 +56,7 @@ const Project = ({ project, theme }) => {
const checkIfIsOnTeam = isOnTeam(userData.userData.id, project.team);
const isLogged = userData.userData.id === 0 ? false : true
+ const milestoneIsOutdated = hasPassedOneMonth(project.board.ProjectMilestone[0].task[0].completionDate)
return (