diff --git a/README.md b/README.md index d5dbba8..66c6045 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,8 @@ - Support for Container Queries (media queries at the element level) - The website has a three-column layout, which turns into one-column + 2 toggleable side-menus if the screen is too narrow. - Check out our [Design System Showcase](https://accords-library.com/dev/showcase/design-system) -- State Management: [React Context](https://reactjs.org/docs/context.html) +- State Management: [Jōtai](https://jotai.org/) + - Jōtai is a small-weighted library for atomic state management - Persistent app state using LocalStorage and SessionStorage - Accessibility - Gestures using [react-swipeable](https://www.npmjs.com/package/react-swipeable) diff --git a/package-lock.json b/package-lock.json index 9de9b49..b0a93e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,6 +16,7 @@ "autoprefixer": "^10.4.13", "cuid": "^2.1.8", "graphql-request": "^5.0.0", + "jotai": "^1.9.0", "markdown-to-jsx": "^7.1.7", "next": "^12.3.1", "nodemailer": "^6.8.0", @@ -65,7 +66,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/gen-mapping": "^0.1.0", "@jridgewell/trace-mapping": "^0.3.9" @@ -78,7 +79,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/set-array": "^1.0.0", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -134,7 +135,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/highlight": "^7.18.6" }, @@ -146,7 +147,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.4.tgz", "integrity": "sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -155,7 +156,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.6.tgz", "integrity": "sha512-D2Ue4KHpc6Ys2+AxpIx1BZ8+UegLLLE2p3KJEuJRKmokHOtl49jQ5ny1773KsGLZs8MQvBidAF6yWUJxRqtKtg==", - "dev": true, + "devOptional": true, "dependencies": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", @@ -185,7 +186,7 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true, + "devOptional": true, "bin": { "json5": "lib/cli.js" }, @@ -197,7 +198,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, + "devOptional": true, "bin": { "semver": "bin/semver.js" } @@ -206,7 +207,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.6.tgz", "integrity": "sha512-oHGRUQeoX1QrKeJIKVe0hwjGqNnVYsM5Nep5zo0uE0m42sLH+Fsd2pStJ5sRM1bNyTUUoz0pe2lTeMJrb/taTA==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/types": "^7.19.4", "@jridgewell/gen-mapping": "^0.3.2", @@ -232,7 +233,7 @@ "version": "7.19.3", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/compat-data": "^7.19.3", "@babel/helper-validator-option": "^7.18.6", @@ -250,7 +251,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true, + "devOptional": true, "bin": { "semver": "bin/semver.js" } @@ -280,7 +281,7 @@ "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -289,7 +290,7 @@ "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/template": "^7.18.10", "@babel/types": "^7.19.0" @@ -302,7 +303,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/types": "^7.18.6" }, @@ -326,7 +327,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/types": "^7.18.6" }, @@ -338,7 +339,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.6.tgz", "integrity": "sha512-fCmcfQo/KYr/VXXDIyd3CBGZ6AFhPFy1TfSEJ+PilGVlQT6jcbqtHAM4C1EciRqMza7/TpOUZliuSH+U6HAhJw==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", @@ -394,7 +395,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz", "integrity": "sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/types": "^7.19.4" }, @@ -418,7 +419,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/types": "^7.18.6" }, @@ -430,7 +431,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -439,7 +440,7 @@ "version": "7.19.1", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -448,7 +449,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -457,7 +458,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.4.tgz", "integrity": "sha512-G+z3aOx2nfDHwX/kyVii5fJq+bgscg89/dJNWpYeKeBv3v9xX8EIabmx1k6u9LS04H7nROFVRVK+e3k0VHp+sw==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/template": "^7.18.10", "@babel/traverse": "^7.19.4", @@ -471,7 +472,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", @@ -485,7 +486,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, + "devOptional": true, "dependencies": { "color-convert": "^1.9.0" }, @@ -497,7 +498,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, + "devOptional": true, "dependencies": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -511,7 +512,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, + "devOptional": true, "dependencies": { "color-name": "1.1.3" } @@ -520,13 +521,13 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "devOptional": true }, "node_modules/@babel/highlight/node_modules/escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=0.8.0" } @@ -535,7 +536,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=4" } @@ -544,7 +545,7 @@ "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, + "devOptional": true, "dependencies": { "has-flag": "^3.0.0" }, @@ -556,7 +557,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.6.tgz", "integrity": "sha512-h1IUp81s2JYJ3mRkdxJgs4UvmSsRvDrx5ICSJbPvtWYv5i1nTBGcBpnog+89rAFMwvvru6E5NUHdBe01UeSzYA==", - "dev": true, + "devOptional": true, "bin": { "parser": "bin/babel-parser.js" }, @@ -1000,7 +1001,7 @@ "version": "7.18.10", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/code-frame": "^7.18.6", "@babel/parser": "^7.18.10", @@ -1014,7 +1015,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.6.tgz", "integrity": "sha512-6l5HrUCzFM04mfbG09AagtYyR2P0B71B1wN7PfSPiksDPz2k5H9CBC1tcZpz2M8OxbKTPccByoOJ22rUKbpmQQ==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/code-frame": "^7.18.6", "@babel/generator": "^7.19.6", @@ -1035,7 +1036,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.4.tgz", "integrity": "sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==", - "dev": true, + "devOptional": true, "dependencies": { "@babel/helper-string-parser": "^7.19.4", "@babel/helper-validator-identifier": "^7.19.1", @@ -2160,7 +2161,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/set-array": "^1.0.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -2174,7 +2175,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.0.0" } @@ -2183,7 +2184,7 @@ "version": "1.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.0.0" } @@ -2192,13 +2193,13 @@ "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "devOptional": true }, "node_modules/@jridgewell/trace-mapping": { "version": "0.3.15", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", - "dev": true, + "devOptional": true, "dependencies": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -3844,7 +3845,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true + "devOptional": true }, "node_modules/core-js-pure": { "version": "3.21.1", @@ -3971,7 +3972,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "devOptional": true, "dependencies": { "ms": "2.1.2" }, @@ -5463,7 +5464,7 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6.9.0" } @@ -5543,7 +5544,7 @@ "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true, + "devOptional": true, "engines": { "node": ">=4" } @@ -6298,6 +6299,51 @@ "ws": "*" } }, + "node_modules/jotai": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/jotai/-/jotai-1.9.0.tgz", + "integrity": "sha512-XYpSlxbxujUCTA8PNkzfj3+zF6XVyzo6XMZIEic3gXQCpTDPfmqhUj2FR8kwUACK5weosFrSBhesrjwfILUCoQ==", + "engines": { + "node": ">=12.7.0" + }, + "peerDependencies": { + "@babel/core": "*", + "@babel/template": "*", + "immer": "*", + "jotai-tanstack-query": "*", + "jotai-urql": "*", + "optics-ts": "*", + "react": ">=16.8", + "valtio": "*", + "xstate": "*" + }, + "peerDependenciesMeta": { + "@babel/core": { + "optional": true + }, + "@babel/template": { + "optional": true + }, + "immer": { + "optional": true + }, + "jotai-tanstack-query": { + "optional": true + }, + "jotai-urql": { + "optional": true + }, + "optics-ts": { + "optional": true + }, + "valtio": { + "optional": true + }, + "xstate": { + "optional": true + } + } + }, "node_modules/js-sdsl": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz", @@ -6325,7 +6371,7 @@ "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true, + "devOptional": true, "bin": { "jsesc": "bin/jsesc" }, @@ -6825,7 +6871,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "devOptional": true }, "node_modules/nanoid": { "version": "3.3.4", @@ -8541,7 +8587,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true, + "devOptional": true, "engines": { "node": ">=4" } @@ -9219,7 +9265,7 @@ "version": "2.2.0", "resolved": "https://registry.npmjs.org/@ampproject/remapping/-/remapping-2.2.0.tgz", "integrity": "sha512-qRmjj8nj9qmLTQXXmaR1cck3UXSRMPrbsLJAasZpF+t3riI71BXed5ebIOYwQntykeZuhjsdweEc9BxH5Jc26w==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/gen-mapping": "^0.1.0", "@jridgewell/trace-mapping": "^0.3.9" @@ -9229,7 +9275,7 @@ "version": "0.1.1", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.1.1.tgz", "integrity": "sha512-sQXCasFk+U8lWYEe66WxRDOE9PjVz4vSM51fTu3Hw+ClTpUSQb718772vH3pyS5pShp6lvQM7SxgIDXXXmOX7w==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/set-array": "^1.0.0", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -9275,7 +9321,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.18.6.tgz", "integrity": "sha512-TDCmlK5eOvH+eH7cdAFlNXeVJqWIQ7gW9tY1GJIpUtFb6CmjVyq2VM3u71bOyR8CRihcCgMUYoDNyLXao3+70Q==", - "dev": true, + "devOptional": true, "requires": { "@babel/highlight": "^7.18.6" } @@ -9284,13 +9330,13 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/compat-data/-/compat-data-7.19.4.tgz", "integrity": "sha512-CHIGpJcUQ5lU9KrPHTjBMhVwQG6CQjxfg36fGXl3qk/Gik1WwWachaXFuo0uCWJT/mStOKtcbFJCaVLihC1CMw==", - "dev": true + "devOptional": true }, "@babel/core": { "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/core/-/core-7.19.6.tgz", "integrity": "sha512-D2Ue4KHpc6Ys2+AxpIx1BZ8+UegLLLE2p3KJEuJRKmokHOtl49jQ5ny1773KsGLZs8MQvBidAF6yWUJxRqtKtg==", - "dev": true, + "devOptional": true, "requires": { "@ampproject/remapping": "^2.1.0", "@babel/code-frame": "^7.18.6", @@ -9313,13 +9359,13 @@ "version": "2.2.1", "resolved": "https://registry.npmjs.org/json5/-/json5-2.2.1.tgz", "integrity": "sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA==", - "dev": true + "devOptional": true }, "semver": { "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "devOptional": true } } }, @@ -9327,7 +9373,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/generator/-/generator-7.19.6.tgz", "integrity": "sha512-oHGRUQeoX1QrKeJIKVe0hwjGqNnVYsM5Nep5zo0uE0m42sLH+Fsd2pStJ5sRM1bNyTUUoz0pe2lTeMJrb/taTA==", - "dev": true, + "devOptional": true, "requires": { "@babel/types": "^7.19.4", "@jridgewell/gen-mapping": "^0.3.2", @@ -9347,7 +9393,7 @@ "version": "7.19.3", "resolved": "https://registry.npmjs.org/@babel/helper-compilation-targets/-/helper-compilation-targets-7.19.3.tgz", "integrity": "sha512-65ESqLGyGmLvgR0mst5AdW1FkNlj9rQsCKduzEoEPhBCDFGXvz2jW6bXFG6i0/MrV2s7hhXjjb2yAzcPuQlLwg==", - "dev": true, + "devOptional": true, "requires": { "@babel/compat-data": "^7.19.3", "@babel/helper-validator-option": "^7.18.6", @@ -9359,7 +9405,7 @@ "version": "6.3.0", "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", - "dev": true + "devOptional": true } } }, @@ -9382,13 +9428,13 @@ "version": "7.18.9", "resolved": "https://registry.npmjs.org/@babel/helper-environment-visitor/-/helper-environment-visitor-7.18.9.tgz", "integrity": "sha512-3r/aACDJ3fhQ/EVgFy0hpj8oHyHpQc+LPtJoY9SzTThAsStm4Ptegq92vqKoE3vD706ZVFWITnMnxucw+S9Ipg==", - "dev": true + "devOptional": true }, "@babel/helper-function-name": { "version": "7.19.0", "resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.19.0.tgz", "integrity": "sha512-WAwHBINyrpqywkUH0nTnNgI5ina5TFn85HKS0pbPDfxFfhyR/aNQEn4hGi1P1JyT//I0t4OgXUlofzWILRvS5w==", - "dev": true, + "devOptional": true, "requires": { "@babel/template": "^7.18.10", "@babel/types": "^7.19.0" @@ -9398,7 +9444,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.18.6.tgz", "integrity": "sha512-UlJQPkFqFULIcyW5sbzgbkxn2FKRgwWiRexcuaR8RNJRy8+LLveqPjwZV/bwrLZCN0eUHD/x8D0heK1ozuoo6Q==", - "dev": true, + "devOptional": true, "requires": { "@babel/types": "^7.18.6" } @@ -9416,7 +9462,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-module-imports/-/helper-module-imports-7.18.6.tgz", "integrity": "sha512-0NFvs3VkuSYbFi1x2Vd6tKrywq+z/cLeYC/RJNFrIX/30Bf5aiGYbtvGXolEktzJH8o5E5KJ3tT+nkxuuZFVlA==", - "dev": true, + "devOptional": true, "requires": { "@babel/types": "^7.18.6" } @@ -9425,7 +9471,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/helper-module-transforms/-/helper-module-transforms-7.19.6.tgz", "integrity": "sha512-fCmcfQo/KYr/VXXDIyd3CBGZ6AFhPFy1TfSEJ+PilGVlQT6jcbqtHAM4C1EciRqMza7/TpOUZliuSH+U6HAhJw==", - "dev": true, + "devOptional": true, "requires": { "@babel/helper-environment-visitor": "^7.18.9", "@babel/helper-module-imports": "^7.18.6", @@ -9469,7 +9515,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helper-simple-access/-/helper-simple-access-7.19.4.tgz", "integrity": "sha512-f9Xq6WqBFqaDfbCzn2w85hwklswz5qsKlh7f08w4Y9yhJHpnNC0QemtSkK5YyOY8kPGvyiwdzZksGUhnGdaUIg==", - "dev": true, + "devOptional": true, "requires": { "@babel/types": "^7.19.4" } @@ -9487,7 +9533,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-split-export-declaration/-/helper-split-export-declaration-7.18.6.tgz", "integrity": "sha512-bde1etTx6ZyTmobl9LLMMQsaizFVZrquTEHOqKeQESMKo4PlObf+8+JA25ZsIpZhT/WEd39+vOdLXAFG/nELpA==", - "dev": true, + "devOptional": true, "requires": { "@babel/types": "^7.18.6" } @@ -9496,25 +9542,25 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helper-string-parser/-/helper-string-parser-7.19.4.tgz", "integrity": "sha512-nHtDoQcuqFmwYNYPz3Rah5ph2p8PFeFCsZk9A/48dPc/rGocJ5J3hAAZ7pb76VWX3fZKu+uEr/FhH5jLx7umrw==", - "dev": true + "devOptional": true }, "@babel/helper-validator-identifier": { "version": "7.19.1", "resolved": "https://registry.npmjs.org/@babel/helper-validator-identifier/-/helper-validator-identifier-7.19.1.tgz", "integrity": "sha512-awrNfaMtnHUr653GgGEs++LlAvW6w+DcPrOliSMXWCKo597CwL5Acf/wWdNkf/tfEQE3mjkeD1YOVZOUV/od1w==", - "dev": true + "devOptional": true }, "@babel/helper-validator-option": { "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/helper-validator-option/-/helper-validator-option-7.18.6.tgz", "integrity": "sha512-XO7gESt5ouv/LRJdrVjkShckw6STTaB7l9BrpBaAHDeF5YZT+01PCwmR0SJHnkW6i8OwW/EVWRShfi4j2x+KQw==", - "dev": true + "devOptional": true }, "@babel/helpers": { "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/helpers/-/helpers-7.19.4.tgz", "integrity": "sha512-G+z3aOx2nfDHwX/kyVii5fJq+bgscg89/dJNWpYeKeBv3v9xX8EIabmx1k6u9LS04H7nROFVRVK+e3k0VHp+sw==", - "dev": true, + "devOptional": true, "requires": { "@babel/template": "^7.18.10", "@babel/traverse": "^7.19.4", @@ -9525,7 +9571,7 @@ "version": "7.18.6", "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.18.6.tgz", "integrity": "sha512-u7stbOuYjaPezCuLj29hNW1v64M2Md2qupEKP1fHc7WdOA3DgLh37suiSrZYY7haUB7iBeQZ9P1uiRF359do3g==", - "dev": true, + "devOptional": true, "requires": { "@babel/helper-validator-identifier": "^7.18.6", "chalk": "^2.0.0", @@ -9536,7 +9582,7 @@ "version": "3.2.1", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz", "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==", - "dev": true, + "devOptional": true, "requires": { "color-convert": "^1.9.0" } @@ -9545,7 +9591,7 @@ "version": "2.4.2", "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz", "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==", - "dev": true, + "devOptional": true, "requires": { "ansi-styles": "^3.2.1", "escape-string-regexp": "^1.0.5", @@ -9556,7 +9602,7 @@ "version": "1.9.3", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz", "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==", - "dev": true, + "devOptional": true, "requires": { "color-name": "1.1.3" } @@ -9565,25 +9611,25 @@ "version": "1.1.3", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz", "integrity": "sha512-72fSenhMw2HZMTVHeCA9KCmpEIbzWiQsjN+BHcBbS9vr1mtt+vJjPdksIBNUmKAW8TFUDPJK5SUU3QhE9NEXDw==", - "dev": true + "devOptional": true }, "escape-string-regexp": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz", "integrity": "sha512-vbRorB5FUQWvla16U8R/qgaFIya2qGzwDrNmCZuYKrbdSUMG6I1ZCGQRefkRVhuOkIGVne7BQ35DSfo1qvJqFg==", - "dev": true + "devOptional": true }, "has-flag": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz", "integrity": "sha512-sKJf1+ceQBr4SMkvQnBDNDtf4TXpVhVGateu0t918bl30FnbE2m4vNLX+VWe/dpjlb+HugGYzW7uQXH98HPEYw==", - "dev": true + "devOptional": true }, "supports-color": { "version": "5.5.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz", "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==", - "dev": true, + "devOptional": true, "requires": { "has-flag": "^3.0.0" } @@ -9594,7 +9640,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/parser/-/parser-7.19.6.tgz", "integrity": "sha512-h1IUp81s2JYJ3mRkdxJgs4UvmSsRvDrx5ICSJbPvtWYv5i1nTBGcBpnog+89rAFMwvvru6E5NUHdBe01UeSzYA==", - "dev": true + "devOptional": true }, "@babel/plugin-proposal-class-properties": { "version": "7.18.6", @@ -9876,7 +9922,7 @@ "version": "7.18.10", "resolved": "https://registry.npmjs.org/@babel/template/-/template-7.18.10.tgz", "integrity": "sha512-TI+rCtooWHr3QJ27kJxfjutghu44DLnasDMwpDqCXVTal9RLp3RSYNh4NdBrRP2cQAoG9A8juOQl6P6oZG4JxA==", - "dev": true, + "devOptional": true, "requires": { "@babel/code-frame": "^7.18.6", "@babel/parser": "^7.18.10", @@ -9887,7 +9933,7 @@ "version": "7.19.6", "resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.19.6.tgz", "integrity": "sha512-6l5HrUCzFM04mfbG09AagtYyR2P0B71B1wN7PfSPiksDPz2k5H9CBC1tcZpz2M8OxbKTPccByoOJ22rUKbpmQQ==", - "dev": true, + "devOptional": true, "requires": { "@babel/code-frame": "^7.18.6", "@babel/generator": "^7.19.6", @@ -9905,7 +9951,7 @@ "version": "7.19.4", "resolved": "https://registry.npmjs.org/@babel/types/-/types-7.19.4.tgz", "integrity": "sha512-M5LK7nAeS6+9j7hAq+b3fQs+pNfUtTGq+yFFfHnauFA8zQtLRfmuipmsKDKKLuyG+wC8ABW43A153YNawNTEtw==", - "dev": true, + "devOptional": true, "requires": { "@babel/helper-string-parser": "^7.19.4", "@babel/helper-validator-identifier": "^7.19.1", @@ -10885,7 +10931,7 @@ "version": "0.3.2", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.2.tgz", "integrity": "sha512-mh65xKQAzI6iBcFzwv28KVWSmCkdRBWoOh+bYQGW3+6OZvbbN3TqMGo5hqYxQniRcH9F2VZIoJCm4pa3BPDK/A==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/set-array": "^1.0.1", "@jridgewell/sourcemap-codec": "^1.4.10", @@ -10896,25 +10942,25 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/@jridgewell/resolve-uri/-/resolve-uri-3.1.0.tgz", "integrity": "sha512-F2msla3tad+Mfht5cJq7LSXcdudKTWCVYUgw6pLFOOHSTtZlj6SWNYAp+AhuqLmWdBO2X5hPrLcu8cVP8fy28w==", - "dev": true + "devOptional": true }, "@jridgewell/set-array": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/@jridgewell/set-array/-/set-array-1.1.2.tgz", "integrity": "sha512-xnkseuNADM0gt2bs+BvhO0p78Mk762YnZdsuzFV018NoG1Sj1SCQvpSqa7XUaTam5vAGasABV9qXASMKnFMwMw==", - "dev": true + "devOptional": true }, "@jridgewell/sourcemap-codec": { "version": "1.4.14", "resolved": "https://registry.npmjs.org/@jridgewell/sourcemap-codec/-/sourcemap-codec-1.4.14.tgz", "integrity": "sha512-XPSJHWmi394fuUuzDnGz1wiKqWfo1yXecHQMRf2l6hztTO+nPru658AyDngaBe7isIxEkRsPR3FZh+s7iVa4Uw==", - "dev": true + "devOptional": true }, "@jridgewell/trace-mapping": { "version": "0.3.15", "resolved": "https://registry.npmjs.org/@jridgewell/trace-mapping/-/trace-mapping-0.3.15.tgz", "integrity": "sha512-oWZNOULl+UbhsgB51uuZzglikfIKSUBO/M9W2OfEjn7cmqoAiCgmv9lyACTUacZwBz0ITnJ2NqjU8Tx0DHL88g==", - "dev": true, + "devOptional": true, "requires": { "@jridgewell/resolve-uri": "^3.0.3", "@jridgewell/sourcemap-codec": "^1.4.10" @@ -12104,7 +12150,7 @@ "version": "1.9.0", "resolved": "https://registry.npmjs.org/convert-source-map/-/convert-source-map-1.9.0.tgz", "integrity": "sha512-ASFBup0Mz1uyiIjANan1jzLQami9z1PoYSZCiiYW2FczPbenXc45FZdBZLzOT+r6+iciuEModtmCti+hjaAk0A==", - "dev": true + "devOptional": true }, "core-js-pure": { "version": "3.21.1", @@ -12205,7 +12251,7 @@ "version": "4.3.4", "resolved": "https://registry.npmjs.org/debug/-/debug-4.3.4.tgz", "integrity": "sha512-PRWFHuSU3eDtQJPvnNY7Jcket1j0t5OuOsFzPPzsekD52Zl8qUfFIPEiswXqIvHWGVHOgX+7G/vCNNhehwxfkQ==", - "dev": true, + "devOptional": true, "requires": { "ms": "2.1.2" } @@ -13250,7 +13296,7 @@ "version": "1.0.0-beta.2", "resolved": "https://registry.npmjs.org/gensync/-/gensync-1.0.0-beta.2.tgz", "integrity": "sha512-3hN7NaskYvMDLQY55gnW3NQ+mesEAepTqlg+VEbj7zzqEMBVNhzcGYYeqFo/TlYz6eQiFcp1HcsCZO+nGgS8zg==", - "dev": true + "devOptional": true }, "get-caller-file": { "version": "2.0.5", @@ -13306,7 +13352,7 @@ "version": "11.12.0", "resolved": "https://registry.npmjs.org/globals/-/globals-11.12.0.tgz", "integrity": "sha512-WOBp/EEGUiIsJSp7wcv/y6MO+lV9UoncWqxuFfm8eBwzWNgyfBd6Gz+IeKQ9jCmyhoH99g15M3T+QaVHFjizVA==", - "dev": true + "devOptional": true }, "globby": { "version": "11.1.0", @@ -13856,6 +13902,12 @@ "dev": true, "requires": {} }, + "jotai": { + "version": "1.9.0", + "resolved": "https://registry.npmjs.org/jotai/-/jotai-1.9.0.tgz", + "integrity": "sha512-XYpSlxbxujUCTA8PNkzfj3+zF6XVyzo6XMZIEic3gXQCpTDPfmqhUj2FR8kwUACK5weosFrSBhesrjwfILUCoQ==", + "requires": {} + }, "js-sdsl": { "version": "4.1.4", "resolved": "https://registry.npmjs.org/js-sdsl/-/js-sdsl-4.1.4.tgz", @@ -13880,7 +13932,7 @@ "version": "2.5.2", "resolved": "https://registry.npmjs.org/jsesc/-/jsesc-2.5.2.tgz", "integrity": "sha512-OYu7XEzjkCQ3C5Ps3QIZsQfNpqoJyZZA99wd9aWd05NCtC5pWOkShK2mkL6HXQR6/Cy2lbNdPlZBpuQHXE63gA==", - "dev": true + "devOptional": true }, "json-parse-even-better-errors": { "version": "2.3.1", @@ -14280,7 +14332,7 @@ "version": "2.1.2", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w==", - "dev": true + "devOptional": true }, "nanoid": { "version": "3.3.4", @@ -15513,7 +15565,7 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/to-fast-properties/-/to-fast-properties-2.0.0.tgz", "integrity": "sha512-/OaKK0xYrs3DmxRYqL/yDc+FxFUVYhDlXMhRmv3z915w2HF1tnN1omB354j8VUGO/hbRzyD6Y3sA7v7GS/ceog==", - "dev": true + "devOptional": true }, "to-regex-range": { "version": "5.0.1", diff --git a/package.json b/package.json index a1825bf..691f3af 100644 --- a/package.json +++ b/package.json @@ -27,6 +27,7 @@ "autoprefixer": "^10.4.13", "cuid": "^2.1.8", "graphql-request": "^5.0.0", + "jotai": "^1.9.0", "markdown-to-jsx": "^7.1.7", "next": "^12.3.1", "nodemailer": "^6.8.0", diff --git a/src/components/AnchorShare.tsx b/src/components/AnchorShare.tsx index 4e4dac9..6c19f7e 100644 --- a/src/components/AnchorShare.tsx +++ b/src/components/AnchorShare.tsx @@ -1,7 +1,8 @@ import { Ico, Icon } from "./Ico"; import { ToolTip } from "./ToolTip"; import { cJoin } from "helpers/className"; -import { useLocalData } from "contexts/LocalDataContext"; +import { useAtomGetter } from "helpers/atoms"; +import { atoms } from "contexts/atoms"; /* * ╭─────────────╮ @@ -16,7 +17,7 @@ interface Props { // ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ ─ export const AnchorShare = ({ id, className }: Props): JSX.Element => { - const { langui } = useLocalData(); + const langui = useAtomGetter(atoms.localData.langui); return ( diff --git a/src/components/AppLayout.tsx b/src/components/AppLayout.tsx index 6267d0b..efd932d 100644 --- a/src/components/AppLayout.tsx +++ b/src/components/AppLayout.tsx @@ -7,11 +7,10 @@ import { MainPanel } from "./Panels/MainPanel"; import { SafariPopup } from "./Panels/SafariPopup"; import { isDefined, isUndefined } from "helpers/others"; import { cIf, cJoin } from "helpers/className"; -import { useAppLayout } from "contexts/AppLayoutContext"; import { OpenGraph, TITLE_PREFIX, TITLE_SEPARATOR } from "helpers/openGraph"; import { Ids } from "types/ids"; -import { useLocalData } from "contexts/LocalDataContext"; -import { useContainerQueries } from "contexts/ContainerQueriesContext"; +import { atoms } from "contexts/atoms"; +import { useAtomGetter, useAtomPair } from "helpers/atoms"; /* * ╭─────────────╮ @@ -45,39 +44,34 @@ export const AppLayout = ({ subPanelIcon = Icon.Tune, contentPanelScroolbar = true, }: Props): JSX.Element => { - const { - mainPanelOpen, - mainPanelReduced, - menuGestures, - subPanelOpen, - setMainPanelOpen, - setSubPanelOpen, - toggleMainPanelOpen, - toggleSubPanelOpen, - } = useAppLayout(); + const isMainPanelReduced = useAtomGetter(atoms.layout.mainPanelReduced); + const [isSubPanelOpened, setSubPanelOpened] = useAtomPair(atoms.layout.subPanelOpened); + const [isMainPanelOpened, setMainPanelOpened] = useAtomPair(atoms.layout.mainPanelOpened); + const isMenuGesturesEnabled = useAtomGetter(atoms.layout.menuGesturesEnabled); - const { langui } = useLocalData(); + const langui = useAtomGetter(atoms.localData.langui); - const { is1ColumnLayout, isScreenAtLeastXs } = useContainerQueries(); + const is1ColumnLayout = useAtomGetter(atoms.containerQueries.is1ColumnLayout); + const isScreenAtLeastXs = useAtomGetter(atoms.containerQueries.isScreenAtLeastXs); const handlers = useSwipeable({ onSwipedLeft: (SwipeEventData) => { - if (menuGestures) { + if (isMenuGesturesEnabled) { if (SwipeEventData.velocity < SENSIBILITY_SWIPE) return; - if (mainPanelOpen) { - setMainPanelOpen(false); + if (isMainPanelOpened) { + setMainPanelOpened(false); } else if (isDefined(subPanel) && isDefined(contentPanel)) { - setSubPanelOpen(true); + setSubPanelOpened(true); } } }, onSwipedRight: (SwipeEventData) => { - if (menuGestures) { + if (isMenuGesturesEnabled) { if (SwipeEventData.velocity < SENSIBILITY_SWIPE) return; - if (subPanelOpen) { - setSubPanelOpen(false); + if (isSubPanelOpened) { + setSubPanelOpened(false); } else { - setMainPanelOpen(true); + setMainPanelOpened(true); } } }, @@ -99,7 +93,7 @@ export const AppLayout = ({ style={{ gridTemplateColumns: is1ColumnLayout ? "1fr" - : `${mainPanelReduced ? layout.mainMenuReduced : layout.mainMenu}rem ${ + : `${isMainPanelReduced ? layout.mainMenuReduced : layout.mainMenu}rem ${ isDefined(subPanel) ? layout.subMenu : 0 }rem 1fr`, }}> @@ -128,7 +122,7 @@ export const AppLayout = ({ `absolute inset-0 transition-filter duration-500 [grid-area:content]`, cIf( - (mainPanelOpen || subPanelOpen) && is1ColumnLayout, + (isMainPanelOpened || isSubPanelOpened) && is1ColumnLayout, "z-10 backdrop-blur", "pointer-events-none touch-none" ) @@ -136,11 +130,15 @@ export const AppLayout = ({
{ - setMainPanelOpen(false); - setSubPanelOpen(false); + setMainPanelOpened(false); + setSubPanelOpened(false); }} />
@@ -175,7 +173,7 @@ export const AppLayout = ({ "[grid-area:sub]" ), cIf(is1ColumnLayout && isScreenAtLeastXs, "w-[min(30rem,90%)] border-l"), - cIf(is1ColumnLayout && !subPanelOpen && !turnSubIntoContent, "translate-x-[100vw]"), + cIf(is1ColumnLayout && !isSubPanelOpened && !turnSubIntoContent, "translate-x-[100vw]"), cIf(is1ColumnLayout && turnSubIntoContent, "w-full border-l-0") )}> {subPanel} @@ -189,7 +187,7 @@ export const AppLayout = ({ transition-transform duration-300 scrollbar-none texture-paper-dots`, cIf(is1ColumnLayout, "justify-self-start [grid-area:content]", "[grid-area:main]"), cIf(is1ColumnLayout && isScreenAtLeastXs, "w-[min(30rem,90%)]"), - cIf(!mainPanelOpen && is1ColumnLayout, "-translate-x-full") + cIf(!isMainPanelOpened && is1ColumnLayout, "-translate-x-full") )}> @@ -202,11 +200,11 @@ export const AppLayout = ({ cIf(!is1ColumnLayout, "hidden") )}> { - toggleMainPanelOpen(); - setSubPanelOpen(false); + setMainPanelOpened((current) => !current); + setSubPanelOpened(false); }} />

{isDefined(subPanel) && !turnSubIntoContent && ( { - toggleSubPanelOpen(); - setMainPanelOpen(false); + setSubPanelOpened((current) => !current); + setMainPanelOpened(false); }} /> )} diff --git a/src/components/Cli/Terminal.tsx b/src/components/Cli/Terminal.tsx index ff72e3f..c28dda7 100644 --- a/src/components/Cli/Terminal.tsx +++ b/src/components/Cli/Terminal.tsx @@ -1,9 +1,9 @@ import { useCallback, useEffect, useMemo, useRef, useState } from "react"; import { useRouter } from "next/router"; import { cJoin, cIf } from "helpers/className"; -import { useTerminalContext } from "contexts/TerminalContext"; import { isDefined, isDefinedAndNotEmpty } from "helpers/others"; -import { useUserSettings } from "contexts/UserSettingsContext"; +import { atoms } from "contexts/atoms"; +import { useAtomSetter, useAtomPair } from "helpers/atoms"; /* * ╭─────────────╮ @@ -31,9 +31,11 @@ export const Terminal = ({ content, }: Props): JSX.Element => { const [childrenPaths, setChildrenPaths] = useState(propsChildrenPaths); - const { darkMode, setPlayerName } = useUserSettings(); - const { previousCommands, previousLines, setPreviousCommands, setPreviousLines } = - useTerminalContext(); + const setPlayerName = useAtomSetter(atoms.settings.playerName); + + const [previousCommands, setPreviousCommands] = useAtomPair(atoms.terminal.previousCommands); + const [previousLines, setPreviousLines] = useAtomPair(atoms.terminal.previousLines); + const [line, setLine] = useState(""); const [displayCurrentLine, setDisplayCurrentLine] = useState(true); const [previousCommandIndex, setPreviousCommandIndex] = useState(0); @@ -232,11 +234,7 @@ export const Terminal = ({ }, [line]); return ( -

+
diff --git a/src/components/Containers/ContentPanel.tsx b/src/components/Containers/ContentPanel.tsx index 954507b..add70a4 100644 --- a/src/components/Containers/ContentPanel.tsx +++ b/src/components/Containers/ContentPanel.tsx @@ -1,4 +1,5 @@ -import { useContainerQueries } from "contexts/ContainerQueriesContext"; +import { atoms } from "contexts/atoms"; +import { useAtomGetter } from "helpers/atoms"; import { cIf, cJoin } from "helpers/className"; /* @@ -25,7 +26,7 @@ export const ContentPanel = ({ children, className, }: Props): JSX.Element => { - const { isContentPanelAtLeast3xl } = useContainerQueries(); + const isContentPanelAtLeast3xl = useAtomGetter(atoms.containerQueries.isContentPanelAtLeast3xl); return (
{ - const { setMenuGestures } = useAppLayout(); + const setMenuGesturesEnabled = useAtomSetter(atoms.layout.menuGesturesEnabled); useHotkeys("escape", () => onCloseRequest?.(), {}, [onCloseRequest]); useEffect(() => { - setMenuGestures(!isVisible); - }, [setMenuGestures, isVisible]); + setMenuGesturesEnabled(!isVisible); + }, [isVisible, setMenuGesturesEnabled]); return (
{ - const { isSubPanelAtLeastXs } = useContainerQueries(); + const isSubPanelAtLeastXs = useAtomGetter(atoms.containerQueries.isSubPanelAtLeastXs); return (
{ - const { languages } = useLocalData(); + const languages = useAtomGetter(atoms.localData.languages); return ( { const { libraryItemUserStatus, setLibraryItemUserStatus } = useLibraryItemUserStatus(); - const { langui } = useLocalData(); + const langui = useAtomGetter(atoms.localData.langui); return (
void; @@ -138,7 +139,7 @@ const ControlButtons = ({ onCloseRequest, toggleFullscreen, }: ControlButtonsProps): JSX.Element => { - const { is1ColumnLayout } = useContainerQueries(); + const is1ColumnLayout = useAtomGetter(atoms.containerQueries.is1ColumnLayout); const PreviousButton = () => (
)} diff --git a/src/components/Panels/MainPanel.tsx b/src/components/Panels/MainPanel.tsx index 7c76c15..3d66c69 100644 --- a/src/components/Panels/MainPanel.tsx +++ b/src/components/Panels/MainPanel.tsx @@ -3,15 +3,14 @@ import { HorizontalLine } from "components/HorizontalLine"; import { Button } from "components/Inputs/Button"; import { NavOption } from "components/PanelComponents/NavOption"; import { ToolTip } from "components/ToolTip"; -import { useAppLayout } from "contexts/AppLayoutContext"; import { Icon } from "components/Ico"; import { cIf, cJoin } from "helpers/className"; import { isDefinedAndNotEmpty } from "helpers/others"; import { Link } from "components/Inputs/Link"; import { sendAnalytics } from "helpers/analytics"; -import { useLocalData } from "contexts/LocalDataContext"; import { ColoredSvg } from "components/ColoredSvg"; -import { useContainerQueries } from "contexts/ContainerQueriesContext"; +import { atoms } from "contexts/atoms"; +import { useAtomGetter, useAtomPair, useAtomSetter } from "helpers/atoms"; /* * ╭─────────────╮ @@ -19,34 +18,35 @@ import { useContainerQueries } from "contexts/ContainerQueriesContext"; */ export const MainPanel = (): JSX.Element => { - const { is3ColumnsLayout } = useContainerQueries(); - const { mainPanelReduced, toggleMainPanelReduced, setConfigPanelOpen } = useAppLayout(); - const { langui } = useLocalData(); + const is3ColumnsLayout = useAtomGetter(atoms.containerQueries.is3ColumnsLayout); + const langui = useAtomGetter(atoms.localData.langui); + const [isMainPanelReduced, setMainPanelReduced] = useAtomPair(atoms.layout.mainPanelReduced); + const setSettingsOpened = useAtomSetter(atoms.layout.settingsOpened); return (
{/* Reduce/expand main menu */} {is3ColumnsLayout && (
)} @@ -57,28 +57,28 @@ export const MainPanel = (): JSX.Element => { src="/icons/accords.svg" className={cJoin( "mb-4 aspect-square bg-black hover:bg-dark", - cIf(mainPanelReduced && is3ColumnsLayout, "w-12", "w-1/2") + cIf(isMainPanelReduced && is3ColumnsLayout, "w-12", "w-1/2") )} /> - {(!mainPanelReduced || !is3ColumnsLayout) && ( + {(!isMainPanelReduced || !is3ColumnsLayout) && (

Accord’s Library

)}
{langui.open_settings}} placement="right" className="text-left" - disabled={!mainPanelReduced}> + disabled={!isMainPanelReduced}>