-
Notifications
You must be signed in to change notification settings - Fork 103
Staking Revamp #4468
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
Merged
Merged
Staking Revamp #4468
Changes from 9 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
3470063
add stake pool and epoch sections
SorinC6 38c7131
fix warnings
SorinC6 03288ac
fix ts
SorinC6 a150855
fix ts
SorinC6 563a7b9
fix text
SorinC6 55b448c
fix conditions
SorinC6 0174da6
add import
SorinC6 b04957a
Merge branch 'chore/YW-172/staking-revamp-layout' into chore/YW-174/s…
SorinC6 0908204
Merge branch 'develop' into chore/YW-174/staking-revamp
Nebyt 8024be5
minor tweaks
Nebyt f02df29
update package-lock.json
Nebyt 4344ee8
use correct button type
Nebyt 679ef32
make warning banners smaller
Nebyt 1fff300
hide YAxis values
Nebyt 585c583
fix minor UI issues
Nebyt 139b5e2
check pool image
Nebyt 56af318
update file name
Nebyt 0476e01
fix loading graph
Nebyt File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 39 additions & 2 deletions
41
packages/yoroi-extension/app/UI/features/staking/StakingRoot.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,12 +1,49 @@ | ||
| import { Stack } from '@mui/material'; | ||
| import { Box, Stack, styled } from '@mui/material'; | ||
| import { PoolList } from './useCases/PoolList/PoolList'; | ||
| import { RewardsSummaryCard } from './useCases/RewardsSummary/RewardsSummaryCard'; | ||
| import { StakePoolDelegated } from './useCases/DelegatedStakePoolInfo/StakePoolDelegated'; | ||
| import EpochProgress from './useCases/EpochProgress/EpochProgress'; | ||
| import { LegacyDialogs } from './useCases/LegacyDialogs/LegacyDialogs.tsx'; | ||
| import { useStaking } from './module/StakingContextProvider'; | ||
| import BuySellDialog from '../../../components/buySell/BuySellDialog'; | ||
| import WalletEmptyBanner from './common/components/EmptyWalletBanner'; | ||
|
|
||
| export const StakingRoot = () => { | ||
| const { isWalletWithNoFunds, selectedWallet, legacyUIDialogs, currentlyDelegating } = useStaking(); | ||
|
|
||
| return ( | ||
| <Stack> | ||
| <RewardsSummaryCard /> | ||
| {isWalletWithNoFunds ? ( | ||
| <WalletEmptyBanner | ||
| onBuySellClick={() => legacyUIDialogs.open({ dialog: BuySellDialog })} | ||
| isTestnet={selectedWallet.isTestnet} | ||
| /> | ||
| ) : null} | ||
| {currentlyDelegating && ( | ||
| <WrapperCards> | ||
| <RewardsSummaryCard /> | ||
| <RightCardsWrapper> | ||
| <StakePoolDelegated /> | ||
| <EpochProgress /> | ||
| </RightCardsWrapper> | ||
| </WrapperCards> | ||
| )} | ||
| <PoolList /> | ||
| <LegacyDialogs /> | ||
| </Stack> | ||
| ); | ||
| }; | ||
|
|
||
| const WrapperCards = styled(Box)({ | ||
| display: 'flex', | ||
| gap: '24px', | ||
| justifyContent: 'space-between', | ||
| marginBottom: '24px', | ||
| }); | ||
|
|
||
| const RightCardsWrapper = styled(Box)({ | ||
| display: 'flex', | ||
| width: '100%', | ||
| flexDirection: 'column', | ||
| gap: '24px', | ||
| }); |
84 changes: 84 additions & 0 deletions
84
packages/yoroi-extension/app/UI/features/staking/common/components/EmptyWalletBanner.tsx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| import React from 'react'; | ||
| import { Box } from '@mui/system'; | ||
| import { Button, Stack, Typography } from '@mui/material'; | ||
| import { ReactComponent as CoverBg } from './wallet-empty-banner.inline.svg'; | ||
| import { captureEvent } from '../../../../../../posthog'; | ||
| import { TESTNET_FAUCET } from '../constants'; | ||
| import { useStrings } from '../hooks/useStrings'; | ||
|
|
||
| export type WalletEmptyBannerProps = { | ||
| onBuySellClick: () => void; | ||
| isTestnet: boolean; | ||
| }; | ||
|
|
||
| const WalletEmptyBanner: React.FC<WalletEmptyBannerProps> = ({ isTestnet, onBuySellClick }) => { | ||
| const strings = useStrings(); | ||
|
|
||
| const handleClick = () => { | ||
| if (isTestnet) { | ||
| window.open(TESTNET_FAUCET, '_blank'); | ||
| } else { | ||
| onBuySellClick(); | ||
| } | ||
|
|
||
| captureEvent('Wallet Page Exchange Clicked'); | ||
| }; | ||
|
|
||
| return ( | ||
| <Box> | ||
| <Box | ||
| sx={{ | ||
| background: theme => theme.palette.ds.bg_gradient_1, | ||
| marginBottom: '40px', | ||
| borderRadius: '8px', | ||
| overflowY: 'hidden', | ||
| position: 'relative', | ||
| padding: '16px', | ||
| height: 'auto', | ||
| }} | ||
| id="wallet|staking-emptyWalletBanner-box" | ||
| > | ||
| <Box sx={{ position: 'absolute', right: '1%', top: 'auto', bottom: '-3px' }}> | ||
| <CoverBg /> | ||
| </Box> | ||
|
|
||
| <Box> | ||
| <Typography component="div" variant="h3" color="ds.gray_max" fontWeight={500} fontSize="18px" mb="8px"> | ||
| {isTestnet ? strings.welcomeMessageTestnet : strings.welcomeMessage} | ||
| </Typography> | ||
|
|
||
| <Typography component="div" variant="body1" color="ds.gray_max" mb="24px"> | ||
| {isTestnet ? strings.welcomeMessageSubtitleTestnet : strings.welcomeMessageSubtitle} | ||
| {isTestnet ? ( | ||
| <> | ||
| <br /> | ||
| {strings.welcomeMessageSubtitleTestnetExtra} | ||
| </> | ||
| ) : null} | ||
| </Typography> | ||
| </Box> | ||
|
|
||
| <Stack direction="row" gap="16px"> | ||
| <Button | ||
| variant="contained" | ||
| color="primary" | ||
| size="medium" | ||
| sx={{ | ||
| '&.MuiButton-sizeMedium': { | ||
| padding: '9px 20px', | ||
| height: 'unset', | ||
| }, | ||
| }} | ||
| onClick={handleClick} | ||
| > | ||
| <Typography component="div" variant="button" fontWeight={500} sx={{ lineHeight: '19px' }}> | ||
| {isTestnet ? strings.goToFaucetButton : strings.buyAda} | ||
| </Typography> | ||
| </Button> | ||
| </Stack> | ||
| </Box> | ||
| </Box> | ||
| ); | ||
| }; | ||
|
|
||
| export default WalletEmptyBanner; |
508 changes: 508 additions & 0 deletions
508
...ension/app/UI/features/staking/common/components/wallet-empty-banner.inline.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions
1
packages/yoroi-extension/app/UI/features/staking/common/constants.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| export const TESTNET_FAUCET = 'https://docs.cardano.org/cardano-testnets/tools/faucet'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.