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

Get rid of incorrect estimated rewards on PoS size selection screen #1103

Merged
merged 1 commit into from
Jan 27, 2023
Merged
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
56 changes: 1 addition & 55 deletions app/components/node/PoSSize.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React, { useState } from 'react';
import styled from 'styled-components';
import { Tooltip, DropDown, Input } from '../../basicComponents';
import { posSpace, posRewardEst } from '../../assets/images';
import { posSpace } from '../../assets/images';
import { smColors } from '../../vars';
import {
DEFAULT_POS_MAX_FILE_SIZE,
Expand Down Expand Up @@ -35,12 +35,6 @@ const Icon1 = styled.img`
margin-right: 5px;
`;

const Icon2 = styled.img`
width: 15px;
height: 20px;
margin-right: 10px;
`;

const Icon3 = styled.img.attrs(({ theme: { icons: { posDirectory } } }) => ({
src: posDirectory,
}))`
Expand Down Expand Up @@ -69,21 +63,6 @@ const Dots = styled.div`
color: ${({ theme: { color } }) => color.primary};
`;

const RewardText = styled(Text)<{ selected: boolean }>`
color: ${({ selected }) => (selected ? smColors.orange : smColors.orange)};
`;

const ErrorText = styled.div`
height: 20px;
font-size: 15px;
line-height: 17px;
color: ${smColors.orange};
position: absolute;
left: 15px;
bottom: -15px;
width: 100%;
`;

const Link = styled.div`
text-transform: uppercase;
text-decoration: none;
Expand Down Expand Up @@ -135,22 +114,6 @@ const PoSSize = ({
const [selectedCommitmentIndex, setSelectedCommitmentIndex] = useState(
numUnits ? commitments.findIndex((com) => com.numUnits === numUnits) : 0
);
const [hasErrorFetchingEstimatedRewards] = useState(false);

// const [loadedEstimatedRewards, setLoadedEstimatedRewards] = useState({ amount: 0 });

// useEffect(() => { // TODO: uncomment when api endpoint implemented in node
// const loadEstimatedRewards = async () => {
// const { error, estimatedRewards } = await eventsService.getEstimatedRewards();
// if (error) {
// setHasErrorFetchingEstimatedRewards(true);
// } else {
// setLoadedEstimatedRewards(estimatedRewards);
// setHasErrorFetchingEstimatedRewards(false);
// }
// };
// loadEstimatedRewards();
// }, [setHasErrorFetchingEstimatedRewards, setLoadedEstimatedRewards]);

const selectCommitment = ({ index }: { index: number }) => {
setSelectedCommitmentIndex(index);
Expand Down Expand Up @@ -216,23 +179,6 @@ const PoSSize = ({
/>
</InputWrapper>
</Row>
<Row>
<Icon2 src={posRewardEst} />
<Text>Estimated coin reward</Text>
<Tooltip width={200} text="Some text" />
<Dots>.....................................................</Dots>
{hasErrorFetchingEstimatedRewards ? (
<ErrorText>
Failed to load estimated rewards. Please return to previous step
</ErrorText>
) : (
<RewardText selected={selectedCommitmentIndex !== -1}>
{selectedCommitmentIndex !== -1
? '10 SMESH / EPOCH'
: '0 SMESH / EPOCH'}
</RewardText>
)}
</Row>
<BottomRow>
<Icon3 />
<Text>PoS data folder</Text>
Expand Down