mirror of
https://github.com/community-scripts/ProxmoxVE.git
synced 2026-04-26 04:10:39 +00:00
b819231a01
Introduced a new CopycatWarningToast component that displays a warning about copycat sites. The toast appears at the top-center of the screen and can be dismissed, with the dismissal state stored in local storage to prevent reappearing. Integrated the component into the RootLayout for global visibility.
25 lines
631 B
TypeScript
25 lines
631 B
TypeScript
"use client";
|
|
|
|
import { useEffect } from "react";
|
|
import { toast } from "sonner";
|
|
|
|
const STORAGE_KEY = "copycat-warning-dismissed";
|
|
|
|
export function CopycatWarningToast() {
|
|
useEffect(() => {
|
|
if (typeof window === "undefined")
|
|
return;
|
|
if (localStorage.getItem(STORAGE_KEY) === "true")
|
|
return;
|
|
|
|
toast.warning("Beware of copycat sites. Always verify the URL is correct before trusting or running scripts.", {
|
|
position: "top-center",
|
|
duration: Number.POSITIVE_INFINITY,
|
|
closeButton: true,
|
|
onDismiss: () => localStorage.setItem(STORAGE_KEY, "true"),
|
|
});
|
|
}, []);
|
|
|
|
return null;
|
|
}
|