diff --git a/package-lock.json b/package-lock.json index 4111e297a..f878d8487 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,6 @@ "ethers": "^5.5.4", "process": "^0.11.10", "react": "^17.0.2", - "react-cookie": "^4.1.1", "react-dom": "^17.0.2", "react-helmet-async": "^1.3.0", "react-image": "^4.0.3", @@ -3862,11 +3861,6 @@ "@types/node": "*" } }, - "node_modules/@types/cookie": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", - "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" - }, "node_modules/@types/eslint": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", @@ -3919,15 +3913,6 @@ "@types/node": "*" } }, - "node_modules/@types/hoist-non-react-statics": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", - "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", - "dependencies": { - "@types/react": "*", - "hoist-non-react-statics": "^3.3.0" - } - }, "node_modules/@types/html-minifier-terser": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", @@ -13846,19 +13831,6 @@ "react-scripts": ">=2.1.3" } }, - "node_modules/react-cookie": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.1.1.tgz", - "integrity": "sha512-ffn7Y7G4bXiFbnE+dKhHhbP+b8I34mH9jqnm8Llhj89zF4nPxPutxHT1suUqMeCEhLDBI7InYwf1tpaSoK5w8A==", - "dependencies": { - "@types/hoist-non-react-statics": "^3.0.1", - "hoist-non-react-statics": "^3.0.0", - "universal-cookie": "^4.0.0" - }, - "peerDependencies": { - "react": ">= 16.3.0" - } - }, "node_modules/react-dev-utils": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.0.tgz", @@ -15868,15 +15840,6 @@ "node": ">=8" } }, - "node_modules/universal-cookie": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", - "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", - "dependencies": { - "@types/cookie": "^0.3.3", - "cookie": "^0.4.0" - } - }, "node_modules/universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", @@ -19519,11 +19482,6 @@ "@types/node": "*" } }, - "@types/cookie": { - "version": "0.3.3", - "resolved": "https://registry.npmjs.org/@types/cookie/-/cookie-0.3.3.tgz", - "integrity": "sha512-LKVP3cgXBT9RYj+t+9FDKwS5tdI+rPBXaNSkma7hvqy35lc7mAokC2zsqWJH0LaqIt3B962nuYI77hsJoT1gow==" - }, "@types/eslint": { "version": "7.29.0", "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", @@ -19576,15 +19534,6 @@ "@types/node": "*" } }, - "@types/hoist-non-react-statics": { - "version": "3.3.1", - "resolved": "https://registry.npmjs.org/@types/hoist-non-react-statics/-/hoist-non-react-statics-3.3.1.tgz", - "integrity": "sha512-iMIqiko6ooLrTh1joXodJK5X9xeEALT1kM5G3ZLhD3hszxBdIEd5C75U834D9mLcINgD4OyZf5uQXjkuYydWvA==", - "requires": { - "@types/react": "*", - "hoist-non-react-statics": "^3.3.0" - } - }, "@types/html-minifier-terser": { "version": "6.1.0", "resolved": "https://registry.npmjs.org/@types/html-minifier-terser/-/html-minifier-terser-6.1.0.tgz", @@ -26759,16 +26708,6 @@ "semver": "^5.6.0" } }, - "react-cookie": { - "version": "4.1.1", - "resolved": "https://registry.npmjs.org/react-cookie/-/react-cookie-4.1.1.tgz", - "integrity": "sha512-ffn7Y7G4bXiFbnE+dKhHhbP+b8I34mH9jqnm8Llhj89zF4nPxPutxHT1suUqMeCEhLDBI7InYwf1tpaSoK5w8A==", - "requires": { - "@types/hoist-non-react-statics": "^3.0.1", - "hoist-non-react-statics": "^3.0.0", - "universal-cookie": "^4.0.0" - } - }, "react-dev-utils": { "version": "12.0.0", "resolved": "https://registry.npmjs.org/react-dev-utils/-/react-dev-utils-12.0.0.tgz", @@ -28275,15 +28214,6 @@ "crypto-random-string": "^2.0.0" } }, - "universal-cookie": { - "version": "4.0.4", - "resolved": "https://registry.npmjs.org/universal-cookie/-/universal-cookie-4.0.4.tgz", - "integrity": "sha512-lbRVHoOMtItjWbM7TwDLdl8wug7izB0tq3/YVKhT/ahB4VDvWMyvnADfnJI8y6fSvsjh51Ix7lTGC6Tn4rMPhw==", - "requires": { - "@types/cookie": "^0.3.3", - "cookie": "^0.4.0" - } - }, "universalify": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/universalify/-/universalify-2.0.0.tgz", diff --git a/package.json b/package.json index c955aeffd..63be148c1 100644 --- a/package.json +++ b/package.json @@ -18,7 +18,6 @@ "ethers": "^5.5.4", "process": "^0.11.10", "react": "^17.0.2", - "react-cookie": "^4.1.1", "react-dom": "^17.0.2", "react-helmet-async": "^1.3.0", "react-image": "^4.0.3", diff --git a/src/App.tsx b/src/App.tsx index be6706aee..d2f2f57a1 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -1,19 +1,20 @@ -import { useState, useEffect } from 'react'; -import { useCookies } from 'react-cookie'; +import { useEffect } from 'react'; import { toast } from 'react-toastify'; import Body from './components/Body'; import Breadcrumbs from './components/Breadcrumbs'; import Header from './components/ui/Header'; import { TextButton } from './components/ui/forms/Button'; +import { useLocalStorage } from './hooks/useLocalStorage'; function NotAuditedToast() { - const [cookieName] = useState('not-audited-acceptance'); - const [cookieValue] = useState('true'); - const [cookies, setCookie] = useCookies([cookieName]); + const [notAuditedAcceptance, setNotAuditedAcceptance] = useLocalStorage( + 'not_audited_acceptance', + false + ); useEffect(() => { - if (cookies[cookieName] === cookieValue) { + if (notAuditedAcceptance) { return; } @@ -22,7 +23,7 @@ function NotAuditedToast() {
WARNING: this project is not audited, use at your own risk.
setCookie(cookieName, cookieValue, { path: '/' })} + onClick={() => setNotAuditedAcceptance(true)} /> , { @@ -34,7 +35,7 @@ function NotAuditedToast() { ); return () => toast.dismiss(toastId); - }, [cookieName, cookieValue, cookies, setCookie]); + }, [notAuditedAcceptance, setNotAuditedAcceptance]); return null; } diff --git a/src/index.tsx b/src/index.tsx index f09353a88..f56ce0340 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -3,7 +3,6 @@ import ReactDOM from 'react-dom'; import { HashRouter } from 'react-router-dom'; import { ToastContainer } from 'react-toastify'; import { HelmetProvider, Helmet } from 'react-helmet-async'; -import { CookiesProvider } from 'react-cookie'; import './index.css'; import reportWebVitals from './reportWebVitals'; @@ -14,30 +13,28 @@ import App from './App'; ReactDOM.render( - - - - Fractal - - - - - - - - - - - - - + + + Fractal + + + + + + + + + + + + , document.getElementById('root') );