diff --git a/components/App.tsx b/components/App.tsx index 97d67b43e3..a199520b87 100644 --- a/components/App.tsx +++ b/components/App.tsx @@ -37,6 +37,7 @@ import { tryParsePublicKey } from '@tools/core/pubkey' import { useAsync } from 'react-async-hook' import { useVsrClient } from '../VoterWeightPlugins/useVsrClient' import { useRealmVoterWeightPlugins } from '@hooks/useRealmVoterWeightPlugins' +import TermsPopupModal from './TermsPopup' const Notifications = dynamic(() => import('../components/Notification'), { ssr: false, @@ -327,6 +328,7 @@ export function AppContents(props: Props) { {props.children} + diff --git a/components/TermsPopup.tsx b/components/TermsPopup.tsx new file mode 100644 index 0000000000..a2360e0c6e --- /dev/null +++ b/components/TermsPopup.tsx @@ -0,0 +1,57 @@ +import Modal from "./Modal" +import Button, { SecondaryButton } from './Button' +import { useEffect, useState } from "react" +import { useRouter } from "next/router" + +const TermsPopupModal = () => { + const [openModal, setOpenModal] = useState(true) + const [isClient, setIsClient] = useState(false) + const router = useRouter() + + useEffect(() => { + setIsClient(true) + }, []) + + useEffect(() => { + if (localStorage) { + const isTermAccepted = typeof window !== "undefined" ? + localStorage.getItem("accept-terms") === "true" : + false + + if (isTermAccepted) { + setOpenModal(false) + } + } + }) + + const acceptTerms = () => { + localStorage.setItem("accept-terms", "true") + setOpenModal(false) + } + + const rejectTerms = () => { + localStorage.setItem("accept-terms", "false") + router.push("https://realms.today?terms=rejected") + } + + return ( + <> + {isClient && openModal ? + ( setOpenModal(false)} bgClickClose={false} hideClose={true}> +

+ The operating entity of this site and owner of the related intellectual property has + changed. The new operator is Realms Today Ltd. (the New Operator). We have accordingly + amended the Terms and the Private Policy governing the relationship between our users + and the New Operator. By clicking "accept", you represent and warrant that you agree to + the revised Terms and Private Policy. +

+
+ + Reject +
+
) : null + } + ) +} + +export default TermsPopupModal; \ No newline at end of file