From 32ab7d5b978a25dfc6360029a26d68da04565658 Mon Sep 17 00:00:00 2001 From: raunak-dev-edu Date: Mon, 11 Dec 2023 04:43:39 +0530 Subject: [PATCH] ui fix --- packages/site/src/pages/index.tsx | 624 +++++++++++++++--------------- 1 file changed, 316 insertions(+), 308 deletions(-) diff --git a/packages/site/src/pages/index.tsx b/packages/site/src/pages/index.tsx index 3538845..a8d6444 100644 --- a/packages/site/src/pages/index.tsx +++ b/packages/site/src/pages/index.tsx @@ -2,10 +2,16 @@ import React from 'react'; import { useContext, useState, useEffect } from 'react'; import styled from 'styled-components'; +import Menu from '@mui/material/Menu'; +import MenuItem from '@mui/material/MenuItem'; + +import ArrowDropDownCircleOutlinedIcon from '@mui/icons-material/ArrowDropDownCircleOutlined'; +import ReceiptIcon from '@mui/icons-material/Receipt'; +import IconButton from '@mui/material/IconButton'; +import OpenInNewIcon from '@mui/icons-material/OpenInNew'; import { Button, TextField, - Modal, Typography, List, Dialog, @@ -16,14 +22,6 @@ import { TableContainer, Table, } from '@mui/material'; -import Menu from '@mui/material/Menu'; -import MenuItem from '@mui/material/MenuItem'; - -import ArrowDropDownCircleOutlinedIcon from '@mui/icons-material/ArrowDropDownCircleOutlined'; -import ReceiptIcon from '@mui/icons-material/Receipt'; -import IconButton from '@mui/material/IconButton'; -import OpenInNewIcon from '@mui/icons-material/OpenInNew'; -import { Button, TextField, Typography, List, Dialog, TableBody, TableCell, TableHead, TableRow, TableContainer, Table } from '@mui/material'; import ListItem from '@mui/material/ListItem'; import ListItemText from '@mui/material/ListItemText'; import DialogTitle from '@mui/material/DialogTitle'; @@ -172,13 +170,12 @@ const HorizontalButtonContainer = styled.div` display: flex; flex-direction: column; align-items: center; - margin-top: 80px; + margin-top: 2rem; font: Roboto; - font-size: 32px; + font-size: 2rem; font-weight: 100; line-height: 38px; letter-spacing: 0em; - text-align: left; `; const BalanceText = styled.div` text-align: center; @@ -189,29 +186,15 @@ const AccountInfoBox = styled.div` border: none; border-radius: 20px; padding: 10px; - margin-bottom: 20px; - color: #001A5D; - font-size: 1.2rem; - width: 405px; + color: #001a5d; + width: fit-content; height: 10px; - - background-color: #D5E6FF; + margin: 2rem auto; + background-color: #d5e6ff; display: flex; align-items: center; justify-content: center; font: Roboto; -font-size: 12px; -font-weight: 300; -line-height: 14px; -letter-spacing: 0em; -text-align: left; -width: 463px -height: 35px -top: 100px -left: 289px -border-radius: 15px - - `; const AccountModalContent = styled(DialogContent)` font-size: 90rem; @@ -278,27 +261,27 @@ const Index = () => { const handleClose = () => { setOpen(false); - } + }; const powerToInteger = (number: any) => { - let formattedAmount = number.toFixed(8); + let formattedAmount = number.toFixed(8); let [integerPart, fractionalPart] = formattedAmount.split('.'); fractionalPart = fractionalPart.padStart(2, '0'); let result = `${integerPart}.${fractionalPart}`; console.log(result); return result; - } - + }; + const toggleOpen = () => { setOpen(!open); }; const transactionCronJob = () => { - const interval = setInterval( async () => { + const interval = setInterval(async () => { const getTxn = await sendTxnHistory(); setTxnHistory(getTxn.txnHistory); }, 5000); console.log(interval); - } + }; const openSendModal = () => { setIsSendModalOpen(true); @@ -494,7 +477,11 @@ const Index = () => { Welcome to SnapTos - + Integrate Aptos Blockchain with metamask @@ -630,260 +617,278 @@ const Index = () => { {' '} - - -
- {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 - -
{' '} -
- - -
- - {address ? address : 'Loading...'} - - {}} - /> -
-
-
- - - {balance / Math.pow(10, 8)} APT - - -
-
+ + handleNetworkSelect('mainnet')} + sx={{ fontSize: '15px', font: 'Roboto' }} > - - SEND - - + +
+ - - FAUCET - - + Aptos Account +
- {!open &&

Click on transaction history to view all transactions.

} + { + window.open( + `https://explorer.aptoslabs.com/account/${address}?network=devnet`, + '_blank', + ); + }} + /> + +
+ + +
+ + {address ? address : 'Loading...'} + + {}} + /> +
+
+
+ + {balance / Math.pow(10, 8)} APT + + + +
+ + + +
+ {!open && ( +

Click on transaction history to view all transactions.

+ )} {open && txnHistory.length > 0 && ( - -
+
- +
- Version - Hash - Value (APT) - Timestamp - View on Explorer + + Version + + + Hash + + + Value (APT) + + + Timestamp + + + View on Explorer + {txnHistory.map((txn, i) => ( - {txn.version} - {txn.hash} - {powerToInteger(txn.events[0].data.amount*Math.pow(10,-8))} - {milliToDate(txn.timestamp)} + + {txn.version} + + + {txn.hash} + + + {powerToInteger( + txn.events[0].data.amount * Math.pow(10, -8), + )} + + + {milliToDate(txn.timestamp)} + - - - + { + window.open( + `https://explorer.aptoslabs.com/txn/${txn.hash}?network=devnet`, + '_blank', + ); + }} + /> ))} @@ -892,63 +897,66 @@ const Index = () => { )} - {open && txnHistory.length === 0 &&

No transactions to display.

} - - - Confirm Transaction - - - Recipient Address: {recipientAddress} - - Amount: {sendAmount} - Fee: 0 + {open && txnHistory.length === 0 && ( +

No transactions to display.

+ )} + + + Confirm Transaction + + + Recipient Address: {recipientAddress} + + Amount: {sendAmount} + Fee: 0 - - Total Amount: {sendAmount + 0} - - - - - - - - {isActivityListOpen && ( - - } - > - {[0, 1, 2, 3, 4].map((sectionId) => ( -
  • -
      - {[0, 1, 2].map((item) => ( - - - - ))} -
    -
  • - ))} -
    -
    - )} + + Total Amount: {sendAmount + 0} + +
    + + + + +
    + {isActivityListOpen && ( + + } + > + {[0, 1, 2, 3, 4].map((sectionId) => ( +
  • +
      + {[0, 1, 2].map((item) => ( + + + + ))} +
    +
  • + ))} +
    +
    + )} + )}