Skip to content

Commit

Permalink
feat: add tooltip to pools and refactor loans tooltip (#1424)
Browse files Browse the repository at this point in the history
* feat: add tooltip to pools and refactor loans tooltip

* fix: code review

* fix: code reivew

---------

Co-authored-by: Thomas Jeatt <[email protected]>
  • Loading branch information
danielsimao and tomjeatt authored Jul 20, 2023
1 parent 79ac979 commit 5c6a8df
Show file tree
Hide file tree
Showing 23 changed files with 305 additions and 292 deletions.
11 changes: 10 additions & 1 deletion src/assets/locales/en/translation.json
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@
"claim_rewards": "Claim Rewards",
"tx_fees": "Tx fees",
"view_subscan": "View Subscan",
"apr_breakdown": "APR Breakdown",
"apy_breakdown": "APY Breakdown",
"earned": "Earned",
"rewards_apr": "Rewards APR",
"rewards_apr_ticker": "Rewards APR {{ticker}}",
"wallet": "Wallet",
"navigation": {
"btc": "BTC",
Expand Down Expand Up @@ -590,6 +595,9 @@
"action_liquidation_risk": "{{action}} this amount will increase your LTV, thus also increasing the risk of liquidation.",
"no_loan_positions": "No {{loanType}} positions",
"your_loan_positions_will_show_here": "Your {{loanType}} positions will show here",
"owed": "Owed",
"lend_apy_ticker": "Lend APY {{ticker}}",
"borrow_apy_ticker": "Borrow APY {{ticker}}",
"borrowed": "Borrowed",
"supplied": "Supplied",
"total_supplied": "Total Supplied",
Expand All @@ -603,7 +611,8 @@
"pool_name": "Pool Name",
"add_liquidity": "Add Liquidity",
"remove_liquidity": "Remove Liquidity",
"initial_rate_warning": "Note: You are setting the initial exchange rate of this pool. Make sure it reflects the exchange rate on other markets, please."
"initial_rate_warning": "Note: You are setting the initial exchange rate of this pool. Make sure it reflects the exchange rate on other markets, please.",
"trading_fee_apr": "Trading Fee APR"
},
"swap": "Swap",
"select_token": "Select Token",
Expand Down
10 changes: 10 additions & 0 deletions src/components/ApyDetails/ApyDetails.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import { Dl, DlProps } from '@/component-library';

type ApyDetailsProps = DlProps;

const ApyDetails = ({ direction = 'column', gap = 'spacing2', ...props }: ApyDetailsProps): JSX.Element => {
return <Dl direction={direction} gap={gap} {...props} />;
};

export { ApyDetails };
export type { ApyDetailsProps };
34 changes: 34 additions & 0 deletions src/components/ApyDetails/ApyDetailsGroup.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
import { ReactNode } from 'react';

import { Dd, Dl, DlGroup, DlGroupProps, Dt } from '@/component-library';

type Props = {
title: ReactNode;
};

type InheritAttrs = Omit<DlGroupProps, keyof Props>;

type ApyDetailsGroupProps = Props & InheritAttrs;

const ApyDetailsGroup = ({
direction = 'column',
gap = 'spacing1',
alignItems = 'flex-start',
title,
children,
...props
}: ApyDetailsGroupProps): JSX.Element => (
<DlGroup direction={direction} gap={gap} alignItems={alignItems} {...props}>
<Dt weight='bold' color='primary'>
{title}
</Dt>
<Dd>
<Dl direction='column' alignItems='flex-start' gap='spacing0'>
{children}
</Dl>
</Dd>
</DlGroup>
);

export { ApyDetailsGroup };
export type { ApyDetailsGroupProps };
32 changes: 32 additions & 0 deletions src/components/ApyDetails/ApyDetailsGroupItem.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
import { ReactNode } from 'react';

import { Dd, DlGroup, DlGroupProps, Dt } from '@/component-library';

type Props = {
label: ReactNode;
value: ReactNode;
};

type InheritAttrs = Omit<DlGroupProps, keyof Props | 'children'>;

type ApyDetailsGroupItemProps = Props & InheritAttrs;

const ApyDetailsGroupItem = ({
gap = 'spacing1',
wrap = 'wrap',
label,
value,
...props
}: ApyDetailsGroupItemProps): JSX.Element => (
<DlGroup wrap={wrap} gap={gap} {...props}>
<Dd weight='medium' color='tertiary'>
{label}:
</Dd>
<Dt weight='medium' color='primary'>
{value}
</Dt>
</DlGroup>
);

export { ApyDetailsGroupItem };
export type { ApyDetailsGroupItemProps };
6 changes: 6 additions & 0 deletions src/components/ApyDetails/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export type { ApyDetailsProps } from './ApyDetails';
export { ApyDetails } from './ApyDetails';
export type { ApyDetailsGroupProps } from './ApyDetailsGroup';
export { ApyDetailsGroup } from './ApyDetailsGroup';
export type { ApyDetailsGroupItemProps } from './ApyDetailsGroupItem';
export { ApyDetailsGroupItem } from './ApyDetailsGroupItem';
30 changes: 0 additions & 30 deletions src/components/LoanApyTooltip/AssetGroup.tsx

This file was deleted.

43 changes: 0 additions & 43 deletions src/components/LoanApyTooltip/BreakdownGroup.tsx

This file was deleted.

76 changes: 0 additions & 76 deletions src/components/LoanApyTooltip/LoanApyTooltip.tsx

This file was deleted.

32 changes: 0 additions & 32 deletions src/components/LoanApyTooltip/RewardsGroup.tsx

This file was deleted.

2 changes: 0 additions & 2 deletions src/components/LoanApyTooltip/index.tsx

This file was deleted.

68 changes: 0 additions & 68 deletions src/components/LoanPositionsTable/ApyCell.tsx

This file was deleted.

Loading

2 comments on commit 5c6a8df

@vercel
Copy link

@vercel vercel bot commented on 5c6a8df Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@vercel
Copy link

@vercel vercel bot commented on 5c6a8df Jul 20, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.