From e7c504a71156d893d46c8c8bb076211bab9b84d9 Mon Sep 17 00:00:00 2001 From: Andinus Date: Sun, 26 Sep 2021 16:12:09 +0530 Subject: Update client, add foooter --- client/public/footer.png | Bin 0 -> 5190 bytes client/public/index.html | 6 +++ client/src/App.css | 55 ++++++++++++++++++++------ client/src/App.tsx | 30 ++++++++------ client/src/components/ConnectWallet.tsx | 2 +- client/src/components/Records.tsx | 68 ++++++++++++++++++++++++++------ 6 files changed, 125 insertions(+), 36 deletions(-) create mode 100644 client/public/footer.png (limited to 'client') diff --git a/client/public/footer.png b/client/public/footer.png new file mode 100644 index 0000000..d82fadc Binary files /dev/null and b/client/public/footer.png differ diff --git a/client/public/index.html b/client/public/index.html index 0869997..c45409a 100644 --- a/client/public/index.html +++ b/client/public/index.html @@ -9,6 +9,12 @@ name="description" content="Web site created using create-react-app" /> + { const [wallet, setWallet] = useState(null); const [userAddress, setUserAddress] = useState(""); const [userBalance, setUserBalance] = useState(0); - const [storage, setStorage] = useState({dates: []}); + const [storage, setStorage] = useState({dates: [], records: [],}); const [copiedPublicToken, setCopiedPublicToken] = useState(false); const [beaconConnection, setBeaconConnection] = useState(false); const [activeTab, setActiveTab] = useState("transfer"); // Granadanet Memoir contract - const contractAddress: string = "KT1T4idqQZpt1Ayn9SRNqCo7PsiBreT5YsMB"; + const contractAddress: string = "KT1PjaJZxYvE335fdD7GXLshPWdFAYan1ta3"; const generateQrCode = (): { __html: string } => { const qr = qrcode(0, "L"); @@ -45,7 +45,7 @@ const App = () => {

MyMedMemoir

-
Try the Taquito Boilerplate App!
+
Decentralized Medical Reports

  Connecting to @@ -117,7 +117,7 @@ const App = () => {

- {activeTab === "transfer" && + {activeTab === "transfer" &&

Make a transfer

{ />
} - {activeTab === "contract" && + {activeTab === "contract" &&
{ />
} - {activeTab === "reports" && + {activeTab === "reports" &&
-

- {storage.dates.map((val: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined) =>
{val}
)} -

+ {storage.dates.map((val: boolean | React.ReactChild | React.ReactFragment | React.ReactPortal | null | undefined, idx: any) => +
+
+ + {JSON.parse(storage.records[idx]).date} + + {JSON.parse(storage.records[idx]).name} +
+
)} +
} -
); diff --git a/client/src/components/ConnectWallet.tsx b/client/src/components/ConnectWallet.tsx index 3a293c0..2593809 100644 --- a/client/src/components/ConnectWallet.tsx +++ b/client/src/components/ConnectWallet.tsx @@ -86,7 +86,7 @@ const ConnectButton = ({ (async () => { // creates a wallet instance const wallet = new BeaconWallet({ - name: "Taquito Boilerplate", + name: "MyMedMemoir", preferredNetwork: NetworkType.GRANADANET, disableDefaultEvents: true, // Disable all events / UI. This also disables the pairing alert. eventHandlers: { diff --git a/client/src/components/Records.tsx b/client/src/components/Records.tsx index eec867d..130e985 100644 --- a/client/src/components/Records.tsx +++ b/client/src/components/Records.tsx @@ -13,10 +13,28 @@ const Records = ({ contract, setUserBalance, Tezos, userAddress, setStorage }: R const [loadingIncrement, setLoadingIncrement] = useState(false); const [loadingDecrement, setLoadingDecrement] = useState(false); + const [formKaName, setName] = useState(''); + const [formKaDate, setDate] = useState(''); + const [formKaHeight, setHeight] = useState(''); + const [formKaWeight, setWeight] = useState(''); + const [formKaAge, setAge] = useState(''); + const [formKaHospital, setHospital] = useState(''); + const [formKaPrescription, setPrescription] = useState(''); + const addRecord = async (): Promise => { setLoadingIncrement(true); try { - const op = await contract.methods.default("tesds").send(); + const apnaForm = { + name: formKaName, + date: formKaDate, + age: formKaAge, + height: formKaHeight, + weight: formKaWeight, + hospital: formKaHospital, + prescription: formKaPrescription, + }; + console.log(JSON.stringify(apnaForm)); + const op = await contract.methods.default(JSON.stringify(apnaForm)).send(); await op.confirmation(); const newStorage: any = await contract.storage(); if (newStorage) setStorage(newStorage); @@ -30,18 +48,44 @@ const Records = ({ contract, setUserBalance, Tezos, userAddress, setStorage }: R if (!contract && !userAddress) return
 
; return ( -
- - )} - +
); }; -- cgit 1.4.1-2-gfad0