From 10f0ef3301883cd05711383e172ef5e5f3ee9d1c Mon Sep 17 00:00:00 2001 From: James Ritchie Date: Wed, 11 Dec 2024 12:24:23 +0000 Subject: [PATCH] Adds v2 countdown eol text in side menu (#1546) --- .../app/components/navigation/SideMenu.tsx | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/apps/webapp/app/components/navigation/SideMenu.tsx b/apps/webapp/app/components/navigation/SideMenu.tsx index 6435715dd4..2c3c5228f5 100644 --- a/apps/webapp/app/components/navigation/SideMenu.tsx +++ b/apps/webapp/app/components/navigation/SideMenu.tsx @@ -65,6 +65,7 @@ import { UserProfilePhoto } from "../UserProfilePhoto"; import { FreePlanUsage } from "../billing/v2/FreePlanUsage"; import { Badge } from "../primitives/Badge"; import { LinkButton } from "../primitives/Buttons"; +import { Header2 } from "../primitives/Headers"; import { Paragraph } from "../primitives/Paragraph"; import { Popover, @@ -91,6 +92,34 @@ type SideMenuProps = { defaultValue?: FeedbackType; }; +function V2Countdown() { + const [days, setDays] = useState(0); + + useEffect(() => { + const targetDate = new Date("2025-01-31T00:00:00Z"); + + const calculateDays = () => { + const now = new Date(); + const difference = targetDate.getTime() - now.getTime(); + return Math.floor(difference / (1000 * 60 * 60 * 24)); + }; + + const timer = setInterval(() => { + setDays(calculateDays()); + }, 1000 * 60 * 60); // Update every hour + + setDays(calculateDays()); // Initial calculation + + return () => clearInterval(timer); + }, []); + + return ( + + V2 goes offline in {days}d + + ); +} + export function SideMenu({ user, project, organization, organizations }: SideMenuProps) { const borderRef = useRef(null); const [showHeaderDivider, setShowHeaderDivider] = useState(false); @@ -215,7 +244,8 @@ export function SideMenu({ user, project, organization, organizations }: SideMen
{project.version === "V2" && ( -
+
+ This is a v2 project. V2 will be deprecated on January 31, 2025.{" "}