diff --git a/package-lock.json b/package-lock.json index d01e8f4..7eaa899 100644 --- a/package-lock.json +++ b/package-lock.json @@ -18,7 +18,7 @@ "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "axios": "^1.4.0", - "ethers": "^6.6.0", + "ethers": "^5.7.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.8.0", @@ -38,11 +38,6 @@ "resolved": "https://registry.npmjs.org/@adobe/css-tools/-/css-tools-4.2.0.tgz", "integrity": "sha512-E09FiIft46CmH5Qnjb0wsW54/YQd69LsxeKUOWawmws1XWvyFGURnAChH0mlr7YPFR1ofwvUQfcL0J3lMxXqPA==" }, - "node_modules/@adraffy/ens-normalize": { - "version": "1.9.2", - "resolved": "https://registry.npmjs.org/@adraffy/ens-normalize/-/ens-normalize-1.9.2.tgz", - "integrity": "sha512-0h+FrQDqe2Wn+IIGFkTCd4aAwTJ+7834Ek1COohCyV26AXhwQ7WQaz+4F/nLOeVl/3BtWHOHLPsq46V8YB46Eg==" - }, "node_modules/@alloc/quick-lru": { "version": "5.2.0", "resolved": "https://registry.npmjs.org/@alloc/quick-lru/-/quick-lru-5.2.0.tgz", @@ -2624,6 +2619,677 @@ "node": "^12.22.0 || ^14.17.0 || >=16.0.0" } }, + "node_modules/@ethersproject/abi": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abi/-/abi-5.7.0.tgz", + "integrity": "sha512-351ktp42TiRcYB3H1OP8yajPeAQstMW/yCFokj/AthP9bLHzQFPlOrxOcwYEDkUAICmOHljvN4K39OMTMUa9RA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-provider": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-provider/-/abstract-provider-5.7.0.tgz", + "integrity": "sha512-R41c9UkchKCpAqStMYUpdunjo3pkEvZC3FAwZn5S5MGbXoMQOHIdHItezTETxAO5bevtMApSyEhn9+CHcDsWBw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0" + } + }, + "node_modules/@ethersproject/abstract-signer": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/abstract-signer/-/abstract-signer-5.7.0.tgz", + "integrity": "sha512-a16V8bq1/Cz+TGCkE2OPMTOUDLS3grCpdjoJCYNnVBbdYEMSgKrU0+B90s8b6H+ByYTBZN7a3g76jdIJi7UfKQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/address": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/address/-/address-5.7.0.tgz", + "integrity": "sha512-9wYhYt7aghVGo758POM5nqcOMaE168Q6aRLJZwUmiqSrAungkG74gSSeKEIR7ukixesdRZGPgVqme6vmxs1fkA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/rlp": "^5.7.0" + } + }, + "node_modules/@ethersproject/base64": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/base64/-/base64-5.7.0.tgz", + "integrity": "sha512-Dr8tcHt2mEbsZr/mwTPIQAf3Ai0Bks/7gTw9dSqk1mQvhW3XvRlmDJr/4n+wg1JmCl16NZue17CDh8xb/vZ0sQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0" + } + }, + "node_modules/@ethersproject/basex": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/basex/-/basex-5.7.0.tgz", + "integrity": "sha512-ywlh43GwZLv2Voc2gQVTKBoVQ1mti3d8HK5aMxsfu/nRDnMmNqaSJ3r3n85HBByT8OpoY96SXM1FogC533T4zw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/properties": "^5.7.0" + } + }, + "node_modules/@ethersproject/bignumber": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bignumber/-/bignumber-5.7.0.tgz", + "integrity": "sha512-n1CAdIHRWjSucQO3MC1zPSVgV/6dy/fjL9pMrPP9peL+QxEg9wOsVqwD4+818B6LUEtaXzVHQiuivzRoxPxUGw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "bn.js": "^5.2.1" + } + }, + "node_modules/@ethersproject/bytes": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/bytes/-/bytes-5.7.0.tgz", + "integrity": "sha512-nsbxwgFXWh9NyYWo+U8atvmMsSdKJprTcICAkvbBffT75qDocbuggBU0SJiVK2MuTrp0q+xvLkTnGMPK1+uA9A==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/constants": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/constants/-/constants-5.7.0.tgz", + "integrity": "sha512-DHI+y5dBNvkpYUMiRQyxRBYBefZkJfo70VUkUAsRjcPs47muV9evftfZ0PJVCXYbAiCgght0DtcF9srFQmIgWA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0" + } + }, + "node_modules/@ethersproject/contracts": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/contracts/-/contracts-5.7.0.tgz", + "integrity": "sha512-5GJbzEU3X+d33CdfPhcyS+z8MzsTrBGk/sc+G+59+tPa9yFkl6HQ9D6L0QMgNTA9q8dT0XKxxkyp883XsQvbbg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abi": "^5.7.0", + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/transactions": "^5.7.0" + } + }, + "node_modules/@ethersproject/hash": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hash/-/hash-5.7.0.tgz", + "integrity": "sha512-qX5WrQfnah1EFnO5zJv1v46a8HW0+E5xuBBDTwMFZLuVTx0tbU2kkx15NqdjxecrLGatQN9FGQKpb1FKdHCt+g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/hdnode": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/hdnode/-/hdnode-5.7.0.tgz", + "integrity": "sha512-OmyYo9EENBPPf4ERhR7oj6uAtUAhYGqOnIS+jE5pTXvdKBS99ikzq1E7Iv0ZQZ5V36Lqx1qZLeak0Ra16qpeOg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/json-wallets": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/json-wallets/-/json-wallets-5.7.0.tgz", + "integrity": "sha512-8oee5Xgu6+RKgJTkvEMl2wDgSPSAQ9MB/3JYjFV9jlKvcYHUXZC+cQp0njgmxdHkYWn8s6/IqIZYm0YWCjO/0g==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/pbkdf2": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "aes-js": "3.0.0", + "scrypt-js": "3.0.1" + } + }, + "node_modules/@ethersproject/keccak256": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/keccak256/-/keccak256-5.7.0.tgz", + "integrity": "sha512-2UcPboeL/iW+pSg6vZ6ydF8tCnv3Iu/8tUmLLzWWGzxWKFFqOBQFLo6uLUv6BDrLgCDfN28RJ/wtByx+jZ4KBg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "js-sha3": "0.8.0" + } + }, + "node_modules/@ethersproject/logger": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/logger/-/logger-5.7.0.tgz", + "integrity": "sha512-0odtFdXu/XHtjQXJYA3u9G0G8btm0ND5Cu8M7i5vhEcE8/HmF4Lbdqanwyv4uQTr2tx6b7fQRmgLrsnpQlmnig==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ] + }, + "node_modules/@ethersproject/networks": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/networks/-/networks-5.7.1.tgz", + "integrity": "sha512-n/MufjFYv3yFcUyfhnXotyDlNdFb7onmkSy8aQERi2PjNcnWQ66xXxa3XlS8nCcA8aJKJjIIMNJTC7tu80GwpQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/pbkdf2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/pbkdf2/-/pbkdf2-5.7.0.tgz", + "integrity": "sha512-oR/dBRZR6GTyaofd86DehG72hY6NpAjhabkhxgr3X2FpJtJuodEl2auADWBZfhDHgVCbu3/H/Ocq2uC6dpNjjw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/sha2": "^5.7.0" + } + }, + "node_modules/@ethersproject/properties": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/properties/-/properties-5.7.0.tgz", + "integrity": "sha512-J87jy8suntrAkIZtecpxEPxY//szqr1mlBaYlQ0r4RCaiD2hjheqF9s1LVE8vVuJCXisjIP+JgtK/Do54ej4Sw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/providers": { + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/@ethersproject/providers/-/providers-5.7.2.tgz", + "integrity": "sha512-g34EWZ1WWAVgr4aptGlVBF8mhl3VWjv+8hoAnzStu8Ah22VHBsuGzP17eb6xDVRzw895G4W7vvx60lFFur/1Rg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/base64": "^5.7.0", + "@ethersproject/basex": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/networks": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/web": "^5.7.0", + "bech32": "1.1.4", + "ws": "7.4.6" + } + }, + "node_modules/@ethersproject/random": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/random/-/random-5.7.0.tgz", + "integrity": "sha512-19WjScqRA8IIeWclFme75VMXSBvi4e6InrUNuaR4s5pTF2qNhcGdCUwdxUVGtDDqC00sDLCO93jPQoDUH4HVmQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/rlp": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/rlp/-/rlp-5.7.0.tgz", + "integrity": "sha512-rBxzX2vK8mVF7b0Tol44t5Tb8gomOHkj5guL+HhzQ1yBh/ydjGnpw6at+X6Iw0Kp3OzzzkcKp8N9r0W4kYSs9w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/sha2": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/sha2/-/sha2-5.7.0.tgz", + "integrity": "sha512-gKlH42riwb3KYp0reLsFTokByAKoJdgFCwI+CCiX/k+Jm2mbNs6oOaCjYQSlI1+XBVejwH2KrmCbMAT/GnRDQw==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/signing-key": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/signing-key/-/signing-key-5.7.0.tgz", + "integrity": "sha512-MZdy2nL3wO0u7gkB4nA/pEf8lu1TlFswPNmy8AiYkfKTdO6eXBJyUdmHO/ehm/htHw9K/qF8ujnTyUAD+Ry54Q==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "bn.js": "^5.2.1", + "elliptic": "6.5.4", + "hash.js": "1.1.7" + } + }, + "node_modules/@ethersproject/solidity": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/solidity/-/solidity-5.7.0.tgz", + "integrity": "sha512-HmabMd2Dt/raavyaGukF4XxizWKhKQ24DoLtdNbBmNKUOPqwjsKQSdV9GQtj9CBEea9DlzETlVER1gYeXXBGaA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/sha2": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/strings": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/strings/-/strings-5.7.0.tgz", + "integrity": "sha512-/9nu+lj0YswRNSH0NXYqrh8775XNyEdUQAuf3f+SmOrnVewcJ5SBNAjF7lpgehKi4abvNNXyf+HX86czCdJ8Mg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/transactions": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/transactions/-/transactions-5.7.0.tgz", + "integrity": "sha512-kmcNicCp1lp8qanMTC3RIikGgoJ80ztTyvtsFvCYpSCfkjhD0jZ2LOrnbcuxuToLIUYYf+4XwD1rP+B/erDIhQ==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/rlp": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0" + } + }, + "node_modules/@ethersproject/units": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/units/-/units-5.7.0.tgz", + "integrity": "sha512-pD3xLMy3SJu9kG5xDGI7+xhTEmGXlEqXU4OfNapmfnxLVY4EMSSRp7j1k7eezutBPH7RBN/7QPnwR7hzNlEFeg==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/constants": "^5.7.0", + "@ethersproject/logger": "^5.7.0" + } + }, + "node_modules/@ethersproject/wallet": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wallet/-/wallet-5.7.0.tgz", + "integrity": "sha512-MhmXlJXEJFBFVKrDLB4ZdDzxcBxQ3rLyCkhNqVu3CDYvR97E+8r01UgrI+TI99Le+aYm/in/0vp86guJuM7FCA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/abstract-provider": "^5.7.0", + "@ethersproject/abstract-signer": "^5.7.0", + "@ethersproject/address": "^5.7.0", + "@ethersproject/bignumber": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/hdnode": "^5.7.0", + "@ethersproject/json-wallets": "^5.7.0", + "@ethersproject/keccak256": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/random": "^5.7.0", + "@ethersproject/signing-key": "^5.7.0", + "@ethersproject/transactions": "^5.7.0", + "@ethersproject/wordlists": "^5.7.0" + } + }, + "node_modules/@ethersproject/web": { + "version": "5.7.1", + "resolved": "https://registry.npmjs.org/@ethersproject/web/-/web-5.7.1.tgz", + "integrity": "sha512-Gueu8lSvyjBWL4cYsWsjh6MtMwM0+H4HvqFPZfB6dV8ctbP9zFAO73VG1cMWae0FLPCtz0peKPpZY8/ugJJX2w==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/base64": "^5.7.0", + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, + "node_modules/@ethersproject/wordlists": { + "version": "5.7.0", + "resolved": "https://registry.npmjs.org/@ethersproject/wordlists/-/wordlists-5.7.0.tgz", + "integrity": "sha512-S2TFNJNfHWVHNE6cNDjbVlZ6MgE17MIxMbMg2zv3wn+3XSJGosL1m9ZVv3GXCf/2ymSsQ+hRI5IzoMJTG6aoVA==", + "funding": [ + { + "type": "individual", + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" + }, + { + "type": "individual", + "url": "https://www.buymeacoffee.com/ricmoo" + } + ], + "dependencies": { + "@ethersproject/bytes": "^5.7.0", + "@ethersproject/hash": "^5.7.0", + "@ethersproject/logger": "^5.7.0", + "@ethersproject/properties": "^5.7.0", + "@ethersproject/strings": "^5.7.0" + } + }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.10", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.10.tgz", @@ -3824,28 +4490,6 @@ "node": ">=4.0" } }, - "node_modules/@noble/hashes": { - "version": "1.1.2", - "resolved": "https://registry.npmjs.org/@noble/hashes/-/hashes-1.1.2.tgz", - "integrity": "sha512-KYRCASVTv6aeUi1tsF8/vpyR7zpfs3FUzy2Jqm+MU+LmUKhQ0y2FpfwqkCcxSg2ua4GALJd8k2R76WxwZGbQpA==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, - "node_modules/@noble/secp256k1": { - "version": "1.7.1", - "resolved": "https://registry.npmjs.org/@noble/secp256k1/-/secp256k1-1.7.1.tgz", - "integrity": "sha512-hOUk6AyBFmqVrv7k5WAw/LpszxVbj9gGN4JRkIX52fdFAj1UA61KXmZDvqVEm+pOyec3+fIeZB02LYa/pWOArw==", - "funding": [ - { - "type": "individual", - "url": "https://paulmillr.com/funding/" - } - ] - }, "node_modules/@nodelib/fs.scandir": { "version": "2.1.5", "resolved": "https://registry.npmjs.org/@nodelib/fs.scandir/-/fs.scandir-2.1.5.tgz", @@ -5229,9 +5873,9 @@ } }, "node_modules/aes-js": { - "version": "4.0.0-beta.5", - "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-4.0.0-beta.5.tgz", - "integrity": "sha512-G965FqalsNyrPqgEGON7nIx1e/OVENSgiEIzyC63haUMuvNnwIgIjMs52hlTCKhkBny7A2ORNlfY9Zu+jmGk1Q==" + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/aes-js/-/aes-js-3.0.0.tgz", + "integrity": "sha512-H7wUZRn8WpTq9jocdxQ2c8x2sKo9ZVmzfRE13GiNJXfp7NcKYEdvl3vspKjXox6RIG2VtaRe4JFvxG4rqp2Zuw==" }, "node_modules/agent-base": { "version": "6.0.2", @@ -5861,6 +6505,11 @@ "resolved": "https://registry.npmjs.org/batch/-/batch-0.6.1.tgz", "integrity": "sha512-x+VAiMRL6UPkx+kudNvxTl6hB2XNNCG2r+7wixVfIYwu/2HKRXimwQyaumLjMveWvT2Hkd/cAJw+QBMfJ/EKVw==" }, + "node_modules/bech32": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/bech32/-/bech32-1.1.4.tgz", + "integrity": "sha512-s0IrSOzLlbvX7yp4WBfPITzpAU8sqQcpsmwXDiKwrG4r491vwCO/XpejasRNl0piBMe/DvP4Tz0mIS/X1DPJBQ==" + }, "node_modules/bfj": { "version": "7.0.2", "resolved": "https://registry.npmjs.org/bfj/-/bfj-7.0.2.tgz", @@ -5896,6 +6545,11 @@ "resolved": "https://registry.npmjs.org/bluebird/-/bluebird-3.7.2.tgz", "integrity": "sha512-XpNj6GDQzdfW+r2Wnn7xiSAd7TM3jzkxGXBGTtWKuSXv1xUV+azxAm8jdWZN06QTQk+2N2XB9jRDkvbmQmcRtg==" }, + "node_modules/bn.js": { + "version": "5.2.1", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-5.2.1.tgz", + "integrity": "sha512-eXRvHzWyYPBuB4NBy0cmYQjGitUrtqwbvlzP3G6VFnNRbsZQIxQ10PbKKHt8gZ/HW/D/747aDl+QkDqg3KQLMQ==" + }, "node_modules/body-parser": { "version": "1.20.1", "resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.20.1.tgz", @@ -5987,6 +6641,11 @@ "node": ">=8" } }, + "node_modules/brorand": { + "version": "1.1.0", + "resolved": "https://registry.npmjs.org/brorand/-/brorand-1.1.0.tgz", + "integrity": "sha512-cKV8tMCEpQs4hK/ik71d6LrPOnpkpGBR0wzxqr68g2m/LB2GxVYQroAjMJZRVM1Y4BCjCKc3vAamxSzOY2RP+w==" + }, "node_modules/browser-process-hrtime": { "version": "1.0.0", "resolved": "https://registry.npmjs.org/browser-process-hrtime/-/browser-process-hrtime-1.0.0.tgz", @@ -7421,6 +8080,25 @@ "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.4.433.tgz", "integrity": "sha512-MGO1k0w1RgrfdbLVwmXcDhHHuxCn2qRgR7dYsJvWFKDttvYPx6FNzCGG0c/fBBvzK2LDh3UV7Tt9awnHnvAAUQ==" }, + "node_modules/elliptic": { + "version": "6.5.4", + "resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz", + "integrity": "sha512-iLhC6ULemrljPZb+QutR5TQGB+pdW6KGD5RSegS+8sorOZT+rdQFbsQFJgvN3eRqNALqJer4oQ16YvJHlU8hzQ==", + "dependencies": { + "bn.js": "^4.11.9", + "brorand": "^1.1.0", + "hash.js": "^1.0.0", + "hmac-drbg": "^1.0.1", + "inherits": "^2.0.4", + "minimalistic-assert": "^1.0.1", + "minimalistic-crypto-utils": "^1.0.1" + } + }, + "node_modules/elliptic/node_modules/bn.js": { + "version": "4.12.0", + "resolved": "https://registry.npmjs.org/bn.js/-/bn.js-4.12.0.tgz", + "integrity": "sha512-c98Bf3tPniI+scsdk237ku1Dc3ujXQTSgyiPUDEOe7tRkhrqridvh8klBv0HCEso1OLOYcHuCv/cS6DNxKH+ZA==" + }, "node_modules/emittery": { "version": "0.8.1", "resolved": "https://registry.npmjs.org/emittery/-/emittery-0.8.1.tgz", @@ -8294,13 +8972,13 @@ } }, "node_modules/ethers": { - "version": "6.6.0", - "resolved": "https://registry.npmjs.org/ethers/-/ethers-6.6.0.tgz", - "integrity": "sha512-7D2U+n8eZYmh592VZqap9vBu50jN7YUDHqAmwBYTMntmUKC9RVgcqcFbd+3DTCOQ1jMyK6QHv1usbcfgiGaHOA==", + "version": "5.7.2", + "resolved": "https://registry.npmjs.org/ethers/-/ethers-5.7.2.tgz", + "integrity": "sha512-wswUsmWo1aOK8rR7DIKiWSw9DbLWe6x98Jrn8wcTflTVvaXhAMaB5zGAXy0GYQEQp9iO1iSHWVyARQm11zUtyg==", "funding": [ { "type": "individual", - "url": "https://github.com/sponsors/ethers-io/" + "url": "https://gitcoin.co/grants/13/ethersjs-complete-simple-and-tiny-2" }, { "type": "individual", @@ -8308,16 +8986,36 @@ } ], "dependencies": { - "@adraffy/ens-normalize": "1.9.2", - "@noble/hashes": "1.1.2", - "@noble/secp256k1": "1.7.1", - "@types/node": "18.15.13", - "aes-js": "4.0.0-beta.5", - "tslib": "2.4.0", - "ws": "8.5.0" - }, - "engines": { - "node": ">=14.0.0" + "@ethersproject/abi": "5.7.0", + "@ethersproject/abstract-provider": "5.7.0", + "@ethersproject/abstract-signer": "5.7.0", + "@ethersproject/address": "5.7.0", + "@ethersproject/base64": "5.7.0", + "@ethersproject/basex": "5.7.0", + "@ethersproject/bignumber": "5.7.0", + "@ethersproject/bytes": "5.7.0", + "@ethersproject/constants": "5.7.0", + "@ethersproject/contracts": "5.7.0", + "@ethersproject/hash": "5.7.0", + "@ethersproject/hdnode": "5.7.0", + "@ethersproject/json-wallets": "5.7.0", + "@ethersproject/keccak256": "5.7.0", + "@ethersproject/logger": "5.7.0", + "@ethersproject/networks": "5.7.1", + "@ethersproject/pbkdf2": "5.7.0", + "@ethersproject/properties": "5.7.0", + "@ethersproject/providers": "5.7.2", + "@ethersproject/random": "5.7.0", + "@ethersproject/rlp": "5.7.0", + "@ethersproject/sha2": "5.7.0", + "@ethersproject/signing-key": "5.7.0", + "@ethersproject/solidity": "5.7.0", + "@ethersproject/strings": "5.7.0", + "@ethersproject/transactions": "5.7.0", + "@ethersproject/units": "5.7.0", + "@ethersproject/wallet": "5.7.0", + "@ethersproject/web": "5.7.1", + "@ethersproject/wordlists": "5.7.0" } }, "node_modules/eventemitter3": { @@ -9194,6 +9892,15 @@ "url": "https://github.com/sponsors/ljharb" } }, + "node_modules/hash.js": { + "version": "1.1.7", + "resolved": "https://registry.npmjs.org/hash.js/-/hash.js-1.1.7.tgz", + "integrity": "sha512-taOaskGt4z4SOANNseOviYDvjEJinIkRgmp7LbKP2YTTmVxWBl87s/uzK9r+44BclBSp2X7K1hqeNfz9JbBeXA==", + "dependencies": { + "inherits": "^2.0.3", + "minimalistic-assert": "^1.0.1" + } + }, "node_modules/he": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/he/-/he-1.2.0.tgz", @@ -9202,6 +9909,16 @@ "he": "bin/he" } }, + "node_modules/hmac-drbg": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/hmac-drbg/-/hmac-drbg-1.0.1.tgz", + "integrity": "sha512-Tti3gMqLdZfhOQY1Mzf/AanLiqh1WTiJgEj26ZuYQ9fbkLomzGchCws4FyrSd4VkpBfiNhaE1On+lOz894jvXg==", + "dependencies": { + "hash.js": "^1.0.3", + "minimalistic-assert": "^1.0.0", + "minimalistic-crypto-utils": "^1.0.1" + } + }, "node_modules/hoist-non-react-statics": { "version": "3.3.2", "resolved": "https://registry.npmjs.org/hoist-non-react-statics/-/hoist-non-react-statics-3.3.2.tgz", @@ -11932,6 +12649,11 @@ "jiti": "bin/jiti.js" } }, + "node_modules/js-sha3": { + "version": "0.8.0", + "resolved": "https://registry.npmjs.org/js-sha3/-/js-sha3-0.8.0.tgz", + "integrity": "sha512-gF1cRrHhIzNfToc802P800N8PpXS+evLLXfsVpowqmAFR9uwbi89WvXg2QspOmXL8QL86J4T1EpFu+yUkwJY3Q==" + }, "node_modules/js-tokens": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/js-tokens/-/js-tokens-4.0.0.tgz", @@ -12579,6 +13301,11 @@ "resolved": "https://registry.npmjs.org/minimalistic-assert/-/minimalistic-assert-1.0.1.tgz", "integrity": "sha512-UtJcAD4yEaGtjPezWuO9wC4nwUnVH/8/Im3yEHQP4b67cXlD/Qr9hdITCU1xDbSEXg2XKNaP8jsReV7vQd00/A==" }, + "node_modules/minimalistic-crypto-utils": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/minimalistic-crypto-utils/-/minimalistic-crypto-utils-1.0.1.tgz", + "integrity": "sha512-JIYlbt6g8i5jKfJ3xz7rF0LXmv2TkDxBLUkiBeZ7bAx4GnnNMr8xFpGnOxn6GhTEHx3SjRrZEoU+j04prX1ktg==" + }, "node_modules/minimatch": { "version": "3.1.2", "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", @@ -15465,6 +16192,11 @@ "url": "https://opencollective.com/webpack" } }, + "node_modules/scrypt-js": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/scrypt-js/-/scrypt-js-3.0.1.tgz", + "integrity": "sha512-cdwTTnqPu0Hyvf5in5asVdZocVDTNRmR7XEcJuIzMjJeSHybHl7vpB66AzwTaIg6CLSbtjcxc8fqcySfnTkccA==" + }, "node_modules/select-hose": { "version": "2.0.0", "resolved": "https://registry.npmjs.org/select-hose/-/select-hose-2.0.0.tgz", @@ -17823,11 +18555,11 @@ } }, "node_modules/ws": { - "version": "8.5.0", - "resolved": "https://registry.npmjs.org/ws/-/ws-8.5.0.tgz", - "integrity": "sha512-BWX0SWVgLPzYwF8lTzEy1egjhS4S4OEAHfsO8o65WOVsrnSRGaSiUaa9e0ggGlkMTtBlmOpEXiie9RUcBO86qg==", + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/ws/-/ws-7.4.6.tgz", + "integrity": "sha512-YmhHDO4MzaDLB+M9ym/mDA5z0naX8j7SIlT8f8z+I0VtzsRbekxEutHSme7NPS2qE8StCYQNUnfWdXta/Yu85A==", "engines": { - "node": ">=10.0.0" + "node": ">=8.3.0" }, "peerDependencies": { "bufferutil": "^4.0.1", diff --git a/package.json b/package.json index 3257a31..c768412 100644 --- a/package.json +++ b/package.json @@ -13,7 +13,7 @@ "@testing-library/react": "^13.4.0", "@testing-library/user-event": "^13.5.0", "axios": "^1.4.0", - "ethers": "^6.6.0", + "ethers": "^5.7.2", "react": "^18.2.0", "react-dom": "^18.2.0", "react-icons": "^4.8.0", diff --git a/src/App.js b/src/App.js index aff9870..6536c35 100644 --- a/src/App.js +++ b/src/App.js @@ -10,12 +10,14 @@ import Register from "./pages/Register"; import Login from "./pages/Login"; import DashboardLayout from "./components/DashboardLayout"; import ViewMedicalRecords from "./pages/ViewMedicalRecords"; -import ViewOtherRecords from "./pages/ViewOtherRecords"; +import MyRecords from "./pages/MyRecords"; import ConnectWalletDr from "./pages/ConnectWalletDr"; import ManageAccess from "./containers/ManageAccess/ManageAccess"; import { ToastContainer } from "react-toastify"; import "react-toastify/dist/ReactToastify.css"; import ConnectWallets from "./pages/ConnectWallet"; +import AuthorizedAddresses from "./pages/AuthorizedAddresses"; +import GetAllInfo from "./pages/GetAllInfo"; const App = () => { return ( @@ -35,13 +37,18 @@ const App = () => { } /> } /> } /> + } /> }> } /> - } /> + } /> } /> + } + /> diff --git a/src/api/auth.js b/src/api/auth.js index 3edaa1e..55cc23a 100644 --- a/src/api/auth.js +++ b/src/api/auth.js @@ -6,8 +6,8 @@ export const signUp = async (userDataObj) => { return response; }; -export const logIN = async () => { - const response = await request.post("/user/login"); +export const logIn = async (logInObj) => { + const response = await request.post("/user/login", logInObj); return response; }; diff --git a/src/api/dashboard.js b/src/api/dashboard.js new file mode 100644 index 0000000..f869234 --- /dev/null +++ b/src/api/dashboard.js @@ -0,0 +1,10 @@ +import request from "./request"; + +export const allergy = async (allergyDetail) => { + const response = await request.post( + "https://fakestoreapi.com/products/1", + allergyDetail + ); + + return response; +}; diff --git a/src/assets/Welcome2.png b/src/assets/Welcome2.png new file mode 100644 index 0000000..5b14000 Binary files /dev/null and b/src/assets/Welcome2.png differ diff --git a/src/components/Allergies.js b/src/components/Allergies.js index 36ee32c..973b0aa 100644 --- a/src/components/Allergies.js +++ b/src/components/Allergies.js @@ -2,9 +2,12 @@ import React, { useState } from "react"; import AllergyModal from "../components/AllergyModal"; import no_records from "../images/no_record.png"; import entry from "../images/entry.png"; +import { useSnapshot } from "valtio"; +import store from "../store/Index"; const Allergies = () => { const [show, setShow] = useState(false); + const snap = useSnapshot(store); return (
@@ -12,7 +15,7 @@ const Allergies = () => {
-

No Record Yet

+

{snap.allergyData}

setShow(true)}> diff --git a/src/components/AllergyModal.js b/src/components/AllergyModal.js index 44175d9..4552d48 100644 --- a/src/components/AllergyModal.js +++ b/src/components/AllergyModal.js @@ -1,9 +1,58 @@ -import React from "react"; +import React, { useState } from "react"; +import { ethers, BigNumber } from 'ethers'; +import contractABI from "./contractABI.json"; + const AllergyModal = (props) => { + const [allergyDetails, setAllergyDetails] = useState({ + allergyName: "", + description: "", + startDate: "", + medication: "", + }); + const contractAddress = '0x8084B71fd847053621f36a3A87DDC885f45A467D'; + const contractAbi = contractABI; + const provider = new ethers.providers.Web3Provider(window.ethereum); + const signer = provider.getSigner(); + + if (!props.show) { return null; } + + + + const addAllergy = async () => { + try { + const contract = new ethers.Contract(contractAddress, contractAbi, signer); + const { allergyName, description, startDate, medication } = allergyDetails; + + const startDateValue = BigNumber.from(Date.parse(startDate) / 1000); + await contract.addAllergy(allergyName, description, startDateValue, medication); + + setAllergyDetails({ + allergyName: "", + description: "", + startDate: "", + medication: "", + }); + + alert("Allergy added successfully!"); + + props.onClose(); + } catch (error) { + console.error("Error adding allergy:", error); + alert("Error adding allergy. Please try again."); + } + }; + + const handleInputChange = (e) => { + setAllergyDetails({ + ...allergyDetails, + [e.target.name]: e.target.value, + }); + }; + return (
e.stopPropagation()}> @@ -11,31 +60,42 @@ const AllergyModal = (props) => {

Add Allergy

-

Allergy Type

-
- -
- -

Diagnosed date

- - - - +

Allergy Name

+ +

Description

+ +

Start Date

+ +

Medication

+
- + diff --git a/src/components/DashboardLayout.js b/src/components/DashboardLayout.js index 0963510..1a4d9cf 100644 --- a/src/components/DashboardLayout.js +++ b/src/components/DashboardLayout.js @@ -1,16 +1,10 @@ -import React, { useEffect } from "react"; +import React from "react"; import "../css/styles.css"; import SideBar from "../components/SideBar"; +import { Outlet } from "react-router-dom"; import Navbar from "../components/NavBar"; -import { Outlet, useNavigate } from "react-router-dom"; const DashboardLayout = () => { - const navigate = useNavigate(); - useEffect(() => { - // navigate("/connectwallet"); - // eslint-disable-next-line react-hooks/exhaustive-deps - }, []); - return (
diff --git a/src/components/DisabilitiesModal.js b/src/components/DisabilitiesModal.js index 156a78b..b741169 100644 --- a/src/components/DisabilitiesModal.js +++ b/src/components/DisabilitiesModal.js @@ -1,9 +1,52 @@ -import React from "react"; +import React, { useState } from "react"; +import { ethers } from "ethers"; +import contractAbi from "./contractABI.json"; + +const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; +const contractABI = contractAbi; +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = provider.getSigner(); +const contract = new ethers.Contract(contractAddress, contractABI, signer); const DisabilitiesModal = (props) => { + const [errorMessage, setErrorMessage] = useState(""); + + const handleAddDisability = async () => { + try { + const disability = document.getElementById("disabilityInput").value; + const diagnosisDateInput = + document.getElementById("diagnosisDateInput").value; + const description = document.getElementById("descriptionInput").value; + const medication = document.getElementById("medicationInput").value; + + // Convert diagnosisDate to a Unix timestamp + const diagnosisDate = new Date(diagnosisDateInput).getTime() / 2000; + + await contract.addDisability( + disability, + diagnosisDate, + description, + medication + ); + + document.getElementById("disabilityInput").value = ""; + document.getElementById("diagnosisDateInput").value = ""; + document.getElementById("descriptionInput").value = ""; + document.getElementById("medicationInput").value = ""; + + props.onClose(); + } catch (error) { + console.error("Error adding disability:", error); + setErrorMessage( + "An error occurred while adding the disability. Please try again." + ); + } + }; + if (!props.show) { return null; } + return (
e.stopPropagation()}> @@ -11,20 +54,26 @@ const DisabilitiesModal = (props) => {

Add Disability

-

Disability Type

- -

Learning Disability

-

Diagnosed date

- - - +

Disability

+ +

Diagnosis date

+ +

Description

+ +

Medication

+
- +
+ {errorMessage &&

{errorMessage}

}
); diff --git a/src/components/InfoSection.js b/src/components/InfoSection.js new file mode 100644 index 0000000..b6971e4 --- /dev/null +++ b/src/components/InfoSection.js @@ -0,0 +1,21 @@ +import React from "react"; + +const InfoSection = () => { + return ( +
+
+

Blood Group

+ +
+
+

Genotype

+ +

Weight (kg)

+ +
+ +
+ ); +}; + +export default InfoSection; diff --git a/src/components/MyRecordAllergies.js b/src/components/MyRecordAllergies.js new file mode 100644 index 0000000..bd944a5 --- /dev/null +++ b/src/components/MyRecordAllergies.js @@ -0,0 +1,17 @@ +import no_records from "../images/no_record.png"; + +const MyRecordAllergies = () => { + return ( + <> +

Allergies

+ +
+ +

No Record Yet

+
+
+ + ); +}; + +export default MyRecordAllergies; diff --git a/src/components/MyRecordDisabilities.js b/src/components/MyRecordDisabilities.js new file mode 100644 index 0000000..9ea8a4b --- /dev/null +++ b/src/components/MyRecordDisabilities.js @@ -0,0 +1,72 @@ +import React, { useState, useEffect } from "react"; +import no_records from "../images/no_record.png"; +import { ethers } from "ethers"; +import contractAbi from "./contractABI.json"; + +const GetDisability = () => { + const [disability, setDisability] = useState(null); + const [diagnosisDate, setDiagnosisDate] = useState(null); + const [description, setDescription] = useState(null); + const [medication, setMedication] = useState(null); + const [patientAddress, setPatientAddress] = useState(null); + + const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; + const contractABI = contractAbi; + const provider = new ethers.providers.Web3Provider(window.ethereum); + const signer = provider.getSigner(); + const contract = new ethers.Contract(contractAddress, contractABI, signer); + + useEffect(() => { + const fetchPatientAddress = async () => { + try { + const accounts = await window.ethereum.request({ + method: "eth_requestAccounts", + }); + const address = accounts[0]; + setPatientAddress(address); + } catch (error) { + console.error("Error fetching patient address:", error); + } + }; + + fetchPatientAddress(); + }, []); + + const handleClick = async () => { + try { + const fetchedData = await contract.getDisability(patientAddress); + const [disability, diagnosisDate, description, medication] = fetchedData; + setDisability(disability); + setDiagnosisDate(diagnosisDate.toNumber()); + setDescription(description); + setMedication(medication); + } catch (error) { + console.error("Error retrieving disability:", error); + } + }; + + return ( + <> +

Disabilities

+
+ {disability ? ( +
+ +

Disability: {disability}

+

Diagnosis Date: {diagnosisDate}

+

Description: {description}

+

Medication: {medication}

+
+ ) : ( + <> + +

No Record Yet

+ + )} +
+ + + ); +}; + +export default GetDisability; diff --git a/src/components/MyRecordOtherInformation.js b/src/components/MyRecordOtherInformation.js new file mode 100644 index 0000000..cca1f68 --- /dev/null +++ b/src/components/MyRecordOtherInformation.js @@ -0,0 +1,18 @@ +import React from "react"; +import no_records from "../images/no_record.png"; + +const MyRecordOtherInformation = () => { + return ( + <> +

Other Informations

+ +
+ +

No Record Yet

+
+
+ + ); +}; + +export default MyRecordOtherInformation; diff --git a/src/components/MyRecordsBloodGroup.js b/src/components/MyRecordsBloodGroup.js new file mode 100644 index 0000000..e560ca1 --- /dev/null +++ b/src/components/MyRecordsBloodGroup.js @@ -0,0 +1,12 @@ +import React from "react"; + +const MyRecordsBloodGroup = () => { + return ( +
+

Blood Group

+ +
+ ); +}; + +export default MyRecordsBloodGroup; diff --git a/src/components/MyRecordsGenotype.js b/src/components/MyRecordsGenotype.js new file mode 100644 index 0000000..5c546e4 --- /dev/null +++ b/src/components/MyRecordsGenotype.js @@ -0,0 +1,12 @@ +import React from "react"; + +const MyRecordsGenotype = () => { + return ( +
+

Genotype

+ +
+ ); +}; + +export default MyRecordsGenotype; diff --git a/src/components/MyRecordsWeight.js b/src/components/MyRecordsWeight.js new file mode 100644 index 0000000..0396b61 --- /dev/null +++ b/src/components/MyRecordsWeight.js @@ -0,0 +1,12 @@ +import React from "react"; + +const MyRecordsWeight = () => { + return ( +
+

Weight (kg)

+ +
+ ); +}; + +export default MyRecordsWeight; diff --git a/src/components/NavBar.js b/src/components/NavBar.js index 497d42c..ab9bdc9 100644 --- a/src/components/NavBar.js +++ b/src/components/NavBar.js @@ -4,11 +4,10 @@ import { useSnapshot } from "valtio"; const NavBar = () => { const snap = useSnapshot(store); - // const fullName = `${snap.userData.fullName} ${snap.userData.fullName}`; + const fullName = `${snap.userData.fullName}`; return (
- {/*

{fullName}

*/} -

Hello

+

{fullName}

); }; diff --git a/src/components/OtherInformationModal.js b/src/components/OtherInformationModal.js index 2d49500..9291757 100644 --- a/src/components/OtherInformationModal.js +++ b/src/components/OtherInformationModal.js @@ -1,25 +1,96 @@ -import React from "react"; +import React, { useState } from "react"; +import { ethers } from "ethers"; +import contractABI from "./contractABI.json"; + +const AddOtherInformation = (props) => { + const [title, setTitle] = useState(""); + const [diagnosedDate, setDiagnosedDate] = useState(""); + const [disease, setDisease] = useState(""); + const [description, setDescription] = useState(""); + const [medication, setMedication] = useState(""); + + const provider = new ethers.providers.Web3Provider(window.ethereum); + const signer = provider.getSigner(); + + const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; + const contractAbi = contractABI; + + const addOtherInformation = async () => { + try { + const contract = new ethers.Contract(contractAddress, contractAbi, signer); + + // Call the addOtherInformation function + await contract.addOtherInformation( + title, + Date.parse(diagnosedDate) / 1000, + disease, + description, + medication + ); + + // Clear the form inputs + setTitle(""); + setDiagnosedDate(""); + setDisease(""); + setDescription(""); + setMedication(""); + + // Trigger the onClose callback to close the modal + props.onClose(); + } catch (error) { + console.error(error); + } + }; -const OtherInformationModal = (props) => { if (!props.show) { return null; } + return (
e.stopPropagation()}>
-

Title

- +

Any other Disease state?

+

Title

+ setTitle(e.target.value)} + />

Diagnosed date

- - - - + setDiagnosedDate(e.target.value)} + /> +

Disease

+ setDisease(e.target.value)} + /> +

Description

+ setDescription(e.target.value)} + /> +

Medication

+ setMedication(e.target.value)} + />
- + @@ -29,4 +100,4 @@ const OtherInformationModal = (props) => { ); }; -export default OtherInformationModal; +export default AddOtherInformation; diff --git a/src/components/SideBar.js b/src/components/SideBar.js index 5cf2f8c..b57ffe0 100644 --- a/src/components/SideBar.js +++ b/src/components/SideBar.js @@ -6,7 +6,7 @@ import medical from "../images/view.png"; import access from "../images/access.png"; import logout from "../images/logout.png"; import "../css/styles.css"; -import { Link, useMatch, useResolvedPath } from "react-router-dom"; +import { Link, useMatch, useResolvedPath, NavLink } from "react-router-dom"; const SideBar = () => { return ( @@ -14,19 +14,39 @@ const SideBar = () => {
    - +

    View Medical Record

    - +

    My Records

    - +

    Manage Access

    - + + +

    Authorized Access

    +
    +

    Logout

    diff --git a/src/components/addPatientRecord.js b/src/components/addPatientRecord.js new file mode 100644 index 0000000..eec7350 --- /dev/null +++ b/src/components/addPatientRecord.js @@ -0,0 +1,80 @@ +import React, { useState } from "react"; +import "../css/AddPatientRecord.css"; +import contractAbi from "./contractABI.json"; +import { ethers } from "ethers"; + +const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; +const abi = contractAbi; + +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = provider.getSigner(); // Get the signer from the provider +const contract = new ethers.Contract(contractAddress, abi, signer); // Use the signer + +const AddPatientRecord = () => { + const [error, setError] = useState(null); + + const handleAddPatientRecord = async () => { + try { + const bloodGroup = document.getElementById("bloodGroup").value; + const genotype = document.getElementById("genotype").value; + const weight = document.getElementById("weight").value; + + await contract.addPatientRecord(bloodGroup, genotype, weight); + console.log("Patient record added successfully!"); + } catch (error) { + setError(error.message); + console.error("Error adding patient record:", error); + window.alert(error.message); // Display error as an alert + } + }; + + return ( +
    +
    +
    +

    Blood Group

    +
    + +
    +
    +
    +
    +
    +

    Genotype

    +
    + +
    +
    +
    +
    +
    +

    Weight (kg)

    + +
    +
    + +
    + ); +}; + +export default AddPatientRecord; diff --git a/src/components/contractABI.json b/src/components/contractABI.json new file mode 100644 index 0000000..afa9309 --- /dev/null +++ b/src/components/contractABI.json @@ -0,0 +1,242 @@ +[ + { + "inputs": [ + { "internalType": "string", "name": "_allergyName", "type": "string" }, + { "internalType": "string", "name": "_description", "type": "string" }, + { "internalType": "uint256", "name": "_startDate", "type": "uint256" }, + { "internalType": "string", "name": "_medication", "type": "string" } + ], + "name": "addAllergy", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "_disability", "type": "string" }, + { + "internalType": "uint256", + "name": "_diagnosisDate", + "type": "uint256" + }, + { "internalType": "string", "name": "_description", "type": "string" }, + { "internalType": "string", "name": "_medication", "type": "string" } + ], + "name": "addDisability", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "_title", "type": "string" }, + { + "internalType": "uint256", + "name": "_diagnosedDate", + "type": "uint256" + }, + { "internalType": "string", "name": "_disease", "type": "string" }, + { "internalType": "string", "name": "_description", "type": "string" }, + { "internalType": "string", "name": "_medication", "type": "string" } + ], + "name": "addOtherInformation", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "_bloodGroup", "type": "string" }, + { "internalType": "string", "name": "_genotype", "type": "string" }, + { "internalType": "uint256", "name": "_weight", "type": "uint256" } + ], + "name": "addPatientRecord", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "getAllInfo", + "outputs": [ + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { + "components": [ + { "internalType": "string", "name": "allergyName", "type": "string" }, + { "internalType": "uint256", "name": "startDate", "type": "uint256" }, + { "internalType": "string", "name": "description", "type": "string" }, + { "internalType": "string", "name": "medication", "type": "string" } + ], + "internalType": "struct PatientRecords.Allergy[]", + "name": "", + "type": "tuple[]" + }, + { + "components": [ + { + "internalType": "string", + "name": "disabilityName", + "type": "string" + }, + { + "internalType": "uint256", + "name": "diagnosisDate", + "type": "uint256" + }, + { "internalType": "string", "name": "description", "type": "string" }, + { "internalType": "string", "name": "medication", "type": "string" } + ], + "internalType": "struct PatientRecords.Disability[]", + "name": "", + "type": "tuple[]" + }, + { + "components": [ + { "internalType": "string", "name": "title", "type": "string" }, + { + "internalType": "uint256", + "name": "diagnosedDate", + "type": "uint256" + }, + { "internalType": "string", "name": "disease", "type": "string" }, + { "internalType": "string", "name": "description", "type": "string" }, + { "internalType": "string", "name": "medication", "type": "string" } + ], + "internalType": "struct PatientRecords.OtherInformation[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "getAllergy", + "outputs": [ + { + "components": [ + { "internalType": "string", "name": "allergyName", "type": "string" }, + { "internalType": "uint256", "name": "startDate", "type": "uint256" }, + { "internalType": "string", "name": "description", "type": "string" }, + { "internalType": "string", "name": "medication", "type": "string" } + ], + "internalType": "struct PatientRecords.Allergy[]", + "name": "", + "type": "tuple[]" + } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [], + "name": "getAuthorizedAddresses", + "outputs": [ + { "internalType": "string[]", "name": "", "type": "string[]" }, + { "internalType": "address[]", "name": "", "type": "address[]" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "getDisability", + "outputs": [ + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "string", "name": "", "type": "string" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "getOtherInformation", + "outputs": [ + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "uint256", "name": "", "type": "uint256" }, + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "string", "name": "", "type": "string" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "getPatientRecord", + "outputs": [ + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "string", "name": "", "type": "string" }, + { "internalType": "uint256", "name": "", "type": "uint256" } + ], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "string", "name": "_name", "type": "string" }, + { "internalType": "address", "name": "_address", "type": "address" } + ], + "name": "grantAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + }, + { + "inputs": [ + { + "internalType": "address", + "name": "_patientAddress", + "type": "address" + } + ], + "name": "hasAccess", + "outputs": [{ "internalType": "bool", "name": "", "type": "bool" }], + "stateMutability": "view", + "type": "function" + }, + { + "inputs": [ + { "internalType": "address", "name": "_address", "type": "address" } + ], + "name": "revokeAccess", + "outputs": [], + "stateMutability": "nonpayable", + "type": "function" + } +] diff --git a/src/containers/header/Header.jsx b/src/containers/header/Header.jsx index cc4625c..4acf2ab 100644 --- a/src/containers/header/Header.jsx +++ b/src/containers/header/Header.jsx @@ -1,24 +1,32 @@ -import React from 'react'; -import { Link } from 'react-router-dom' -import './header.css'; -import Image2 from '../../assets/image2.png' +import React from "react"; +import { Link } from "react-router-dom"; +import "./header.css"; +import Image2 from "../../assets/image2.png"; const Header = () => { return ( -
    -
    -

    Take your Medical record to the next level with Web3 Technology.

    -

    Medisync simplifies healthcare by collecting data , processing it and saving on the blockchain

    -
    - -
    +
    +
    +

    + Take your Medical record to the next
    level with Web3 + Technology. +

    +

    + Medisync simplifies healthcare by collecting data , processing it and + saving on the blockchain +

    +
    + + +
    +
    -
    - Doctor and Patient -
    +
    + Doctor and Patient +
    - ) -} + ); +}; -export default Header \ No newline at end of file +export default Header; diff --git a/src/containers/header/header.css b/src/containers/header/header.css index c2a1d84..583c647 100644 --- a/src/containers/header/header.css +++ b/src/containers/header/header.css @@ -4,6 +4,7 @@ background: #F6F6F6; padding: 30px 40px; font-family: var(--font-family); + margin-top: 20px; } .medisync__header-content { @@ -23,26 +24,27 @@ .medisync__header-content h1 { font-weight: 500; - font-size: 48px; - line-height: 72px; + font-size: 30px; + line-height: 52px; color: #FFFFFF; cursor:default; } .medisync__header-content p { font-weight: 500; - font-size: 20px; - line-height: 28px; + font-size: 15px; + line-height: 1.5rem; + padding: 0 50px 0 0; color: #FFFFFF; margin: 0 90px 0 0; cursor: default; } .medisync__header-content__demo button { - padding: 15px 26px; + padding: 5px 10px; margin-top: 32px; font-weight: 600; - font-size: 20px; + font-size: 12px; line-height: 32px; color: #436CDF; border: none; diff --git a/src/containers/index.js b/src/containers/index.js index 0abd931..e3e7844 100644 --- a/src/containers/index.js +++ b/src/containers/index.js @@ -1,18 +1,18 @@ -export { default as Benefits } from './benefits/Benefits'; -export { default as Demo } from './demo/Demo'; -export { default as Feedback } from './feedback/Feedback'; -export { default as Footer } from './footer/Footer'; -export { default as Header } from './header/Header'; -export { default as Joinus } from './joinus/Joinus'; -export { default as Whyus } from './whyus/Whyus'; -export { default as Ourservices } from './ourservices/Ourservices'; -export { default as Aboutus } from './aboutus/Aboutus'; -export { default as Whatweb3 } from './whatweb3/Whatweb3'; -export { default as Thedemo } from './thedemo/Thedemo'; -export { default as Feature } from './feature/Feature'; -export { default as Navbar } from './navbar/Navbar'; -export { default as Welcomepage } from './welcomepage/Welcomepage'; -export { default as Registerpage } from './registerpage/Registerpage'; -export { default as Loginpage } from './loginpage/Loginpage'; -export { default as Wallet } from './wallet/Wallet'; -export { default as WalletDr } from './walletdr/WalletDr'; \ No newline at end of file +export { default as Benefits } from "./benefits/Benefits"; +export { default as Demo } from "./demo/Demo"; +export { default as Feedback } from "./feedback/Feedback"; +export { default as Footer } from "./footer/Footer"; +export { default as Header } from "./header/Header"; +export { default as Joinus } from "./joinus/Joinus"; +export { default as Whyus } from "./whyus/Whyus"; +export { default as Ourservices } from "./ourservices/Ourservices"; +export { default as Aboutus } from "./aboutus/Aboutus"; +export { default as Whatweb3 } from "./whatweb3/Whatweb3"; +export { default as Thedemo } from "./thedemo/Thedemo"; +export { default as Feature } from "./feature/Feature"; +export { default as Navbar } from "./navbar/Navbar"; +export { default as Welcomepage } from "./welcomepage/Welcomepage"; +export { default as Registerpage } from "./registerpage/Registerpage"; +export { default as Loginpage } from "./loginpage/Loginpage"; +export { default as Wallet } from "./wallet/Wallet"; +export { default as WalletDr } from "./walletdr/WalletDr"; diff --git a/src/containers/loginpage/Loginpage.jsx b/src/containers/loginpage/Loginpage.jsx index a0036c5..dc7c8cc 100644 --- a/src/containers/loginpage/Loginpage.jsx +++ b/src/containers/loginpage/Loginpage.jsx @@ -2,143 +2,43 @@ import React, { useState } from "react"; import "./loginpage.css"; import { Link, useNavigate } from "react-router-dom"; -import Login from "../../assets/login.jpg"; +import Welcome from "../../assets/Welcome2.png"; import Navbar from "../navbar/Navbar"; -import { useSnapshot } from "valtio"; -import state from "../../store/Index"; -import { logIN } from "../../api/auth"; +import { logIn } from "../../api/auth"; import store from "../../store/Index"; import { toast } from "react-toastify"; -import Welcome from "../../assets/welcome.jpg"; -import { RiEyeOffFill, RiEyeFill } from "react-icons/ri"; -import Backdrop from '@mui/material/Backdrop'; -import CircularProgress from '@mui/material/CircularProgress'; +import { RiEyeFill, RiEyeOffFill } from "react-icons/ri"; +import Backdrop from "@mui/material/Backdrop"; +import CircularProgress from "@mui/material/CircularProgress"; const Loginpage = () => { - // const [email, setEmail] = useState(''); - // const [password, setPassword] = useState(''); - // const [error, setError] = useState(''); - - // const handleSubmit = async (e) => { - // e.preventDefault(); - - // try { - // const response = await axios.post('https://medisync-instance.onrender.com/api/v1/user/login', { - // email, - // password - // }); - - // // Handle the successful login response - // console.log(response.data); - // } catch (error) { - // // Handle the error - // setError('Invalid email or password'); - // } - - // }; - const navigate = useNavigate(); - - const [loading,setLoading] = useState(false); + const [loading, setLoading] = useState(false); const [loginDetails, setLoginDetails] = useState({ email: "", password: "", }); - - const [profile, setProfile] = useState(); - - const snap = useSnapshot(state); - - - // handle loading effect - // const openLoading = () => { - // setLoading(true) - // } - - // const closeLoading = () => { - // setLoading(false) - // } - - // if(loading){ - // setTimeout(()=>{ - // setLoading(false) - // }, - // 6000); - // } - - const handleChange = (ev) => { - setLoginDetails((prevData) =>({ - ...prevData,[ev.target.name] : ev.target.value - })); - }; - - // const handleChange = (ev) => { - // setLoginDetails({ - // ...loginDetails, - // [ev.target.name]: ev.target.value, - // }); - // }; - - // console.log({ loginDetails }); - // console.log(profile); + const handleChange = (ev) => { + setLoginDetails({ + ...loginDetails, + [ev.target.name]: ev.target.value, + }); + }; const handleSubmit = async (e) => { e.preventDefault(); - - const data = { - email:loginDetails.email, - password:loginDetails.password, - } - setLoading(true) + setLoading(true); try { - const res=await fetch('https://medisync-instance.onrender.com/api/v1/user/login',{ - method:"POST", - headers:{ - 'Content-Type':'application/json', - 'Access-Control-Allow-Origin':'*' - }, - body:JSON.stringify(data) - }) - const userData=await res.json() - setLoginDetails((prev)=>{ - return{...prev, ...userData} - }) - setLoading(false) + const res = await logIn(loginDetails); + localStorage.setItem("token", res.token); + store.userData = res.data.data.user; + navigate("/connectwallet"); } catch (error) { - setLoading(false) - console.log(error) + setLoading(false); + toast.error(error); } - // fetch('https://medisync-instance.onrender.com/api/v1/user/login',{ - // method:"POST", - // headers:{ - // 'Content-Type':'application/json', - // 'Access-Control-Allow-Origin':'*' - // }, - // body:JSON.stringify(data) - // }) - // .then((response)=>{ - // return response.json(); - // }) - // .then((userData)=>{ - // // console.log(userData.data.user.id) - // setLoginDetails(userData); - // }) - // .catch((err)=>{ - // console.log("Not sent", err) - // }) - - // try { - // const res = await logIN(loginDetails); - // console.log("loginres", res); - // store.userLoginData = res.data.data.user; - // console.log("details", res.data); - // } catch (error) { - // toast.error(error); - // } - - // e.target.reset(); - + e.target.reset(); }; const [showPassword, setShowPassword] = useState(false); @@ -184,32 +84,33 @@ const Loginpage = () => { required className="button" /> - +
    - { - loading ? ( theme.zIndex.drawer + 1 }} - open - > - - ) - : - null - } + {loading ? ( + theme.zIndex.drawer + 1, + }} + open + > + + + ) : null} { // (signupDetails.status==="fail") ? // ({signupDetails.message}) : // ({signupDetails.status}) - loginDetails.status === "success" ? - navigate("/connectwallet") - : ( + loginDetails.status === "success" ? ( + navigate("/connectwallet") + ) : ( {loginDetails.message} ) } @@ -230,43 +131,4 @@ const Loginpage = () => { ); }; -// const Loginpage = (props) => { -// const [email, setEmail] = useState(''); -// const [pass, setPass] = useState(''); - -// const handleSubmit = (e) => { -// e.preventDefault(); -// console.log(email); -// } - -// return ( -//
    -//
    -// Logo -//
    -//
    -//
    -//

    Login

    - -//
    - -// -// setEmail(e.target.value)} type="email" id="email" name="email" /> - -// -// setPass(e.target.value)} type="password" id="password" name="password" /> -// -//
    -// -// -// -//
    -//
    -// Welcome -//
    -//
    -//
    -// ) -// } - export default Loginpage; diff --git a/src/containers/loginpage/loginpage.css b/src/containers/loginpage/loginpage.css index 26f4a8c..df7cdd6 100644 --- a/src/containers/loginpage/loginpage.css +++ b/src/containers/loginpage/loginpage.css @@ -47,7 +47,7 @@ body { } .login-form input { - width: 340px; + width: 375px; height: 35px; background: #E8EDFB; border: 2px solid #436CDF; @@ -85,7 +85,7 @@ body { } .password input { - width: 310px; + width: 339px; border-right: none; border-top-left-radius: 8px; border-bottom-left-radius: 8px; @@ -93,11 +93,11 @@ body { border-top-right-radius: 0; } -.password span { +.password button { background: none; color: #4e4e4e; - width: 20px; - height: 15px; + width: 40px; + height:41px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 0; @@ -115,6 +115,11 @@ body { transition: 0.6s; } +.password button:hover { + background: none; + color: #4e4e4e; +} + .medisync__loginpage-login { display: flex; background: none; @@ -128,6 +133,12 @@ body { padding-left: 10px; } +.medisync__loginpage-login span { + font-weight: 600; + color: #7209B7; + cursor: pointer; +} + .medisync__loginpage-body_image { min-width: 50%; margin: 0 0 30px 0; @@ -166,11 +177,11 @@ body { } .login-form button { - width: 270px; + width: 260px; } .password input { - width: 225px; + width: 210px; } .password button { diff --git a/src/containers/navbar/navbar.css b/src/containers/navbar/navbar.css index dde423d..8d48a08 100644 --- a/src/containers/navbar/navbar.css +++ b/src/containers/navbar/navbar.css @@ -47,6 +47,12 @@ display: flex; justify-content: space-between; align-items: center; + position: fixed; + right: 0; + left: 0; + top: 0; + background-color: white; + padding: 0 40px; } .medisync__navbar-left { @@ -65,14 +71,14 @@ .medisync__navbar-links { display: flex; - justify-content: flex; + margin-left: 120px; } .medisync__navbar-links p { color: #1B1A1A; font-family: var(--font-family); font-weight: 400; - font-size: 16px; + font-size: 12px; line-height: 28px; padding-left: 40px; cursor: pointer; @@ -100,13 +106,13 @@ .medisync__navbar-right button, .medisync__navbar-menu_container-links-wallet button { - padding: 5px 40px; - margin-left: 10px; + padding: 0 10px; color: #fff; + margin-left: -10px; font-family: var(--font-family); font-style: normal; font-weight: 700; - font-size: 16px; + font-size: 12px; line-height: 32px; background: #436CDF; border-radius: 5px; diff --git a/src/containers/registerpage/Registerpage.jsx b/src/containers/registerpage/Registerpage.jsx index 1afef66..a6b610a 100644 --- a/src/containers/registerpage/Registerpage.jsx +++ b/src/containers/registerpage/Registerpage.jsx @@ -12,119 +12,35 @@ import { snapshot } from "valtio"; import Backdrop from '@mui/material/Backdrop'; import CircularProgress from '@mui/material/CircularProgress'; -// import axios from 'axios'; - const Registerpage = () => { -const navigate = useNavigate(); - + const navigate = useNavigate(); const [loading,setLoading] = useState(false); const [signupDetails, setSignupDetails] = useState({ fullName: "", email: "", password: "", - confirmPassword:"" + confirmPassword: "", }); - - // handle loading effect - // const openLoading = () => { - // setLoading(true) - // } - - // const closeLoading = () => { - // setLoading(false) - // } - - // if(loading){ - // setTimeout(()=>{ - // setLoading(false) - // }, - // 6000); - // } - - - // const handleChange = (ev) => { - // setSignupDetails({ - // ...signupDetails, - // [ev.target.name]: ev.target.value, - // }); - - // }; - const handleChange = (ev) => { - setSignupDetails((prevData) =>({ - ...prevData,[ev.target.name] : ev.target.value - })); + setSignupDetails({ + ...signupDetails, + [ev.target.name]: ev.target.value, + }); }; - - const handleSubmit = async (e) => { e.preventDefault(); - console.log(signupDetails, "Signup Estate") - const data = { - fullName:signupDetails.fullName, - email:signupDetails.email, - password:signupDetails.password, - confirmPassword:signupDetails.confirmPassword - } - setLoading(true) try { - const res=await fetch('https://medisync-instance.onrender.com/api/v1/user/signup',{ - method:"POST", - headers:{ - 'Content-Type':'application/json', - 'Access-Control-Allow-Origin':'*' - }, - body:JSON.stringify(data) - }) - const userData=await res.json() - setSignupDetails((prev)=>{ - return{...prev, ...userData} - }) - setLoading(false) - } catch (error) { - setLoading(false) - console.log(error) + const res = await signUp(signupDetails); + localStorage.setItem("token", res.data.token); + store.userData = res.data.data.user; + navigate("/connectwallet"); + } catch (e) { + toast.error(e); } - - // fetch('https://medisync-instance.onrender.com/api/v1/user/signup',{ - // method:"POST", - // headers:{ - // 'Content-Type':'application/json', - // 'Access-Control-Allow-Origin':'*' - // }, - // body:JSON.stringify(data) - // }) - // .then((response)=>{ - // return response.json(); - // }) - // .then((userData)=>{ - // // console.log(userData.data.user.id) - // // setSignupDetails(userData); - // setSignupDetails((prev)=>{ - // return{...prev, ...userData} - // }) - // }) - // .catch((err)=>{ - // console.log("Not sent", err) - // }) - - // try { - // const res = await signUp(signupDetails); - // localStorage.setItem("token", res.data.token); - // store.userData = res.data.data.user; - // navigate("/connectwallet"); - // } catch (e) { - // toast.error(e); - // } - - // e.target.reset(); }; - - // const userid = localStorage.setItem("id", signupDetails.data); - // console.log(userid) -//To toggle the Paasword visibility + //To toggle the Paasword visibility const [showPassword, setShowPassword] = useState(false); const togglePasswordVisibility = () => { @@ -135,18 +51,14 @@ const navigate = useNavigate();
    - {/*
    - - Logo - -
    */} +

    Get Started

    Fill the form below to sign up

    - + - + {showPassword ? ( ) : ( @@ -192,10 +104,9 @@ const navigate = useNavigate(); onChange={handleChange} type={showPassword ? "text" : "password"} id="confirmPassword" - name="confirmPassword" + name="confirmPassword" required /> - {showPassword ? ( @@ -205,13 +116,13 @@ const navigate = useNavigate();
    - + {/* {signupDetails.message} */} { loading ? ( theme.zIndex.drawer + 1 }} - open + open onClick={closeLoading} > ) @@ -240,70 +151,7 @@ const navigate = useNavigate();
    -
    ); -} - -// const Registerpage = (props) => { -// const [email, setEmail] = useState(""); -// const [pass, setPass] = useState(""); -// const [name, setName] = useState(""); - -// const handleSubmit = (e) => { -// e.preventDefault(); -// console.log(email); - -// return ( -//
    -//
    -// Logo -//
    -//
    -//
    -//

    Get Started

    -//

    Fill the form below to sign up

    -// -// -// setName(e.target.value)} -// type="text" -// id="name" -// name="name" -// /> - -// -// setEmail(e.target.value)} -// type="email" -// id="email" -// name="email" -// /> - -// -// setPass(e.target.value)} -// type="password" -// id="password" -// name="password" -// /> -// -// -// -// -// -//
    -//
    -// {/* Welcome */} -//
    -//
    -//
    -// ); -// }; -// }; +}; export default Registerpage; diff --git a/src/containers/registerpage/registerpage.css b/src/containers/registerpage/registerpage.css index c21e711..791f701 100644 --- a/src/containers/registerpage/registerpage.css +++ b/src/containers/registerpage/registerpage.css @@ -76,6 +76,7 @@ body { background: #436CDF; border: none; border-radius: 8px; + font-weight: 500; font-size: 16px; line-height: 28px; @@ -93,7 +94,7 @@ body { } .password input { - width: 310px; + width: 300px; height: 35px; border-right: none; border-top-left-radius: 8px; @@ -102,11 +103,11 @@ body { border-top-right-radius: 0; } -.password span { +.password button { background: none; color: #4e4e4e; - width: 20px; - height: 15px; + width: 40px; + height:41px; border-top-right-radius: 8px; border-bottom-right-radius: 8px; border-bottom-left-radius: 0; @@ -121,22 +122,32 @@ body { .register-form button:hover { background: #c9c9c9; color: #383838; - transition: 1s; } -.medisync__registerpage-signup { +.password button:hover { + background: none; + color: #4e4e4e; +} + +.medisync__registerpage-login { display: flex; + background: none; color: #6b6b6b; + border: none; margin: 10px 0; } -.medisync__registerpage-signup-login { - font-weight: 600; +.medisync__registerpage-login-signup { color: #436CDF; - cursor: pointer; padding-left: 10px; } +.medisync__registerpage-login span { + font-weight: 600; + color: #7209B7; + cursor: pointer; +} + .medisync__registerpage-body_image { min-width: 50%; } diff --git a/src/containers/wallet/wallet.css b/src/containers/wallet/wallet.css index c6392a5..056576e 100644 --- a/src/containers/wallet/wallet.css +++ b/src/containers/wallet/wallet.css @@ -26,7 +26,7 @@ color: #1CB335; } -/* .medisync__wallet_details-button button { +.medisync__wallet_details-button button { display: flex; margin: 0 auto; width: 450px; @@ -43,4 +43,4 @@ border: none; outline: none; cursor: pointer; -} */ \ No newline at end of file +} diff --git a/src/containers/walletdr/WalletDr.jsx b/src/containers/walletdr/WalletDr.jsx index faab87d..9d75cbd 100644 --- a/src/containers/walletdr/WalletDr.jsx +++ b/src/containers/walletdr/WalletDr.jsx @@ -1,15 +1,14 @@ import React, { useEffect, useState } from "react"; import "./walletDr.css"; -import Logo from '../../assets/medisync-logo.png' - +import Logo from "../../assets/medisync-logo.png"; +import { useNavigate } from "react-router-dom"; const getWallet = () => window.ethereum; const eth = getWallet(); - - const WalletDr = () => { const [currentAccount, setCurrentAccount] = useState(""); + const navigate = useNavigate(); const WalletDr = async () => { if (typeof eth !== "undefined") { @@ -21,21 +20,21 @@ const WalletDr = () => { setCurrentAccount(accounts[0]); alert("welcome User " + accounts[0]); + navigate("/getallinfo"); } else { alert("đź”´Metamask Not Installed, Please Add Metamask To Your Browser đź”´"); } }; return ( -
    - Logo +
    + Logo

    Welcome!

    -

    - In order to view a patient’s record, please connect your wallet -

    +

    In order to view a patient’s record, please connect your wallet

    + Connect Wallet +
    ); diff --git a/src/containers/walletdr/walletDr.css b/src/containers/walletdr/walletDr.css index adc542d..610cc9d 100644 --- a/src/containers/walletdr/walletDr.css +++ b/src/containers/walletdr/walletDr.css @@ -50,4 +50,28 @@ border: none; outline: none; cursor: pointer; +} + +.get-all-info { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 20px; + height: 90vh; +} + +.get-all-info h2 { + margin: 0; +} + +.get-all-info input { + height: 40px !important; + width: 300px; +} + +.get-all-info button { + height: 40px !important; + width: 100px; + padding: 0; } \ No newline at end of file diff --git a/src/css/AddPatientRecord.css b/src/css/AddPatientRecord.css new file mode 100644 index 0000000..09f66e7 --- /dev/null +++ b/src/css/AddPatientRecord.css @@ -0,0 +1,14 @@ +.info-section { + display: flex; + flex-direction: row; + align-items: center; + justify-content: flex-start; +} + +.patient-details-section { + margin-right: 20px; +} + +.add-button { + margin-top: 10px; +} \ No newline at end of file diff --git a/src/css/styles.css b/src/css/styles.css index 3615a7a..e741762 100644 --- a/src/css/styles.css +++ b/src/css/styles.css @@ -9,36 +9,62 @@ body{ font-family: var(--font-family); } +h2 { + font-size: 17px; +} + +p { + font-size: 12px; +} + /* font-family: 'Poppins', sans-serif; */ .app_container { display: flex; width: 100%; + height: auto; } .side_bar { display: flex; flex-direction: column; gap: 35px; - width: 20%; - padding: 30px 0 200px 10px; + width: 15%; + height: 90vh; + padding: 30px 0 0 10px; border-right: 2px solid lightgrey; + border-bottom: 2px solid lightgrey; +} + +.active { + color: #179d74; + font-weight: 700; +} + +.b-active { + color: #436CDF; + background: #cecece; + box-shadow: 0 0 2px #1B1A1A; +} + +.logout_btn { + margin-top: 50%; } .patient_image { - width: 70px; - margin-left: 80px; + width: 50px; + margin-left: 35%; } .logo { - width: 105px; - padding-left: 15px; + margin-left: 50px; + width: 45%; } ul { display: flex; flex-direction: column; - gap: 2px; + gap: 15px; padding: 0; margin: 0; } @@ -49,7 +75,7 @@ li { .dashboard_link { display: flex; - gap: 10px; + gap: 5px; align-items: center; font-size: 15px; font-weight: 600; @@ -63,10 +89,14 @@ li { .dashboard_link:hover { color: white; background-color: #436CDF; - width: 90%; + width: 85%; border-radius: 5px; } +.dashboard_link img { + width: 20px; +} + section { width: 80%; } @@ -76,7 +106,7 @@ section { justify-content: space-between; align-items: center; padding: 0 50px; - height: 100px; + height: 60px; width: 100%; background: #436CDF; color: white; @@ -125,7 +155,7 @@ span { } h3 { - font-size: 22px; + font-size: 15px; font-weight: 500; color: #494949; margin-bottom: 0; @@ -151,14 +181,14 @@ select { .info_section { display: flex; - justify-content: space-between; align-items: center; + gap: 100px; width: 100%; margin-bottom: 50px; } input { - height: 40px; + height: 30px !important; width: 200px; border-radius: 5px; outline: none; @@ -196,14 +226,18 @@ input { .patient-details_first-section { display: flex; flex-direction: column; - align-items: center; - gap: 40px; + gap: 20px; +} + +.patient-details_first-section input { + width: 150px; } select { - width: 200px; + width: 150px; border: 1px solid lightgrey; outline: none; + font-size: 12px; } .disabilities_card, @@ -231,11 +265,11 @@ select { } .new-entry_section img { - width: 40px; + width: 20px; } .new-entry_section h3 { - font-size: 18px; + font-size: 13px; margin-top: 0; } @@ -246,31 +280,37 @@ select { .modal { display: flex; flex-direction: column; - gap: 10px; + gap: 5px; background-color: white; padding: 30px; + border: 2px solid lightgrey; border-radius: 10px; - width: 800px; -} - -.modal_title { - margin-bottom: 30px; + width: 600px; + box-shadow: 30px 30px 30px lightgray; } .modal_body { display: flex; flex-direction: column; - gap: 20px; + gap: 5px; margin-bottom: 30px; + font-size: 14px; } .modal_body h4:last-of-type { margin: 10px 0 -20px 0; } -.modal_body input { - width: 100%; - padding: 5px 20px; +.modal_body input, +.modal_body textarea { + width: 60%; + padding: 5px 10px; + margin-bottom: 10px; + font-size: 12px; +} + +.modal_body textarea { + height: 80px; } .calendar{ @@ -281,7 +321,7 @@ select { .modal_footer { display: flex; - justify-content: flex-end; + justify-content: flex-start; } .modal button { @@ -314,6 +354,58 @@ select { z-index: 1; } +.manage_access { + display: flex; + flex-direction: column; + justify-content: center; + align-items: center; + gap: 20px; + height: 100%; + width: 100%; + color: rgba(0, 0, 0, 0.688); +} + +.manage_access h5 { + text-align: center; + line-height: 1.5rem; + font-size: 20px; + +} + +.manage_access form { + width: 35%; +} + +.manage_access form input { + height: 50px; + width: 100%; +} + +.manage_access form p { + font-size: 20px; +} + +.manage_access button { + cursor: pointer; +} + +.blood-group_input, +.genotype_input, +.weight_input + { + height: 40px; + width: 200px; + border-radius: 5px; + border: 2px solid grey; + margin-top: -30px; + padding-left: 10px; +} + +.disabilities-details { + display: flex; + flex-direction: column; + margin-left: -65%; +} } \ No newline at end of file diff --git a/src/pages/AuthorizedAddresses.js b/src/pages/AuthorizedAddresses.js new file mode 100644 index 0000000..fc2c02f --- /dev/null +++ b/src/pages/AuthorizedAddresses.js @@ -0,0 +1,65 @@ +import React, { useState } from "react"; +import "../css/styles.css"; +import contractAbi from "../components/contractABI.json"; +import { ethers } from "ethers"; + +const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; +const abi = contractAbi; +const provider = new ethers.providers.Web3Provider(window.ethereum); +const signer = provider.getSigner(); // Get the signer from the provider +const contract = new ethers.Contract(contractAddress, abi, signer); + +const GetAuthorizedAddresses = () => { + const [userDetails, setUserDetails] = useState([]); + + const fetchUserDetails = async () => { + try { + // Fetch user details from the smart contract + const fetchedUserDetails = await contract.getAuthorizedAddresses(); + setUserDetails(fetchedUserDetails); + } catch (error) { + alert("Failed to fetch user details from the smart contract"); + } + }; + + return ( +
    + + {userDetails.length > 0 && ( +
    + + + + + + + + + {userDetails.map((user, index) => ( + + + + + + + + ))} + +
    NameWallet Address
    Name{user}Wallet AddressWallet Address{index}
    +
    + )} +
    + ); +}; + +const App = () => { + return ( +
    + {/* Other components */} + + {/* Other components */} +
    + ); +}; + +export default App; diff --git a/src/pages/ConnectWallet.js b/src/pages/ConnectWallet.js index 7af7558..febbaa5 100644 --- a/src/pages/ConnectWallet.js +++ b/src/pages/ConnectWallet.js @@ -1,12 +1,118 @@ -import React from 'react' -import { Wallet } from '../containers' +import React, { useState } from "react"; +import "../css/styles.css"; +import store from "../store/Index"; +import { useNavigate } from "react-router-dom"; +import styled, { keyframes } from "styled-components"; +import { toast } from "react-toastify"; +import metamaskImg from "../assets/metamask.png"; -const ConnectWallet = () => { +const ConnectWallets = () => { + const navigate = useNavigate(); + const [isLoading, setIsLoading] = useState(false); + + const btnhandler = () => { + setIsLoading(true); + // Asking if metamask is already present or not + if (window.ethereum) { + // res[0] for fetching the first wallet + window.ethereum + .request({ method: "eth_requestAccounts" }) + .then((res) => { + store.userWalletAddress = res[0]; + setIsLoading(false); + navigate("/dashboard"); + }) + .catch((error) => { + // Handle error + toast(error.message); + setIsLoading(false); + }); + } else { + window.open("https://metamask.io/download/", "_blank"); + } + }; return ( -
    - +
    + btnhandler()}> + + metamask logo Connect Wallet + + + + + + +
    - ) -} + ); +}; + +export default ConnectWallets; + +const ConnectBtn = styled.button` + position: relative; + display: flex; + align-items: center; + justify-content: center; + outline: none; + width: 178px !important; + font-size: 24px; + padding: 12px 18px; + font-weight: 500; + opacity: 0.8; + cursor: pointer; + transition: all 0.3s; + + &:hover { + opacity: 1; + } +`; + +const BtnLabel = styled.span` + display: ${({ $isloading }) => ($isloading ? `none` : `flex`)}; + align-items: center; + gap: 12px; + + & > img { + width: 25px; + height: 25px; + } +`; + +/* Loading dots styles animation */ +const animateOpacity = keyframes` + 0% { opacity: 1; } + 100% { opacity: 0; } +`; + +const Loading = styled.span` + position: absolute; + top: 0; + left: 0; + width: 100%; + height: 100%; + display: ${({ $isloading }) => ($isloading ? `flex` : `none`)}; + align-items: center; + justify-content: center; + /* background: #fff; */ + + span:not(:last-child) { + margin-right: 5px; + } + + span { + animation-name: ${animateOpacity}; + animation-duration: 1s; + animation-iteration-count: infinite; + } + + span:nth-child(2) { + animation-delay: 100ms; + animation-delay: 100ms; + } -export default ConnectWallet \ No newline at end of file + span:nth-child(3) { + animation-delay: 300ms; + animation-delay: 300ms; + } +`; diff --git a/src/pages/GetAllInfo.js b/src/pages/GetAllInfo.js new file mode 100644 index 0000000..d6c6774 --- /dev/null +++ b/src/pages/GetAllInfo.js @@ -0,0 +1,13 @@ +import React from "react"; + +const GetAllInfo = () => { + return ( +
    +

    Put the wallet address of the patient to view his records

    + + +
    + ); +}; + +export default GetAllInfo; diff --git a/src/pages/ManageAccess.jsx b/src/pages/ManageAccess.jsx new file mode 100644 index 0000000..f8b360d --- /dev/null +++ b/src/pages/ManageAccess.jsx @@ -0,0 +1,83 @@ +import React, { useState } from "react"; +import "../css/styles.css"; +import contractAbi from "../components/contractABI.json"; +import { ethers } from "ethers"; + +const ManageAccess = () => { + const abi = contractAbi; + const contractAddress = "0x8084B71fd847053621f36a3A87DDC885f45A467D"; + const provider = new ethers.providers.Web3Provider(window.ethereum); + const signer = provider.getSigner(); // Get the signer from the provider + const contract = new ethers.Contract(contractAddress, abi, signer); + + const [name, setName] = useState(""); + const [address, setAddress] = useState(""); + const [address2, setAddress2] = useState(""); + + const grantAccess = async () => { + try { + await contract.grantAccess(name, address); + // Access granted successfully + alert("Access granted successfully"); + } catch (error) { + // Handle error + alert("Failed to grant access"); + } + }; + + const revokeAccess = async () => { + try { + await contract.revokeAccess(address2); + // Access revoked successfully + alert("Access revoked successfully"); + } catch (error) { + // Handle error + alert("Failed to revoke access"); + } + }; + + return ( +
    +
    + To grant anyone access to see your details, please input
    the + person's name and wallet address +
    +
    + + +
    + +
    To revoke anyone's access, please input the wallet address
    +
    + +
    + +
    + ); +}; + +export default ManageAccess; diff --git a/src/pages/MyRecords.js b/src/pages/MyRecords.js new file mode 100644 index 0000000..77d37c4 --- /dev/null +++ b/src/pages/MyRecords.js @@ -0,0 +1,24 @@ +import MyRecordAllergies from "../components/MyRecordAllergies"; +import MyRecordDisabilities from "../components/MyRecordDisabilities"; +import MyRecordOtherInformation from "../components/MyRecordOtherInformation"; +import MyRecordsBloodGroup from "../components/MyRecordsBloodGroup"; +import MyRecordsGenotype from "../components/MyRecordsGenotype"; +import MyRecordsWeight from "../components/MyRecordsWeight"; +import "../css/styles.css"; + +const MyRecords = () => { + return ( +
    +
    + + + +
    + + + +
    + ); +}; + +export default MyRecords; \ No newline at end of file diff --git a/src/pages/ViewMedicalRecords.js b/src/pages/ViewMedicalRecords.js index 6d1e4ca..9ebc009 100644 --- a/src/pages/ViewMedicalRecords.js +++ b/src/pages/ViewMedicalRecords.js @@ -1,18 +1,18 @@ import Allergies from "../components/Allergies"; -import BloodGroup from "../components/BloodGroup"; +//import BloodGroup from "../components/BloodGroup"; import Disabilities from "../components/Disabilities"; -import Genotype from "../components/Genotype"; +//import Genotype from "../components/Genotype"; import OtherInformations from "../components/OtherInformations"; -import Weight from "../components/Weight"; +//import Weight from "../components/Weight"; import "../css/medical.css"; +import AddPatientRecord from "../components/addPatientRecord"; const ViewMedicalRecords = () => { return (
    - - - + +
    diff --git a/src/store/Index.js b/src/store/Index.js index 508d597..c6aca0a 100644 --- a/src/store/Index.js +++ b/src/store/Index.js @@ -4,6 +4,7 @@ const store = proxy({ userData: null, userLoginData: "", userWalletAddress: "", + allergyData: null, }); export default store;