From 3a8d25d65b31d850f20a23506a8689d04360edfe Mon Sep 17 00:00:00 2001 From: Hemant Chaurasia Date: Sun, 10 Dec 2023 22:54:43 +0530 Subject: [PATCH] UI modified --- packages/site/src/components/Header.tsx | 2 +- packages/site/src/pages/index.tsx | 371 ++++++++++++++++++++---- packages/snap/snap.manifest.json | 2 +- 3 files changed, 312 insertions(+), 63 deletions(-) diff --git a/packages/site/src/components/Header.tsx b/packages/site/src/components/Header.tsx index 2c0b42c..fd88739 100644 --- a/packages/site/src/components/Header.tsx +++ b/packages/site/src/components/Header.tsx @@ -64,7 +64,7 @@ export const Header = ({ - Aptos-snap + SNAPTOS { const milliToDate = (milli) => { const monthNames = [ - 'January', 'February', 'March', 'April', 'May', 'June', - 'July', 'August', 'September', 'October', 'November', 'December' + 'January', + 'February', + 'March', + 'April', + 'May', + 'June', + 'July', + 'August', + 'September', + 'October', + 'November', + 'December', ]; let numberString = milli.toString(); let result = numberString.slice(0, -3); let resultNumber = parseFloat(result); const date = new Date(resultNumber); - const time = date.getDate() + " " + monthNames[date.getMonth()] + " " + date.getFullYear(); + const time = + date.getDate() + + ' ' + + monthNames[date.getMonth()] + + ' ' + + date.getFullYear(); return time; - } - + }; + const handleOpen = () => { setOpen(true); }; - + const handleClose = () => { setOpen(false); }; @@ -385,11 +445,32 @@ const Index = () => { } }; + /*DROP-DOWN LOGIC*/ + + const [anchorEl, setAnchorEl] = useState(null); + const [selectedNetwork, setSelectedNetwork] = useState('mainnet'); + + const handleDropdownClick = (event) => { + setAnchorEl(event.currentTarget); + }; + + const handleDropdownClose = () => { + setAnchorEl(null); + }; + + const handleNetworkSelect = (network) => { + setSelectedNetwork(network); + handleDropdownClose(); + // Add logic here to handle the selected network (e.g., switch network configuration) + }; return ( - Welcome to Aptos-snap + Welcome to SnapTos + + Integrate Aptos Blockchain with metamask + {state.error && ( @@ -521,32 +602,148 @@ const Index = () => { {isAccount && ( <> + {' '} + + +
+ {selectedNetwork.toUpperCase()}{' '} + {/* Display the selected network in uppercase */} +
+ + handleNetworkSelect('mainnet')} + sx={{ fontSize: '20px', font: 'Roboto' }} + > + Mainnet + + handleNetworkSelect('testnet')} + sx={{ fontSize: '20px', font: 'Roboto' }} + > + Testnet + + handleNetworkSelect('devnet')} + sx={{ fontSize: '20px', font: 'Roboto' }} + > + Devnet + + + { + window.open( + 'https://explorer.aptoslabs.com/account/', + '_blank', + ); + }} + /> +
+ + + + Aptos Account + +
{' '} +
- - Account : {address ? address : 'Loading...'} - +
+ + {address ? address : 'Loading...'} + + {}} + /> +
- - {/* Content inside the custom Container component */} { variant="contained" onClick={openSendModal} style={{ - backgroundColor: '#6F4CFF', + width: '94px', + height: '32px', + position: 'absolute', + top: '205px', + left: '240px', + borderRadius: '10px', + background: '#2F81FC', color: 'white', - marginRight: '10px', + display: 'flex', + alignItems: 'center', + justifyContent: 'center', + padding: '0', + fontSize: '12px', + font: 'Roboto', }} > - + SEND - - - {txnHistory.length > 0 && ( - - - - - Version - Hash - Value - Timestamp - View on Aptos Explorer - - - - {txnHistory.map((txn, i) => ( + + + {txnHistory.length > 0 && ( + +
+ + + Version + Hash + Value + Timestamp + View on Aptos Explorer + + + + {txnHistory.map((txn, i) => ( {txn.version} {txn.hash} - {txn.events[0].data.amount} - {milliToDate(txn.timestamp)} - - + {txn.events[0].data.amount} + + + {milliToDate(txn.timestamp)} + + + + ))} - -
-
- )} + + + + )}
- { - {isActivityListOpen && (