From 8e97088f21d8102256e64d8a6ae6a9110a9cddd2 Mon Sep 17 00:00:00 2001 From: Kamran Ahmed Date: Mon, 26 May 2025 12:52:59 +0100 Subject: [PATCH] Update the hide end key to 14 days --- src/components/SQLCourse/CourseAnnouncement.tsx | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/src/components/SQLCourse/CourseAnnouncement.tsx b/src/components/SQLCourse/CourseAnnouncement.tsx index 8a9d32e0b..162f2c64a 100644 --- a/src/components/SQLCourse/CourseAnnouncement.tsx +++ b/src/components/SQLCourse/CourseAnnouncement.tsx @@ -2,18 +2,18 @@ import { Database, X } from 'lucide-react'; import { useState, useEffect } from 'react'; import { cn } from '../../lib/classname'; -const COURSE_ANNOUNCEMENT_STORAGE_KEY = '__course_announcement_closed_at__'; +const HIDE_ANNOUNCEMENT_END_KEY = '__course_announcement_closed_at__'; export function CourseAnnouncement() { const [isVisible, setIsVisible] = useState(false); useEffect(() => { - const closedAt = Number( - localStorage.getItem(COURSE_ANNOUNCEMENT_STORAGE_KEY) || '0', + const hiddenEndAt = Number( + localStorage.getItem(HIDE_ANNOUNCEMENT_END_KEY) || '0', ); - // only show if the closed at passed 3 days ago - const shouldShow = closedAt < Date.now(); + // only show if the closed at passed 14 days ago + const shouldShow = hiddenEndAt < Date.now(); if (!shouldShow) { return; } @@ -56,10 +56,11 @@ export function CourseAnnouncement() { onClick={(e) => { setIsVisible(false); - const threeDaysFromNow = Date.now() + 1000 * 60 * 60 * 24 * 3; + // 14 days from now + const fourteenDaysFromNow = Date.now() + 1000 * 60 * 60 * 24 * 14; localStorage.setItem( - COURSE_ANNOUNCEMENT_STORAGE_KEY, - String(threeDaysFromNow), + HIDE_ANNOUNCEMENT_END_KEY, + String(fourteenDaysFromNow), ); }} >