Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: remove input form from reward page #407

Merged
merged 42 commits into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
2ecbfda
refactor(reward): top card for connected wallet
solidovic Jul 19, 2024
624e61b
refactor: text color and margin
solidovic Jul 19, 2024
6fb02ae
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Jul 29, 2024
ba4025f
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Jul 30, 2024
addae41
refactor(rewards page): move to stETH balance
solidovic Jul 31, 2024
703f447
feat(rewards): remove AddressInput
solidovic Jul 31, 2024
c053004
feat(rewards): add connect button instead of rewards table
solidovic Jul 31, 2024
7b3ca13
fix(rewards): wallet text color
solidovic Jul 31, 2024
d034f3f
refactor: wallet block
solidovic Aug 2, 2024
34e3906
refactor: stats block
solidovic Aug 2, 2024
c7ac760
refactor(rewards): hide left filters
solidovic Aug 5, 2024
c2d645b
refactor(rewards): filters layout
solidovic Aug 5, 2024
5256147
refactor(rewards): connect button
solidovic Aug 5, 2024
6fd46fa
refactor(rewards): inline loader
solidovic Aug 5, 2024
2e80a5a
refactor(rewards): inline loader
solidovic Aug 5, 2024
e5f61d6
fix(rewards): hide filter after disconnect
solidovic Aug 5, 2024
b573693
fix(rewards): remove 'Only Show Rewards' checkbox, add 'Include trans…
solidovic Aug 5, 2024
a6e204a
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Aug 5, 2024
5dce3fc
fix(rewards): remove InputWrapper component
solidovic Aug 5, 2024
8648ee4
refactor(rewards): paddings
solidovic Aug 5, 2024
65cd552
Merge remote-tracking branch 'origin/feature/si-1497-reward-esw-remov…
solidovic Aug 5, 2024
d93d073
refactor(rewards): stake now wrapper width
solidovic Aug 5, 2024
feea85f
fix: tests
solidovic Aug 5, 2024
a62c78e
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Aug 5, 2024
b0fb629
feat(rewards): reset stats after disconnect
solidovic Aug 6, 2024
d48de96
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Aug 6, 2024
368dc6c
revert: tests
solidovic Aug 6, 2024
9c3484d
feat: add `mock-qa-rewards-address` for rewards table
solidovic Aug 6, 2024
0f515cb
refactor(useStethEthRate): return const rate for chain != {mainnet, s…
solidovic Aug 6, 2024
a6b4f2a
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Aug 6, 2024
d501173
fix: using useStethEthRate
solidovic Aug 6, 2024
49aee98
fix(rewards): wording
solidovic Aug 6, 2024
a11d129
Merge branch 'develop' into feature/si-1497-reward-esw-remove-input-form
solidovic Aug 6, 2024
d5b87a0
fix(rewards): open wallet by click on AddressBadge
solidovic Aug 7, 2024
b8de7f2
fix(layout): remove Y micro scroll
solidovic Aug 7, 2024
1714f3e
fix(rewards): text
solidovic Aug 7, 2024
dbccfff
fix(rewards): flash
solidovic Aug 7, 2024
543e02a
fix(rewards stats): add percent for empty stats
solidovic Aug 7, 2024
85602c9
fix(rewards): hide connecr btn to unsupported chain
solidovic Aug 7, 2024
89adb56
fix(rewards): addressBadge for mobile
solidovic Aug 7, 2024
f81f892
fix(rewards table): loader vertical align
solidovic Aug 7, 2024
12f90c4
fix(rewards): texts
solidovic Aug 7, 2024
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
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
import styled from 'styled-components';

export const WrapperStyle = styled.div`
flex: 1;
padding: ${({ theme }) => theme.spaceMap.sm}px;
margin-right: ${({ theme }) => theme.spaceMap.xl}px;

border-radius: ${({ theme }) => theme.spaceMap.sm}px;
color: #ffac2f;

background-color: rgb(255, 172, 47, 0.1);
color: #ffac2f;
text-align: center;
margin-top: 16px;

${({ theme }) => theme.mediaQueries.md} {
margin-right: 0;
margin-top: ${({ theme }) => theme.spaceMap.xl}px;
}
`;
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import { FC } from 'react';
import { Loader, Divider } from '@lidofinance/lido-ui';
import { useSTETHBalance } from '@lido-sdk/react';
import { Zero } from '@ethersproject/constants';

import { STRATEGY_LAZY } from 'consts/swr-strategies';
import { useRewardsHistory } from 'features/rewards/hooks';
import { ErrorBlockNoSteth } from 'features/rewards/components/errorBlocks/ErrorBlockNoSteth';
import { RewardsTable } from 'features/rewards/components/rewardsTable';
import { useDappStatus } from 'shared/hooks/use-dapp-status';

import { RewardsListsEmpty } from './RewardsListsEmpty';
import { RewardsListErrorMessage } from './RewardsListErrorMessage';
Expand All @@ -10,12 +16,9 @@ import {
TableWrapperStyle,
ErrorWrapper,
} from './RewardsListContentStyles';
import { RewardsTable } from 'features/rewards/components/rewardsTable';
import { useSTETHBalance } from '@lido-sdk/react';
import { STRATEGY_LAZY } from 'consts/swr-strategies';
import { Zero } from '@ethersproject/constants';

export const RewardsListContent: FC = () => {
const { isDappActive } = useDappStatus();
const {
error,
initialLoading,
Expand All @@ -29,7 +32,8 @@ export const RewardsListContent: FC = () => {
useSTETHBalance(STRATEGY_LAZY);
const hasSteth = stethBalance?.gt(Zero);

if (!data && !initialLoading && !error) return <RewardsListsEmpty />;
if (!isDappActive || (!data && !initialLoading && !error))
return <RewardsListsEmpty />;
// showing loading when canceling requests and empty response
if (
(!data && !error) ||
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ export const RewardsListsEmpty: FC = () => {
<>
<Divider indents="lg" />
<RewardsListEmptyWrapper>
Connect your wallet to see the stats.
Connect your wallet to view your staking stats.
</RewardsListEmptyWrapper>
</>
);
Expand Down
1 change: 1 addition & 0 deletions features/rewards/components/stats/Item.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const Item = ({ children, ...rest }: BoxProps) => (
width={['100%', '100%', 'initial']}
display={['flex', 'flex', 'initial']}
justifyContent={['space-between', 'space-between', null]}
marginBottom={['6px']}
{...rest}
>
{children}
Expand Down
6 changes: 1 addition & 5 deletions features/rewards/components/stats/Stats.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -71,11 +71,7 @@ export const Stats: React.FC = () => {
</Stat>
<Title hideMobile>
<Link href={`${config.rootOrigin}/ethereum#apr`}>
<Box
data-testid="moreInfo"
color="secondary"
style={{ textDecoration: 'underline' }}
>
<Box data-testid="moreInfo" style={{ textDecoration: 'underline' }}>
More info
</Box>
</Link>
Expand Down
1 change: 0 additions & 1 deletion features/rewards/components/stats/Title.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ type TitleProps = BoxProps & {
// TODO: refactoring to style files
export const Title = ({ children, hideMobile, ...rest }: TitleProps) => (
<Box
color="secondary"
fontSize="14px"
fontStyle="normal"
fontWeight="normal"
Expand Down
20 changes: 20 additions & 0 deletions features/rewards/features/top-card/styles.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import styled, { css } from 'styled-components';
import { WalletCardStyle } from 'shared/wallet/card/styles';
import { AddressBadge } from 'shared/wallet/components/address-badge/address-badge';

export const WalletStyle = styled(WalletCardStyle)`
background: linear-gradient(
Expand All @@ -11,6 +12,25 @@ export const WalletStyle = styled(WalletCardStyle)`
padding: 0 0 24px 0;
`;

export const WalletContentStyle = styled.div`
display: flex;
flex-wrap: nowrap;
flex-direction: row;
align-items: center;
justify-content: space-between;

padding: ${({ theme }) => theme.spaceMap.xxl}px;

${({ theme }) => theme.mediaQueries.md} {
align-items: end;
flex-direction: column-reverse;
}
`;

export const WalletContentAddressBadgeStyle = styled(AddressBadge)`
background: #00000033;
`;

export const ConnectWalletStyle = styled(WalletCardStyle)`
padding: 27px 27px 47px 27px;
text-align: center;
Expand Down
1 change: 1 addition & 0 deletions features/rewards/features/top-card/top-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export const TopCard: FC = () => {
{!isDappActive && <Fallback />}

{isDappActive && <Wallet />}

<StatsWrapper>
<Stats />
</StatsWrapper>
Expand Down
36 changes: 15 additions & 21 deletions features/rewards/features/top-card/wallet.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,38 +2,32 @@ import { FC } from 'react';
import { ThemeProvider, themeDark } from '@lidofinance/lido-ui';

import { InputDescription } from 'features/rewards/components/inputDescription';
import { AddressInput } from 'features/rewards/components/addressInput';
solidovic marked this conversation as resolved.
Show resolved Hide resolved
import { InputWrapper } from 'features/rewards/components/inputWrapper';
import { useRewardsHistory } from 'features/rewards/hooks';

import { WalletStyle } from './styles';
import {
WalletStyle,
WalletContentStyle,
WalletContentAddressBadgeStyle,
} from './styles';

const INPUT_DESC_TEXT =
'Current balance may differ from last balance in the table due to rounding.';

export const Wallet: FC = () => {
const {
address,
addressError,
isAddressResolving,
inputValue,
setInputValue,
} = useRewardsHistory();
const { address } = useRewardsHistory();

return (
<WalletStyle>
<InputWrapper data-testid="inputSection" color="accent">
<ThemeProvider theme={themeDark}>
<AddressInput
address={address}
addressError={addressError}
inputValue={inputValue}
handleInputChange={setInputValue}
isAddressResolving={isAddressResolving}
/>
<ThemeProvider theme={themeDark}>
<WalletContentStyle>
<InputDescription>{INPUT_DESC_TEXT}</InputDescription>
solidovic marked this conversation as resolved.
Show resolved Hide resolved
</ThemeProvider>
</InputWrapper>
<WalletContentAddressBadgeStyle
address={address as `0x${string}`}
symbolsMobile={6}
symbolsDesktop={6}
/>
</WalletContentStyle>
</ThemeProvider>
</WalletStyle>
);
};
11 changes: 7 additions & 4 deletions shared/wallet/components/address-badge/address-badge.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,22 @@
import { useBreakpoint, IdenticonBadgeProps } from '@lidofinance/lido-ui';
import { AddressBadgeStyle } from './styles';
import { Component } from 'types';
import { AddressBadgeStyle } from './styles';

export type AddressBadgeComponent = Component<
'div',
Omit<IdenticonBadgeProps, 'address' | 'as'> & { address?: string | null }
Omit<IdenticonBadgeProps, 'address' | 'as'> & { address?: string | null } & {
symbolsMobile?: number;
symbolsDesktop?: number;
}
>;

export const AddressBadge: AddressBadgeComponent = (props) => {
const { address, ...rest } = props;
const { address, symbolsMobile = 3, symbolsDesktop = 6, ...rest } = props;
const isMobile = useBreakpoint('md');

return (
<AddressBadgeStyle
symbols={isMobile ? 3 : 6}
symbols={isMobile ? symbolsMobile : symbolsDesktop}
address={address ?? ''}
{...rest}
/>
Expand Down
Loading