diff --git a/apps/OpenSign/src/components/Header.js b/apps/OpenSign/src/components/Header.js index 5a7758c23..13c2334e7 100644 --- a/apps/OpenSign/src/components/Header.js +++ b/apps/OpenSign/src/components/Header.js @@ -20,6 +20,9 @@ const Header = ({ showSidebar }) => { const { t, i18n } = useTranslation(); const navigate = useNavigate(); const { width } = useWindowSize(); + const current_notification_version = "1"; // Update this with each new feature release + // Get the dismissed version from local storage + const dismissedVersion = localStorage.getItem("notificationDismissedVersion"); const username = localStorage.getItem("username") || ""; const image = localStorage.getItem("profileImg") || dp; const [isOpen, setIsOpen] = useState(false); @@ -30,7 +33,10 @@ const Header = ({ showSidebar }) => { ); const [emailUsed, setEmailUsed] = useState(0); const [isModal, setIsModal] = useState(false); - + const [showNotification, setShowNotification] = useState( + (!dismissedVersion || dismissedVersion !== current_notification_version) && + true + ); const toggleDropdown = () => { setIsOpen(!isOpen); }; @@ -115,17 +121,34 @@ const Header = ({ showSidebar }) => { const handleMailUsed = () => { setIsModal(!isModal); }; + // Handle dismissing the notification + const dismissNotification = () => { + // Store the current version as dismissed in local storage + localStorage.setItem( + "notificationDismissedVersion", + current_notification_version + ); + setShowNotification(false); + }; return (
- {isEnableSubscription && ( -
- {t("header-news")} — - navigate("/profile")} + {isEnableSubscription && showNotification && ( +
+
+ {t("header-news")} — + navigate("/profile")} + > + {" " + t("header-news-btn") + "."} + +
+
dismissNotification()} > - {" " + t("header-news-btn") + "."} - + +
)}