From 2143bb92e46fcf6c8f363085b63c327e3fa4de49 Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Mon, 9 Sep 2024 11:11:25 +0200 Subject: [PATCH 01/13] Split Tables --- src/ui/src/components/Dashboard/index.tsx | 10 +++-- src/ui/src/components/Dashboard/style.ts | 52 ++++++++++++++--------- 2 files changed, 39 insertions(+), 23 deletions(-) diff --git a/src/ui/src/components/Dashboard/index.tsx b/src/ui/src/components/Dashboard/index.tsx index 7ed5907b..46e78e68 100644 --- a/src/ui/src/components/Dashboard/index.tsx +++ b/src/ui/src/components/Dashboard/index.tsx @@ -33,15 +33,19 @@ const Dashboard = () => { return ( - + Supplying - + Borrowing - + + Markets + + + Markets diff --git a/src/ui/src/components/Dashboard/style.ts b/src/ui/src/components/Dashboard/style.ts index 54398302..22a3c600 100644 --- a/src/ui/src/components/Dashboard/style.ts +++ b/src/ui/src/components/Dashboard/style.ts @@ -171,42 +171,54 @@ export const useStyles = makeStyles({ fontWeight: "400", fontSize: "0.875rem", }, - dashboard: { - background: "#F9FAFC", - padding: "0px 6.25rem 10.125rem", - "@media(max-width: 1024px)": { - padding: "0px 4rem 10.125rem", - }, - "@media(max-width: 900px)": { - padding: "0px 2rem 10.125rem", - }, - "@media(max-width: 768px)": { - padding: "0px 4rem 10.125rem", - }, - "@media(max-width: 501px)": { - padding: "0px 1rem 10.125rem", + compositionOne: { }, + dashboard: { + paddingLeft: '6.25rem', + paddingRight: '6.25rem', + '@media(max-width: 1024px)': { + paddingLeft: '4rem', + paddingRight: '4rem', + }, + '@media(max-width: 900px)': { + paddingLeft: '2rem', + paddingRight: '2rem', + }, + '@media(max-width: 768px)': { + paddingLeft: '4rem', + paddingRight: '4rem', + }, + '@media(max-width: 501px)': { + paddingLeft: '1rem', + paddingRight: '1rem', + }, }, borrowTablePadding: { + "@media(max-width: 600px)": { + paddingRight: "1.975rem", + }, "@media(min-width: 900px)": { - paddingLeft: "0.875rem", + paddingRight: "0.975rem", }, "@media(min-width: 1024px)": { - paddingLeft: "0.9375rem", + paddingRight: "0.9375rem", }, "@media(min-width: 1200px)": { - paddingLeft: "1.875rem", + paddingRight: "0.875rem", }, }, supplyTablePadding: { + "@media(min-width: 600px)": { + paddingRight: "1rem", + }, "@media(min-width: 900px)": { - paddingRight: "0.875rem", + paddingRight: "2rem", }, "@media(min-width: 1024px)": { - paddingRight: "0.9375rem", + paddingRight: "2rem", }, "@media(min-width: 1200px)": { - paddingRight: "1.875rem", + paddingRight: "3rem", }, }, tableTitle: { From 2e96cbb6ce0d493f9e75b9bd54a97d0b903901db Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Mon, 9 Sep 2024 11:58:18 +0200 Subject: [PATCH 02/13] Add separate tables for borrow & supply markets --- ...enTable.tsx => BorrowMarketTokenTable.tsx} | 4 +- .../Dashboard/SupplyMarketTokenTable.tsx | 231 ++++++++++++++++++ src/ui/src/components/Dashboard/index.tsx | 11 +- 3 files changed, 239 insertions(+), 7 deletions(-) rename src/ui/src/components/Dashboard/{AllMarketTokenTable.tsx => BorrowMarketTokenTable.tsx} (99%) create mode 100644 src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx diff --git a/src/ui/src/components/Dashboard/AllMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx similarity index 99% rename from src/ui/src/components/Dashboard/AllMarketTokenTable.tsx rename to src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index 850785ce..98829396 100644 --- a/src/ui/src/components/Dashboard/AllMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -23,7 +23,7 @@ import TableSkeleton from "../Skeleton"; import { useStyles } from "./style"; -const AllMarketTokenTable = (props) => { +const BorrowMarketTokenTable = (props) => { const classes = useStyles(); const { tableData } = props; const { address } = useSelector((state: any) => state.addWallet.account); @@ -228,4 +228,4 @@ const AllMarketTokenTable = (props) => { ); }; -export default AllMarketTokenTable; +export default BorrowMarketTokenTable; diff --git a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx new file mode 100644 index 00000000..18f047f5 --- /dev/null +++ b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx @@ -0,0 +1,231 @@ +/* eslint-disable no-nested-ternary */ +/* eslint-disable import/extensions */ +/* eslint-disable import/no-unresolved */ +// eslint-disable-next-line no-use-before-define +import React, { useState } from "react"; +import { useSelector } from "react-redux"; + +import { decimals } from "tezoslendingplatformjs"; +import BigNumber from "bignumber.js"; + +import Table from "@mui/material/Table"; +import TableBody from "@mui/material/TableBody"; +import TableCell from "@mui/material/TableCell"; +import TableContainer from "@mui/material/TableContainer"; +import TableHead from "@mui/material/TableHead"; +import TableRow from "@mui/material/TableRow"; +import { Typography } from "@mui/material"; + +import { decimalify, nFormatter, roundValue } from "../../util"; + +import AllMarketModal from "../AllMarketModal"; +import TableSkeleton from "../Skeleton"; + +import { useStyles } from "./style"; + +const SupplyMarketTokenTable = (props) => { + const classes = useStyles(); + const { tableData } = props; + const { address } = useSelector((state: any) => state.addWallet.account); + + const [tokenDetails, setTokenDetails] = useState(); + const [openMktModal, setMktModal] = useState(false); + + const closeModal = () => { + setMktModal(false); + }; + + const handleClickMktModal = (item) => { + setTokenDetails(item); + setMktModal(true); + }; + + return ( + + {tokenDetails && ( + + )} + + + + Token + Market Size + Total Borrowed + Supply APY + Borrow APY + Wallet + + + + {tableData?.map((data) => ( + + {(address && data.walletBalance) || + (!address && data.marketSize) ? ( + handleClickMktModal(data)} + > + +
+
+ {`${data.title}-Icon`} + +
+ + {" "} + {data.name}{" "} + + + {" "} + {data.title}{" "} + +
+
+
+
+ + + {data.marketSize > 0 + ? decimalify( + data.marketSize.toString(), + decimals[data.title], + decimals[data.title], + ) < 0.01 + ? '>0.00' + : nFormatter( + decimalify( + data.marketSize.toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : '0'}{" "} + {data.title} + {" "} +
+ + $ + {data.marketSize > 0 + ? nFormatter( + decimalify( + (data.marketSize * data.usdPrice).toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : "0.00"} + +
+ + + {data.totalBorrowed > 0 + ? decimalify( + data.totalBorrowed.toString(), + decimals[data.title], + decimals[data.title], + ) < 0.01 + ? '>0.00' + : nFormatter( + decimalify( + data.totalBorrowed.toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : '0'}{" "} + {data.title} + {" "} +
+ + $ + {data.totalBorrowed > 0 + ? nFormatter( + decimalify( + (data.totalBorrowed * data.usdPrice).toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : "0.00"} + +
+ + + {data.supplyRate > 0 + ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) + new BigNumber(data.supplyRate).gt( + new BigNumber(10000000000000000), + ) + ? roundValue(decimalify(data.supplyRate, 18)) + : "<0.01" + : "0"} + % + + + + + {data.borrowRate > 0 + ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) + new BigNumber(data.borrowRate).gt( + new BigNumber(10000000000000000), + ) + ? roundValue(decimalify(data.borrowRate, 18)) + : "<0.01" + : "0"} + % + + + + + {data.walletBalance > 0 + ? decimalify( + data.walletBalance.toString(), + decimals[data.title], + decimals[data.title], + ) < 0.01 + ? '>0.00' + : nFormatter( + decimalify( + data.walletBalance.toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : '0'}{" "} + {data.title} + {" "} +
+ + $ + {data.walletBalance > 0 + ? nFormatter( + decimalify( + (data.walletBalance * data.usdPrice).toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : "0.00"} + +
+
+ ) : ( + + )} +
+ ))} +
+
+
+ ); +}; + +export default SupplyMarketTokenTable; diff --git a/src/ui/src/components/Dashboard/index.tsx b/src/ui/src/components/Dashboard/index.tsx index 46e78e68..6bf7db67 100644 --- a/src/ui/src/components/Dashboard/index.tsx +++ b/src/ui/src/components/Dashboard/index.tsx @@ -9,7 +9,8 @@ import { Typography } from '@mui/material'; import BorrowedTokenTable from './BorrowedTokenTable'; import SuppliedTokenTable from './SuppliedTokenTable'; -import AllMarketTokenTable from './AllMarketTokenTable'; +import BorrowMarketTokenTable from './BorrowMarketTokenTable'; +import SupplyMarketTokenTable from './SupplyMarketTokenTable'; import { borrowedMarketAction, allMarketAction, suppliedMarketAction } from '../../reduxContent/market/actions'; @@ -42,12 +43,12 @@ const Dashboard = () => {
- Markets - + Assets to Supply + - Markets - + Assets to Borrow +
); From eef8375a5192d6bb4a6bc621a27f30cc3255df4e Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Mon, 9 Sep 2024 12:02:29 +0200 Subject: [PATCH 03/13] Supply table --- .../Dashboard/SupplyMarketTokenTable.tsx | 94 ++----------------- 1 file changed, 6 insertions(+), 88 deletions(-) diff --git a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx index 18f047f5..ab75e19f 100644 --- a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx @@ -53,11 +53,8 @@ const SupplyMarketTokenTable = (props) => { Token - Market Size - Total Borrowed - Supply APY - Borrow APY Wallet + Supply APY @@ -93,49 +90,16 @@ const SupplyMarketTokenTable = (props) => { - {data.marketSize > 0 - ? decimalify( - data.marketSize.toString(), - decimals[data.title], - decimals[data.title], - ) < 0.01 - ? '>0.00' - : nFormatter( - decimalify( - data.marketSize.toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : '0'}{" "} - {data.title} - {" "} -
- - $ - {data.marketSize > 0 - ? nFormatter( - decimalify( - (data.marketSize * data.usdPrice).toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : "0.00"} - -
- - - {data.totalBorrowed > 0 + {data.walletBalance > 0 ? decimalify( - data.totalBorrowed.toString(), + data.walletBalance.toString(), decimals[data.title], decimals[data.title], ) < 0.01 ? '>0.00' : nFormatter( decimalify( - data.totalBorrowed.toString(), + data.walletBalance.toString(), decimals[data.title], decimals[data.title], ), @@ -146,10 +110,10 @@ const SupplyMarketTokenTable = (props) => {
$ - {data.totalBorrowed > 0 + {data.walletBalance > 0 ? nFormatter( decimalify( - (data.totalBorrowed * data.usdPrice).toString(), + (data.walletBalance * data.usdPrice).toString(), decimals[data.title], decimals[data.title], ), @@ -170,52 +134,6 @@ const SupplyMarketTokenTable = (props) => { %
- - - {data.borrowRate > 0 - ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) - new BigNumber(data.borrowRate).gt( - new BigNumber(10000000000000000), - ) - ? roundValue(decimalify(data.borrowRate, 18)) - : "<0.01" - : "0"} - % - - - - - {data.walletBalance > 0 - ? decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ) < 0.01 - ? '>0.00' - : nFormatter( - decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : '0'}{" "} - {data.title} - {" "} -
- - $ - {data.walletBalance > 0 - ? nFormatter( - decimalify( - (data.walletBalance * data.usdPrice).toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : "0.00"} - -
) : ( From ef0371b3fdd57069fc8af949c9eb11fcc608124a Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Wed, 11 Sep 2024 11:31:44 +0200 Subject: [PATCH 04/13] Borrow Market Table data columns --- .../Dashboard/BorrowMarketTokenTable.tsx | 88 +------------------ 1 file changed, 3 insertions(+), 85 deletions(-) diff --git a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index 98829396..32e589cc 100644 --- a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -53,11 +53,8 @@ const BorrowMarketTokenTable = (props) => { Token - Market Size - Total Borrowed - Supply APY + Available Borrow APY - Wallet @@ -102,7 +99,7 @@ const BorrowMarketTokenTable = (props) => { ? '>0.00' : nFormatter( decimalify( - data.marketSize.toString(), + (data.marketSize - data.totalBorrowed).toString(), decimals[data.title], decimals[data.title], ), @@ -116,7 +113,7 @@ const BorrowMarketTokenTable = (props) => { {data.marketSize > 0 ? nFormatter( decimalify( - (data.marketSize * data.usdPrice).toString(), + ((data.marketSize - data.totalBorrowed) * data.usdPrice).toString(), decimals[data.title], decimals[data.title], ), @@ -124,52 +121,6 @@ const BorrowMarketTokenTable = (props) => { : "0.00"} - - - {data.totalBorrowed > 0 - ? decimalify( - data.totalBorrowed.toString(), - decimals[data.title], - decimals[data.title], - ) < 0.01 - ? '>0.00' - : nFormatter( - decimalify( - data.totalBorrowed.toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : '0'}{" "} - {data.title} - {" "} -
- - $ - {data.totalBorrowed > 0 - ? nFormatter( - decimalify( - (data.totalBorrowed * data.usdPrice).toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : "0.00"} - -
- - - {data.supplyRate > 0 - ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) - new BigNumber(data.supplyRate).gt( - new BigNumber(10000000000000000), - ) - ? roundValue(decimalify(data.supplyRate, 18)) - : "<0.01" - : "0"} - % - - {data.borrowRate > 0 @@ -183,39 +134,6 @@ const BorrowMarketTokenTable = (props) => { % - - - {data.walletBalance > 0 - ? decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ) < 0.01 - ? '>0.00' - : nFormatter( - decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : '0'}{" "} - {data.title} - {" "} -
- - $ - {data.walletBalance > 0 - ? nFormatter( - decimalify( - (data.walletBalance * data.usdPrice).toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : "0.00"} - -
) : ( From 446aeb4f73ee327108e03a6e0d098d57ad27374a Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Wed, 11 Sep 2024 12:18:14 +0200 Subject: [PATCH 05/13] Buttons WIP --- .../Dashboard/BorrowMarketTokenTable.tsx | 21 ++++++++++++++++++- .../Dashboard/SupplyMarketTokenTable.tsx | 14 ++++++++++++- 2 files changed, 33 insertions(+), 2 deletions(-) diff --git a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index 32e589cc..37889d9c 100644 --- a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -14,7 +14,7 @@ import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; -import { Typography } from "@mui/material"; +import { Button, Typography } from "@mui/material"; import { decimalify, nFormatter, roundValue } from "../../util"; @@ -134,6 +134,25 @@ const BorrowMarketTokenTable = (props) => { % + + + + + + ) : ( diff --git a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx index ab75e19f..2ae0c4f8 100644 --- a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx @@ -14,7 +14,7 @@ import TableCell from "@mui/material/TableCell"; import TableContainer from "@mui/material/TableContainer"; import TableHead from "@mui/material/TableHead"; import TableRow from "@mui/material/TableRow"; -import { Typography } from "@mui/material"; +import { Button, Typography } from "@mui/material"; import { decimalify, nFormatter, roundValue } from "../../util"; @@ -134,6 +134,18 @@ const SupplyMarketTokenTable = (props) => { % + + + + + ) : ( From 5633113092b699e5942b148e5df259ff076a71e7 Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Fri, 20 Sep 2024 11:37:30 +0200 Subject: [PATCH 06/13] Switch WIP --- .../Dashboard/BorrowMarketTokenTable.tsx | 2 +- .../Dashboard/BorrowedTokenTable.tsx | 6 +- .../Dashboard/SuppliedTokenTable.tsx | 6 +- .../Dashboard/SupplyMarketTokenTable.tsx | 12 +-- src/ui/src/components/Dashboard/style.ts | 76 +++++++++++------- src/ui/src/components/Switch/index.js | 78 +++++++++++++++++-- 6 files changed, 133 insertions(+), 47 deletions(-) diff --git a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index 37889d9c..168e5ea0 100644 --- a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -134,7 +134,7 @@ const BorrowMarketTokenTable = (props) => { % - + + + + + + ) : ( + + )} + + ))} +
+ + + ); }; export default BorrowMarketTokenTable; diff --git a/src/ui/src/components/Dashboard/BorrowedTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowedTokenTable.tsx index 78fd15e3..98550363 100644 --- a/src/ui/src/components/Dashboard/BorrowedTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowedTokenTable.tsx @@ -97,7 +97,7 @@ const BorrowedTokenTable = (props) => { {borrowedData && borrowedData.map((data) => ( handleClickMktModal(data)}> - +
{`${data.title}-Icon`} @@ -110,7 +110,7 @@ const BorrowedTokenTable = (props) => {
- + {data.rate > 0 ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) new BigNumber(data.rate).gt(new BigNumber(10000000000000000)) @@ -159,7 +159,7 @@ const BorrowedTokenTable = (props) => { )} - + {checkLimitUsed(data)}% diff --git a/src/ui/src/components/Dashboard/SuppliedTokenTable.tsx b/src/ui/src/components/Dashboard/SuppliedTokenTable.tsx index e26d3983..107952dc 100644 --- a/src/ui/src/components/Dashboard/SuppliedTokenTable.tsx +++ b/src/ui/src/components/Dashboard/SuppliedTokenTable.tsx @@ -114,7 +114,7 @@ const SuppliedTokenTable = (props) => { {suppliedData && suppliedData.map((data) => ( handleClickMktModal(data, event)}> - +
{`${data.title}-Icon`} @@ -178,7 +178,7 @@ const SuppliedTokenTable = (props) => { : '0.00'} - + diff --git a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx index 6834e513..005c0875 100644 --- a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx @@ -2,164 +2,146 @@ /* eslint-disable import/extensions */ /* eslint-disable import/no-unresolved */ // eslint-disable-next-line no-use-before-define -import React, { useState } from "react"; -import { useSelector } from "react-redux"; +import React, { useState } from 'react'; +import { useSelector } from 'react-redux'; -import { decimals } from "tezoslendingplatformjs"; -import BigNumber from "bignumber.js"; +import { decimals } from 'tezoslendingplatformjs'; +import BigNumber from 'bignumber.js'; -import Table from "@mui/material/Table"; -import TableBody from "@mui/material/TableBody"; -import TableCell from "@mui/material/TableCell"; -import TableContainer from "@mui/material/TableContainer"; -import TableHead from "@mui/material/TableHead"; -import TableRow from "@mui/material/TableRow"; -import { Button, Typography } from "@mui/material"; +import Table from '@mui/material/Table'; +import TableBody from '@mui/material/TableBody'; +import TableCell from '@mui/material/TableCell'; +import TableContainer from '@mui/material/TableContainer'; +import TableHead from '@mui/material/TableHead'; +import TableRow from '@mui/material/TableRow'; +import { Button, Typography } from '@mui/material'; -import { decimalify, nFormatter, roundValue } from "../../util"; +import { decimalify, nFormatter, roundValue } from '../../util'; -import AllMarketModal from "../AllMarketModal"; -import TableSkeleton from "../Skeleton"; +import AllMarketModal from '../AllMarketModal'; +import TableSkeleton from '../Skeleton'; -import { useStyles } from "./style"; +import { useStyles } from './style'; const SupplyMarketTokenTable = (props) => { - const classes = useStyles(); - const { tableData } = props; - const { address } = useSelector((state: any) => state.addWallet.account); + const classes = useStyles(); + const { tableData } = props; + const { address } = useSelector((state: any) => state.addWallet.account); - const [tokenDetails, setTokenDetails] = useState(); - const [openMktModal, setMktModal] = useState(false); + const [tokenDetails, setTokenDetails] = useState(); + const [openMktModal, setMktModal] = useState(false); - const closeModal = () => { - setMktModal(false); - }; + const closeModal = () => { + setMktModal(false); + }; - const handleClickMktModal = (item) => { - setTokenDetails(item); - setMktModal(true); - }; + const handleClickMktModal = (item) => { + setTokenDetails(item); + setMktModal(true); + }; - return ( - - {tokenDetails && ( - - )} - - - - Token - Wallet - Supply APY - - - - - {tableData?.map((data) => ( - - {(address && data.walletBalance) || - (!address && data.marketSize) ? ( - handleClickMktModal(data)} - > - -
-
- {`${data.title}-Icon`} + return ( + + {tokenDetails && } +
+ + + Token + Wallet + Supply APY + + + + + {tableData?.map((data) => ( + + {(address && data.walletBalance) || (!address && data.marketSize) ? ( + handleClickMktModal(data)}> + +
+
+ {`${data.title}-Icon`} -
- - {" "} - {data.name}{" "} - - - {" "} - {data.title}{" "} - -
-
-
-
- - - {data.walletBalance > 0 - ? decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ) < 0.01 - ? '>0.00' - : nFormatter( - decimalify( - data.walletBalance.toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : '0'}{" "} - {data.title} - {" "} -
- - $ - {data.walletBalance > 0 - ? nFormatter( - decimalify( - (data.walletBalance * data.usdPrice).toString(), - decimals[data.title], - decimals[data.title], - ), - ) - : "0.00"} - -
- - - {data.supplyRate > 0 - ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) - new BigNumber(data.supplyRate).gt( - new BigNumber(10000000000000000), - ) - ? roundValue(decimalify(data.supplyRate, 18)) - : "<0.01" - : "0"} - % - - - - - - - -
- ) : ( - - )} -
- ))} -
-
-
- ); +
+ {data.name} + + {' '} + {data.title}{' '} + +
+
+
+
+ + + {data.walletBalance > 0 + ? decimalify( + data.walletBalance.toString(), + decimals[data.title], + decimals[data.title], + ) < 0.01 + ? '>0.00' + : nFormatter( + decimalify( + data.walletBalance.toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : '0'}{' '} + {data.title} + {' '} +
+ + $ + {data.walletBalance > 0 + ? nFormatter( + decimalify( + (data.walletBalance * data.usdPrice).toString(), + decimals[data.title], + decimals[data.title], + ), + ) + : '0.00'} + +
+ + + {data.supplyRate > 0 + ? // checks if rate is lower than 0.1% (all rates lower than 0.01% is shown as <0.01%) + new BigNumber(data.supplyRate).gt(new BigNumber(10000000000000000)) + ? roundValue(decimalify(data.supplyRate, 18)) + : '<0.01' + : '0'} + % + + + + + + + +
+ ) : ( + + )} + + ))} + + + + ); }; export default SupplyMarketTokenTable; diff --git a/src/ui/src/components/Dashboard/index.tsx b/src/ui/src/components/Dashboard/index.tsx index 6bf7db67..84a2a47d 100644 --- a/src/ui/src/components/Dashboard/index.tsx +++ b/src/ui/src/components/Dashboard/index.tsx @@ -25,7 +25,9 @@ const Dashboard = () => { const { suppliedMarkets, borrowedMarkets, allMarkets } = useSelector((state: any) => state.market); useEffect(() => { - if (!markets) { return; } + if (!markets) { + return; + } dispatch(allMarketAction(account, markets)); dispatch(suppliedMarketAction(allMarkets)); @@ -36,7 +38,7 @@ const Dashboard = () => { Supplying - + Borrowing diff --git a/src/ui/src/components/Dashboard/style.ts b/src/ui/src/components/Dashboard/style.ts index c05fe712..0b168de2 100644 --- a/src/ui/src/components/Dashboard/style.ts +++ b/src/ui/src/components/Dashboard/style.ts @@ -1,180 +1,178 @@ /* eslint-disable import/prefer-default-export */ -import { makeStyles } from "@mui/styles"; +import { makeStyles } from '@mui/styles'; export const useStyles = makeStyles({ - root: { - - "& .MuiTypography-root": { - "@media(max-width: 501px)": { - fontSize: "0.75rem", - }, - "@media(max-width: 320px)": { - fontSize: "0.625rem", - }, - }, - "& .MuiTable-root": { - flexDirection: "column", - width: "100%", - alignItems: "center", - justifyContent: "center", - "& .MuiTableRow-root": { - paddingRight: "0rem", - marginRight: "0rem", - }, - }, - "& .MuiTableCell-root": { - color: "#000", - borderBottom: "1px solid #E0E0E0", - padding: ".75rem", - whiteSpace: "nowrap", - "@media(min-width: 1200px)": { - paddingLeft: "1.5rem", - }, - "@media(max-width: 501px)": { - padding: ".5rem", - }, - }, - "& .MuiTableHead-root ": { - "& .MuiTableRow-root": { - height: "3.5rem", - }, - "& .MuiTableCell-root": { - color: "#000", - opacity: "0.6", - fontSize: ".875rem", - "@media(min-width: 768px)": { - minWidth: "5.5625rem", + root: { + '& .MuiTypography-root': { + '@media(max-width: 501px)': { + fontSize: '0.75rem', + }, + '@media(max-width: 320px)': { + fontSize: '0.625rem', + }, }, - "@media(max-width: 1200px)": { - fontSize: "0.75rem", + '& .MuiTable-root': { + flexDirection: 'column', + width: '100%', + alignItems: 'center', + justifyContent: 'center', + '& .MuiTableRow-root': { + paddingRight: '0rem', + marginRight: '0rem', + }, }, - "@media(max-width: 501px)": { - fontSize: "0.625rem", + '& .MuiTableCell-root': { + color: '#000', + borderBottom: '1px solid #E0E0E0', + padding: '.75rem', + whiteSpace: 'nowrap', + '@media(min-width: 1200px)': { + paddingLeft: '1.5rem', + }, + '@media(max-width: 501px)': { + padding: '.5rem', + }, }, - "@media(max-width: 320px)": { - fontSize: "0.75rem", + '& .MuiTableHead-root ': { + '& .MuiTableRow-root': { + height: '3.5rem', + }, + '& .MuiTableCell-root': { + color: '#000', + opacity: '0.6', + fontSize: '.875rem', + '@media(min-width: 768px)': { + minWidth: '5.5625rem', + }, + '@media(max-width: 1200px)': { + fontSize: '0.75rem', + }, + '@media(max-width: 501px)': { + fontSize: '0.625rem', + }, + '@media(max-width: 320px)': { + fontSize: '0.75rem', + }, + }, }, - }, - }, - "& .MuiTableBody-root ": { - "& .MuiTableRow-root:last-of-type": { - "& .MuiTableCell-root": { - padding: "-10px", - marginRight: "10px", - borderBottom: "0", + '& .MuiTableBody-root ': { + '& .MuiTableRow-root:last-of-type': { + '& .MuiTableCell-root': { + padding: '-10px', + marginRight: '10px', + borderBottom: '0', + }, + }, + '& .MuiTableRow-root': { + height: '4.5rem', + '&:hover': { + background: '#DDF5FC66', + }, + }, + '& .MuiTableCell-root': { + fontWeight: '400', + '@media(min-width: 1200px)': { + fontSize: '1rem', + }, + '@media(max-width: 768px)': { + fontSize: '0.875rem', + }, + '@media(max-width: 501px)': { + fontSize: '0.75rem', + }, + }, }, - }, - "& .MuiTableRow-root": { - height: "4.5rem", - "&:hover": { - background: "#DDF5FC66", + }, + tableCon: { + padding: '0px', + background: '#fff', + borderBottom: '0', + borderRadius: '1rem', + '&::-webkit-scrollbar': { + display: 'none', }, - }, - "& .MuiTableCell-root": { - fontWeight: "400", - "@media(min-width: 1200px)": { - fontSize: "1rem", + boxShadow: '2px 4px 23px 5px rgba(163,163,163,0.096)', + }, + questionCircleIcon: { + width: '1rem', + height: '1rem', + marginBottom: '-3px', + }, + img: { + //width: "7%", + //height: "7%", + // marginRight: "20%", + width: '2.5rem', + height: '2.5rem', + marginRight: '1rem', + '@media (min-width: 769px) and (max-width: 1024px)': { + width: '2.5rem', + height: '2.5rem', }, - "@media(max-width: 768px)": { - fontSize: "0.875rem", + '@media(max-width: 768px)': { + width: '2.5rem', + height: '2.5rem', }, - "@media(max-width: 501px)": { - fontSize: "0.75rem", + '@media(max-width: 501px)': { + width: '2.5rem', + height: '2.5rem', }, - }, }, - }, - tableCon: { - padding: "0px", - background: "#fff", - borderBottom: "0", - borderRadius: "1rem", - "&::-webkit-scrollbar": { - display: "none", + tokenSymbol: { + display: 'inline', + color: '#000', + opacity: '0.6', + fontSize: '1rem', + fontWeight: '400', + letterSpacing: '0.005em', + lineHeight: '1.875rem', + '@media(max-width: 1200px)': { + fontSize: '1rem', + }, + '@media(max-width: 768px)': { + fontSize: '1rem', + }, }, - boxShadow: "2px 4px 23px 5px rgba(163,163,163,0.096)", - }, - questionCircleIcon: { - width: "1rem", - height: "1rem", - marginBottom: "-3px", - }, - img: { - //width: "7%", - //height: "7%", - // marginRight: "20%", - width: "2.5rem", - height: "2.5rem", - marginRight: "1rem", - "@media (min-width: 769px) and (max-width: 1024px)": { - width: "2.5rem", - height: "2.5rem", - }, - "@media(max-width: 768px)": { - width: "2.5rem", - height: "2.5rem", - }, - "@media(max-width: 501px)": { - width: "2.5rem", - height: "2.5rem", - }, - }, - tokenSymbol: { - display: "inline", - color: "#000", - opacity: "0.6", - fontSize: "1rem", - fontWeight: "400", - letterSpacing: "0.005em", - lineHeight: "1.875rem", - "@media(max-width: 1200px)": { - fontSize: "1rem", + token: { + display: 'flex', + flexDirection: 'row', + alignItems: 'center', + alignContent: 'center', + alignText: 'center', + padding: '0px', }, - "@media(max-width: 768px)": { - fontSize: "1rem", + tokenTitle: { + display: 'flex', + flexDirection: 'column', }, - }, - token: { - display: "flex", - flexDirection: "row", - alignItems: "center", - alignContent: "center", - alignText: "center", - padding: "0px", - }, - tokenTitle: { - display: "flex", - flexDirection: "column", - }, - tokenName: { - display: "inline", - color: "#000", - opacity: "0.87", - fontSize: "1rem", - fontWeight: "400", - letterSpacing: "0.005em", - lineHeight: "1.875rem", - "@media(max-width: 1200px)": { - fontSize: "1rem", + tokenName: { + display: 'inline', + color: '#000', + opacity: '0.87', + fontSize: '1rem', + fontWeight: '400', + letterSpacing: '0.005em', + lineHeight: '1.875rem', + '@media(max-width: 1200px)': { + fontSize: '1rem', + }, + '@media(max-width: 768px)': { + fontSize: '1rem', + }, }, - "@media(max-width: 768px)": { - fontSize: "1rem", + clearFont: { + color: '#000', + opacity: '0.87', + fontWeight: '400', }, - }, - clearFont: { - color: "#000", - opacity: "0.87", - fontWeight: "400", - }, - faintFont: { - color: "#000", - opacity: "0.6", - fontWeight: "400", - fontSize: "0.875rem", - }, - compositionOne: { + faintFont: { + color: '#000', + opacity: '0.6', + fontWeight: '400', + fontSize: '0.875rem', }, - dashboard: { + compositionOne: {}, + dashboard: { paddingLeft: '6.25rem', paddingRight: '6.25rem', '@media(max-width: 1024px)': { @@ -193,90 +191,88 @@ export const useStyles = makeStyles({ paddingLeft: '1rem', paddingRight: '1rem', }, - }, - borrowTablePadding: { - "@media(max-width: 600px)": { - paddingRight: "1.975rem", - }, - "@media(min-width: 900px)": { - paddingRight: "0.975rem", - }, - "@media(min-width: 1024px)": { - paddingRight: "0.9375rem", }, - "@media(min-width: 1200px)": { - paddingRight: "0.875rem", - }, - }, - supplyTablePadding: { - "@media(min-width: 600px)": { - paddingRight: "1rem", + borrowTablePadding: { + '@media(max-width: 600px)': { + paddingRight: '1.975rem', + }, + '@media(min-width: 900px)': { + paddingRight: '0.975rem', + }, + '@media(min-width: 1024px)': { + paddingRight: '0.9375rem', + }, + '@media(min-width: 1200px)': { + paddingRight: '0.875rem', + }, }, - "@media(min-width: 900px)": { - paddingRight: "2rem", + supplyTablePadding: { + '@media(min-width: 600px)': { + paddingRight: '1rem', + }, + '@media(min-width: 900px)': { + paddingRight: '2rem', + }, + '@media(min-width: 1024px)': { + paddingRight: '2rem', + }, + '@media(min-width: 1200px)': { + paddingRight: '3rem', + }, }, - "@media(min-width: 1024px)": { - paddingRight: "2rem", + firstCell: { + width: '10%', }, - "@media(min-width: 1200px)": { - paddingRight: "3rem", + secondCell: {}, + thirdCell: {}, + fourthCell: { + width: '30%', }, - }, - firstCell: { - width: "10%", - }, - secondCell: { - }, - thirdCell: { - }, - fourthCell: { - width: "30%", - }, - fifthCell: { - width: "30%", - right: "10px", - }, - supplyButton: { - borderRadius: "8px", - marginRight: "30%", - marginLeft: "10%", - width: "50%", - }, - tableTitle: { - color: "#000", - opacity: "0.87", - padding: " 1.5rem 0 .5rem", - fontSize: "1.25rem", - fontWeight: "500", - lineHeight: "30px", - }, - emptyStateText: { - color: "#000", - fontSize: "1rem", - fontWeight: "400", - lineHeight: "30px", - letterSpacing: "0.005em", - "@media(min-width: 768px)": { - padding: "21px 35px 21px 30px !important", + fifthCell: { + width: '30%', + right: '10px', }, - }, - collateralPadding: { - "@media(min-width: 968px)": { - paddingRight: ".5rem !important", + supplyButton: { + borderRadius: '8px', + marginRight: '30%', + marginLeft: '10%', + width: '50%', }, - "@media(min-width: 1200px)": { - paddingRight: "2rem !important", + tableTitle: { + color: '#000', + opacity: '0.87', + padding: ' 1.5rem 0 .5rem', + fontSize: '1.25rem', + fontWeight: '500', + lineHeight: '30px', }, - }, - switchPadding: { - "@media(min-width: 501px)": { - paddingRight: "2.5rem !important", + emptyStateText: { + color: '#000', + fontSize: '1rem', + fontWeight: '400', + lineHeight: '30px', + letterSpacing: '0.005em', + '@media(min-width: 768px)': { + padding: '21px 35px 21px 30px !important', + }, }, - "@media(min-width: 968px)": { - paddingRight: "2rem !important", + collateralPadding: { + '@media(min-width: 968px)': { + paddingRight: '.5rem !important', + }, + '@media(min-width: 1200px)': { + paddingRight: '2rem !important', + }, }, - "@media(min-width: 1200px)": { - paddingRight: "4rem !important", + switchPadding: { + '@media(min-width: 501px)': { + paddingRight: '2.5rem !important', + }, + '@media(min-width: 968px)': { + paddingRight: '2rem !important', + }, + '@media(min-width: 1200px)': { + paddingRight: '4rem !important', + }, }, - }, }); diff --git a/src/ui/src/components/Switch/index.js b/src/ui/src/components/Switch/index.js index 19e47824..bd0caa83 100644 --- a/src/ui/src/components/Switch/index.js +++ b/src/ui/src/components/Switch/index.js @@ -3,79 +3,68 @@ import * as React from 'react'; import clsx from 'clsx'; import { styled } from '@mui/system'; import { useSwitch } from '@mui/core/SwitchUnstyled'; -import MuiSwitch from '@mui/material/Switch'; +import MuiSwitch from '@mui/material/Switch'; const CustomSwitch = styled((props) => ( - + ))(({ theme }) => ({ - width: 42, - height: 26, - padding: 0, - '& .MuiSwitch-switchBase': { + width: 42, + height: 26, padding: 0, - margin: 2.9, - transitionDuration: '300ms', - transform: 'translateX(1px) scale(0.5)', - color: '#79747E', - '&.Mui-checked': { - padding: 0, - margin: 2, - width: "22px", - height: "22px", + '& .MuiSwitch-switchBase': { + padding: 0, + margin: 2.9, + transitionDuration: '300ms', + transform: 'translateX(1px) scale(0.5)', + color: '#79747E', + '&.Mui-checked': { + padding: 0, + margin: 2, + width: '22px', + height: '22px', - transform: 'translateX(18px) scale(1)', - color: '#EADDFF', - '& + .MuiSwitch-track': { - border: '0px solid red', - backgroundColor: '#9F329F', - opacity: 1, - border: 0, - }, - '&.Mui-disabled': { - border: '6px solid #fff', - opacity: 0.5, - }, + transform: 'translateX(18px) scale(1)', + color: '#EADDFF', + '& + .MuiSwitch-track': { + border: '0px solid red', + backgroundColor: '#9F329F', + opacity: 1, + border: 0, + }, + '&.Mui-disabled': { + border: '6px solid #fff', + opacity: 0.5, + }, + }, + '&.Mui-focusVisible .MuiSwitch-thumb': {}, + '&.Mui-disabled + .MuiSwitch-thumb': {}, }, - '&.Mui-focusVisible .MuiSwitch-thumb': { + '& .MuiSwitch-thumb': { + boxSizing: 'border-box', }, - '&.Mui-disabled + .MuiSwitch-thumb': { + '& .MuiSwitch-track': { + border: '2px solid #79747E', + borderRadius: 26 / 2, + backgroundColor: '#E6E0E9', + opacity: 1, + transition: theme.transitions.create(['background-color'], { + duration: 500, + }), }, - }, - '& .MuiSwitch-thumb': { - boxSizing: 'border-box', - }, - '& .MuiSwitch-track': { - border: '2px solid #79747E', - borderRadius: 26 / 2, - backgroundColor: '#E6E0E9', - opacity: 1, - transition: theme.transitions.create(['background-color'], { - duration: 500, - }), - }, })); - + function BasicSwitch(props) { - const { getInputProps, checked, disabled, focusVisible } = useSwitch(props); + const { getInputProps, checked, disabled, focusVisible } = useSwitch(props); - return ( - - ); + return ; } export default function Switch(props) { - const { data } = props; + const { data } = props; - return ( -
- -
- ); + return ( +
+ +
+ ); } diff --git a/src/util/src/TezosLendingPlatform.ts b/src/util/src/TezosLendingPlatform.ts index e1a5d472..4767ed74 100644 --- a/src/util/src/TezosLendingPlatform.ts +++ b/src/util/src/TezosLendingPlatform.ts @@ -100,7 +100,6 @@ export namespace TezosLendingPlatform { supply.totalAmount.minus(borrow.totalAmount).minus(fToken.totalReserves), fToken); - console.log("!!! " + underlying.assetType + ": " + " Supply bigint " + supply.totalAmount + ", borrow bigint " + borrow.totalAmount + ", supply - borrow bigint " + borrow.totalAmount.minus(supply.totalAmount) + ", available BigNumber " + available); return { currentPrice: price, address: address, From a5e43f7b0ca52fd7d31e6e34ade845dbd401b889 Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Fri, 1 Nov 2024 18:49:39 +0530 Subject: [PATCH 11/13] spacing --- src/ui/src/components/Dashboard/index.tsx | 10 +++++++--- src/ui/src/components/Dashboard/style.ts | 17 +++++++++++++---- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/src/ui/src/components/Dashboard/index.tsx b/src/ui/src/components/Dashboard/index.tsx index 84a2a47d..c939d78c 100644 --- a/src/ui/src/components/Dashboard/index.tsx +++ b/src/ui/src/components/Dashboard/index.tsx @@ -5,7 +5,7 @@ import React, { useEffect } from 'react'; import { useDispatch, useSelector } from 'react-redux'; import Grid from '@mui/material/Grid'; -import { Typography } from '@mui/material'; +import { Box, Typography } from '@mui/material'; import BorrowedTokenTable from './BorrowedTokenTable'; import SuppliedTokenTable from './SuppliedTokenTable'; @@ -45,11 +45,15 @@ const Dashboard = () => {
- Assets to Supply + + Assets to Supply + - Assets to Borrow + + Assets to Borrow +
diff --git a/src/ui/src/components/Dashboard/style.ts b/src/ui/src/components/Dashboard/style.ts index 0b168de2..cc77f8b9 100644 --- a/src/ui/src/components/Dashboard/style.ts +++ b/src/ui/src/components/Dashboard/style.ts @@ -194,16 +194,16 @@ export const useStyles = makeStyles({ }, borrowTablePadding: { '@media(max-width: 600px)': { - paddingRight: '1.975rem', + paddingLeft: '0.975rem', }, '@media(min-width: 900px)': { - paddingRight: '0.975rem', + paddingLeft: '0.975rem', }, '@media(min-width: 1024px)': { - paddingRight: '0.9375rem', + paddingLeft: '0.9375rem', }, '@media(min-width: 1200px)': { - paddingRight: '0.875rem', + paddingLeft: '0.875rem', }, }, supplyTablePadding: { @@ -238,6 +238,15 @@ export const useStyles = makeStyles({ marginLeft: '10%', width: '50%', }, + tableTitle2: { + color: '#000', + opacity: '0.87', + padding: ' 1.5rem 0 .5rem', + display: 'inline-block', + fontSize: '1.25rem', + fontWeight: '500', + lineHeight: '30px', + }, tableTitle: { color: '#000', opacity: '0.87', From cdbfa569d761537070b4ecd98c7dd5ad7bc23bbf Mon Sep 17 00:00:00 2001 From: Siddharth Vaderaa Date: Wed, 27 Nov 2024 12:10:32 +0530 Subject: [PATCH 12/13] One column view --- .../Dashboard/BorrowMarketTokenTable.tsx | 14 +------ src/ui/src/components/Dashboard/index.tsx | 16 +++----- src/ui/src/components/Dashboard/style.ts | 40 ++++++++++++++----- src/ui/src/components/Switch/index.js | 33 ++++++++++----- 4 files changed, 62 insertions(+), 41 deletions(-) diff --git a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index 62f60bae..d6913906 100644 --- a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -136,7 +136,7 @@ const BorrowMarketTokenTable = (props) => { diff --git a/src/ui/src/components/Dashboard/index.tsx b/src/ui/src/components/Dashboard/index.tsx index c939d78c..ecb79ae9 100644 --- a/src/ui/src/components/Dashboard/index.tsx +++ b/src/ui/src/components/Dashboard/index.tsx @@ -36,24 +36,20 @@ const Dashboard = () => { return ( - + Supplying - + Borrowing - - - Assets to Supply - + + Assets to Supply - - - Assets to Borrow - + + Assets to Borrow diff --git a/src/ui/src/components/Dashboard/style.ts b/src/ui/src/components/Dashboard/style.ts index cc77f8b9..1a1483fa 100644 --- a/src/ui/src/components/Dashboard/style.ts +++ b/src/ui/src/components/Dashboard/style.ts @@ -145,6 +145,28 @@ export const useStyles = makeStyles({ display: 'flex', flexDirection: 'column', }, + borrowButton: { + marginRight: '0%', + borderRadius: '8px', + right: '10%', + '@media(max-width: 900px)': { + right: '10%' + }, + '@media(max-width: 768px)': { + }, + '@media(max-width: 501px)': { + }, + }, + detailsButton: { + color: '#2C2C2C', + border: '1px solid #2C2C2C', + borderRadius: '8px', + backgroundColor: '#F2F3F7', + '&:hover': { + backgroundColor: 'lightgrey', + boxShadow: 'none', + }, + }, tokenName: { display: 'inline', color: '#000', @@ -193,12 +215,12 @@ export const useStyles = makeStyles({ }, }, borrowTablePadding: { - '@media(max-width: 600px)': { - paddingLeft: '0.975rem', - }, - '@media(min-width: 900px)': { - paddingLeft: '0.975rem', - }, + '@media(min-width: 600px)': { + paddingRight: '1rem', + }, + '@media(min-width: 900px)': { + paddingRight: '2rem', + }, '@media(min-width: 1024px)': { paddingLeft: '0.9375rem', }, @@ -234,9 +256,9 @@ export const useStyles = makeStyles({ }, supplyButton: { borderRadius: '8px', - marginRight: '30%', - marginLeft: '10%', - width: '50%', + marginRight: '50%', + marginLeft: '0%', + width: '80%', }, tableTitle2: { color: '#000', diff --git a/src/ui/src/components/Switch/index.js b/src/ui/src/components/Switch/index.js index bd0caa83..6bf96c1b 100644 --- a/src/ui/src/components/Switch/index.js +++ b/src/ui/src/components/Switch/index.js @@ -1,13 +1,19 @@ // eslint-disable-next-line no-use-before-define -import * as React from 'react'; -import clsx from 'clsx'; +import React, { forwardRef } from 'react'; import { styled } from '@mui/system'; import { useSwitch } from '@mui/core/SwitchUnstyled'; import MuiSwitch from '@mui/material/Switch'; -const CustomSwitch = styled((props) => ( - -))(({ theme }) => ({ +const CustomSwitch = styled( + forwardRef((props, ref) => ( + + )), +)(({ theme }) => ({ width: 42, height: 26, padding: 0, @@ -22,7 +28,6 @@ const CustomSwitch = styled((props) => ( margin: 2, width: '22px', height: '22px', - transform: 'translateX(18px) scale(1)', color: '#EADDFF', '& + .MuiSwitch-track': { @@ -53,12 +58,20 @@ const CustomSwitch = styled((props) => ( }, })); -function BasicSwitch(props) { - const { getInputProps, checked, disabled, focusVisible } = useSwitch(props); +const BasicSwitch = forwardRef((props, ref) => { + const { getInputProps, checked, disabled } = useSwitch(props); - return ; -} + return ( + + ); +}); +// Switch component export default function Switch(props) { const { data } = props; From 68b6dd45af765ea432f9b8bfdac0e52e4b32e49a Mon Sep 17 00:00:00 2001 From: "ilya.razievskij" Date: Tue, 21 Jan 2025 11:35:10 +0200 Subject: [PATCH 13/13] feat: sticky columns --- .../Dashboard/BorrowMarketTokenTable.tsx | 69 ++++++++++--------- .../Dashboard/SupplyMarketTokenTable.tsx | 36 +++++----- src/ui/src/components/Dashboard/style.ts | 33 +++++++-- 3 files changed, 80 insertions(+), 58 deletions(-) diff --git a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx index d6913906..9015904b 100644 --- a/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx @@ -54,10 +54,13 @@ const BorrowMarketTokenTable = (props) => { - Token + + Token + Available Borrow APY - + + @@ -65,22 +68,20 @@ const BorrowMarketTokenTable = (props) => { {(address && data.walletBalance) || (!address && data.marketSize) ? ( - -
-
- {`${data.title}-Icon`} + +
+ {`${data.title}-Icon`} -
- {data.name} - - {' '} - {data.title}{' '} - -
+
+ {data.name} + + {' '} + {data.title}{' '} +
@@ -131,24 +132,24 @@ const BorrowMarketTokenTable = (props) => { % - - - - + + + - + ) : ( diff --git a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx index 005c0875..129e9b9c 100644 --- a/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx +++ b/src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx @@ -46,10 +46,12 @@ const SupplyMarketTokenTable = (props) => {
- Token + + Token + Wallet Supply APY - + @@ -57,22 +59,20 @@ const SupplyMarketTokenTable = (props) => { {(address && data.walletBalance) || (!address && data.marketSize) ? ( handleClickMktModal(data)}> - -
-
- {`${data.title}-Icon`} + +
+ {`${data.title}-Icon`} -
- {data.name} - - {' '} - {data.title}{' '} - -
+
+ {data.name} + + {' '} + {data.title}{' '} +
@@ -120,7 +120,7 @@ const SupplyMarketTokenTable = (props) => { % - +