Skip to content

Commit 10f0ef3

Browse files
authored
Adds v2 countdown eol text in side menu (#1546)
1 parent 2e4a630 commit 10f0ef3

File tree

1 file changed

+31
-1
lines changed

1 file changed

+31
-1
lines changed

apps/webapp/app/components/navigation/SideMenu.tsx

+31-1
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ import { UserProfilePhoto } from "../UserProfilePhoto";
6565
import { FreePlanUsage } from "../billing/v2/FreePlanUsage";
6666
import { Badge } from "../primitives/Badge";
6767
import { LinkButton } from "../primitives/Buttons";
68+
import { Header2 } from "../primitives/Headers";
6869
import { Paragraph } from "../primitives/Paragraph";
6970
import {
7071
Popover,
@@ -91,6 +92,34 @@ type SideMenuProps = {
9192
defaultValue?: FeedbackType;
9293
};
9394

95+
function V2Countdown() {
96+
const [days, setDays] = useState(0);
97+
98+
useEffect(() => {
99+
const targetDate = new Date("2025-01-31T00:00:00Z");
100+
101+
const calculateDays = () => {
102+
const now = new Date();
103+
const difference = targetDate.getTime() - now.getTime();
104+
return Math.floor(difference / (1000 * 60 * 60 * 24));
105+
};
106+
107+
const timer = setInterval(() => {
108+
setDays(calculateDays());
109+
}, 1000 * 60 * 60); // Update every hour
110+
111+
setDays(calculateDays()); // Initial calculation
112+
113+
return () => clearInterval(timer);
114+
}, []);
115+
116+
return (
117+
<Header2 className="flex-wrap gap-4 text-error">
118+
V2 goes offline in <span className="tabular-nums">{days}d</span>
119+
</Header2>
120+
);
121+
}
122+
94123
export function SideMenu({ user, project, organization, organizations }: SideMenuProps) {
95124
const borderRef = useRef<HTMLDivElement>(null);
96125
const [showHeaderDivider, setShowHeaderDivider] = useState(false);
@@ -215,7 +244,8 @@ export function SideMenu({ user, project, organization, organizations }: SideMen
215244
</div>
216245
<div className="m-2">
217246
{project.version === "V2" && (
218-
<div className="flex flex-col gap-3 rounded border border-success/50 bg-success/10 p-3">
247+
<div className="flex flex-col gap-3 rounded border border-error/50 bg-error/5 p-3">
248+
<V2Countdown />
219249
<Paragraph variant="small/bright">
220250
This is a v2 project. V2 will be deprecated on January 31, 2025.{" "}
221251
<TextLink

0 commit comments

Comments
 (0)