Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 13 additions & 6 deletions src/ui/src/components/Dashboard/BorrowMarketTokenTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import React, { useState } from 'react';
import { useSelector } from 'react-redux';

import { decimals } from 'tezoslendingplatformjs';
import { AssetType, decimals, mainnetAddresses, testnetAddresses } from 'tezoslendingplatformjs';
import BigNumber from 'bignumber.js';

import Table from '@mui/material/Table';
Expand Down Expand Up @@ -35,9 +35,13 @@ const BorrowMarketTokenTable = (props) => {
setMktModal(false);
};

const handleClickDetails = (address) => {
const handleClickDetails = (asset: AssetType) => {
const fTokenAddress =
process.env.REACT_APP_ENV == 'dev' ? testnetAddresses.fTokens[asset] : mainnetAddresses.fTokens[asset];
const tzktUrl =
process.env.REACT_APP_ENV == 'dev' ? `https://ghostnet.tzkt.io/${address}` : `https://tzkt.io/${address}`;
process.env.REACT_APP_ENV == "dev"
? `https://ghostnet.tzkt.io/${fTokenAddress}/operations`
: `https://tzkt.io/${fTokenAddress}/operations`;
window.open(tzktUrl, '_blank');
};

Expand All @@ -54,7 +58,9 @@ const BorrowMarketTokenTable = (props) => {
<Table>
<TableHead>
<TableRow>
<TableCell>Token</TableCell>
<TableCell className={classes.stickyCellLeft}>
Token
</TableCell>
<TableCell align="center"> Available </TableCell>
<TableCell align="center"> Borrow APY </TableCell>
<TableCell align="center" className={classes.stickyCellRight}> </TableCell>
Expand All @@ -66,7 +72,7 @@ const BorrowMarketTokenTable = (props) => {
<React.Fragment key={data.title}>
{(address && data.walletBalance) || (!address && data.marketSize) ? (
<TableRow key={data.title}>
<TableCell className={classes.firstCell}>
<TableCell className={`${classes.firstCell} ${classes.stickyCellLeft} ${classes.stickyCellHover}`}>
<div className={classes.token}>
<img
src={data.logo}
Expand Down Expand Up @@ -130,7 +136,7 @@ const BorrowMarketTokenTable = (props) => {
%
</span>
</TableCell>
<TableCell className={`${classes.stickyCellRight} ${classes.borrowCell}`}>
<TableCell className={`${classes.stickyCellRight} ${classes.borrowCell} ${classes.stickyCellHover}`}>
<Button
variant="contained"
size="medium"
Expand All @@ -145,6 +151,7 @@ const BorrowMarketTokenTable = (props) => {
variant="contained"
size="medium"
className={classes.detailsButton}
onClick={() => handleClickDetails(data.assetType)}
>
D<Typography textTransform={'lowercase'}>etails</Typography>
</Button>
Expand Down
6 changes: 3 additions & 3 deletions src/ui/src/components/Dashboard/SupplyMarketTokenTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ const SupplyMarketTokenTable = (props) => {
</TableCell>
<TableCell align="center"> Wallet </TableCell>
<TableCell align="center"> Supply APY </TableCell>
<TableCell align="center"> </TableCell>
<TableCell className={classes.stickyCellRight} align="center"> </TableCell>
</TableRow>
</TableHead>
<TableBody>
{tableData?.map((data) => (
<React.Fragment key={data.title}>
{(address && data.walletBalance) || (!address && data.marketSize) ? (
<TableRow key={data.title} onClick={() => handleClickMktModal(data)}>
<TableCell className={`${classes.firstCell} ${classes.stickyCellLeft}`}>
<TableCell className={`${classes.firstCell} ${classes.stickyCellLeft} ${classes.stickyCellHover}`}>
<div className={classes.token}>
<img
src={data.logo}
Expand Down Expand Up @@ -120,7 +120,7 @@ const SupplyMarketTokenTable = (props) => {
%
</span>
</TableCell>
<TableCell align="center" className={classes.fourthCell}>
<TableCell align="center" className={`${classes.fourthCell} ${classes.stickyCellRight} ${classes.stickyCellHover}`}>
<span>
<Button
variant="contained"
Expand Down
36 changes: 22 additions & 14 deletions src/ui/src/components/Dashboard/style.ts
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ export const useStyles = makeStyles({
borderRadius: '8px',
'@media(max-width: 768px)': {},
'@media(max-width: 501px)': {},
width: '100%',
},
detailsButton: {
color: '#2C2C2C',
Expand All @@ -163,6 +164,7 @@ export const useStyles = makeStyles({
backgroundColor: 'lightgrey',
boxShadow: 'none',
},
width: '100%',
},
tokenName: {
display: 'inline',
Expand Down Expand Up @@ -194,6 +196,7 @@ export const useStyles = makeStyles({
dashboard: {
paddingLeft: '6.25rem',
paddingRight: '6.25rem',
paddingBottom: '1.5rem',
'@media(max-width: 1024px)': {
paddingLeft: '4rem',
paddingRight: '4rem',
Expand Down Expand Up @@ -319,21 +322,26 @@ export const useStyles = makeStyles({
},
},
stickyCellLeft: {
'@media(max-width: 1300px)': {
position: 'sticky',
zIndex: 2,
left: 0,
opacity: '1 !important',
backgroundColor: 'white',
},
position: 'sticky',
zIndex: 2,
left: 0,
opacity: '1 !important',
backgroundColor: 'white',
borderBottom: '0 !important',
boxShadow: 'inset 0 -1px 0 #E0E0E0',
},
stickyCellRight: {
'@media(max-width: 1300px)': {
position: 'sticky',
zIndex: 2,
right: 0,
opacity: '1 !important',
backgroundColor: 'white',
},
position: 'sticky',
zIndex: 2,
right: 0,
opacity: '1 !important',
backgroundColor: 'white',
boxShadow: 'inset 0 -1px 0 #E0E0E0',
borderBottom: '0 !important',
},
stickyCellHover: {
'.MuiTableRow-root:hover &': {
backgroundColor: '#F5FCFE',
}
}
});