Skip to content

Commit

Permalink
Merge pull request #226 from lidofinance/set-attributes
Browse files Browse the repository at this point in the history
Add attributes withdrawal/reward pages
  • Loading branch information
itaven authored Feb 5, 2024
2 parents 620393f + 4984c7f commit e768031
Show file tree
Hide file tree
Showing 12 changed files with 30 additions and 29 deletions.
1 change: 1 addition & 0 deletions features/rewards/components/CopyAddressUrl.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const CopyAddressUrl = ({ address }: { address: string }) => {
size="xs"
variant="translucent"
onClick={handleCopy}
data-testid="copyAddressButton"
/>
);
};
Expand Down
1 change: 1 addition & 0 deletions features/rewards/components/CurrencySelector.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ const CurrencySelector = ({ currency, onChange }: CurrencySelectorProps) => (
<Box>
<StyledSelect
arrow="small"
data-testid="currencyPicker"
onChange={(option: string | number) => {
const optionString = option.toString();
onChange(optionString);
Expand Down
2 changes: 1 addition & 1 deletion features/rewards/components/addressInput/AddressInput.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ export const AddressInput: FC<AddressInputProps> = (props) => {
isAddressResolving ? (
<Loader size="small" />
) : address ? (
<Identicon address={address} />
<Identicon data-testid="addressIcon" address={address} />
) : null
}
rightDecorator={address ? <CopyAddressUrl address={inputValue} /> : null}
Expand Down
1 change: 1 addition & 0 deletions features/rewards/components/export/Export.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const Export = ({
color="primary"
size="sm"
variant="outlined"
data-testid="exportBtn"
>
Export CSV
</ButtonStyle>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export const RewardsListContent: FC = () => {
if (data && data.events.length === 0) return <ErrorBlockNoSteth />;

return (
<TableWrapperStyle>
<TableWrapperStyle data-testid="rewardsContent">
{data?.events.length && !error && (
<RewardsTable
data={data.events}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import { TitleStyle } from './styles';
export const RewardsListHeader: FC = () => {
const { error, data } = useRewardsHistory();
return (
<RewardsListHeaderStyle>
<RewardsListHeaderStyle data-testid="rewardsHeader">
<TitleStyle>Reward history</TitleStyle>
<LeftOptions />
{!error && data && data?.events.length > 0 && <RightOptions />}
Expand Down
1 change: 1 addition & 0 deletions features/rewards/components/rewardsTable/RewardsTable.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const RewardsTable: FC<RewardsTableProps> = (props) => {
onItemClick={(currentPage: number) => setPage(currentPage - 1)}
activePage={page + 1}
siblingCount={0}
data-testid="pagination"
/>
</>
);
Expand Down
41 changes: 18 additions & 23 deletions features/rewards/components/stats/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,17 +58,13 @@ export const Stats: FC<StatsProps> = (props) => {

return (
<>
<Item>
<Item data-testid="stEthBalanceBlock">
<Title mb="8px">stETH balance</Title>
<Stat mb="6px">
<Stat data-testid="stEthBalance" mb="6px">
<EthSymbol />
<NumberFormat
id="stEthBalance"
number={stEthBalanceParsed}
pending={pending}
/>
<NumberFormat number={stEthBalanceParsed} pending={pending} />
</Stat>
<Title hideMobile>
<Title data-testid="stEthBalanceIn$" hideMobile>
<Box display="inline-block" pr="3px">
{currency.symbol}
</Box>
Expand All @@ -79,13 +75,13 @@ export const Stats: FC<StatsProps> = (props) => {
/>
</Title>
</Item>
<Item>
<Item data-testid="stEthRewardedBlock">
<Title mb="8px">stETH rewarded</Title>
<Stat mb="6px" color="#61B75F">
<Stat data-testid="stEthRewarded" mb="6px" color="#61B75F">
<EthSymbol />
<NumberFormat number={data?.totals.ethRewards} pending={pending} />
</Stat>
<Title hideMobile>
<Title data-testid="stEthRewardedIn$" hideMobile>
<Box display="inline-block" pr="3px">
{currency.symbol}
</Box>
Expand All @@ -96,31 +92,30 @@ export const Stats: FC<StatsProps> = (props) => {
/>
</Title>
</Item>
<Item>
<Item data-testid="averageAprBlock">
<Title mb="8px">Average APR</Title>
<Stat mb="6px">
<Stat data-testid="averageApr" mb="6px">
{parseFloat(data?.averageApr || '0') ? (
<NumberFormat
id="averageApr"
number={data?.averageApr}
percent
pending={pending}
/>
<NumberFormat number={data?.averageApr} percent pending={pending} />
) : (
'-'
)}
</Stat>
<Title hideMobile>
<Link href="https://lido.fi/faq">
<Box color="secondary" style={{ textDecoration: 'underline' }}>
<Box
data-testid="moreInfo"
color="secondary"
style={{ textDecoration: 'underline' }}
>
More info
</Box>
</Link>
</Title>
</Item>
<Item>
<Item data-testid="stEthPriceBlock">
<Title mb="8px">stETH price</Title>
<Stat mb="6px">
<Stat data-testid="stEthPrice" mb="6px">
<Box display="inline-block" pr="3px">
{currency.symbol}
</Box>
Expand All @@ -130,7 +125,7 @@ export const Stats: FC<StatsProps> = (props) => {
pending={pending}
/>
</Stat>
<Title hideMobile>
<Title data-testid="ethRate" hideMobile>
<EthSymbol />
<NumberFormat
number={stEthEth?.toString()}
Expand Down
4 changes: 3 additions & 1 deletion features/rewards/components/statsWrapper/StatsWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { StatsWrapperStyle, StatsContentWrapper } from './StatsWrapperStyles';
export const StatsWrapper: FC<PropsWithChildren> = ({ children }) => {
return (
<StatsWrapperStyle>
<StatsContentWrapper>{children}</StatsContentWrapper>
<StatsContentWrapper data-testid="topCard">
{children}
</StatsContentWrapper>
</StatsWrapperStyle>
);
};
2 changes: 1 addition & 1 deletion features/rewards/features/top-card/top-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export const TopCard: FC = () => {

return (
<Block color="accent" style={{ padding: 0 }}>
<InputWrapper color="accent">
<InputWrapper data-testid="inputSection" color="accent">
<ThemeProvider theme={themeDark}>
<AddressInput
address={address}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ export const TokenAmountInputRequest = () => {
return (
<TokenAmountInputHookForm
fieldName="amount"
data-testid="requestInput"
token={token}
isLocked={isTokenLocked}
maxValue={maxAmount}
Expand Down
1 change: 0 additions & 1 deletion features/withdrawals/request/form/options/lido-option.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ const TooltipWithdrawalAmount = () => {

return (
<Tooltip
data-testid="lidoOptionToolTip"
placement="topRight"
title={
<>
Expand Down

0 comments on commit e768031

Please sign in to comment.