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

fix: fix issue with input auto-complete and validator dropdown #1036

Merged
Show file tree
Hide file tree
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
8 changes: 2 additions & 6 deletions e2e-tests/popup/buy-cspr/buy-cspr.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,9 @@ popup.describe('Popup UI: buy cspr', () => {
await popupPage.getByRole('button', { name: 'Next' }).click();

await popupExpect(
popupPage.getByRole('heading', { name: 'Pick provider' })
popupPage.getByRole('heading', { name: 'Review provider option' })
).toBeVisible();

await popupExpect(
popupPage.getByRole('button', { name: 'Confirm' })
).toBeDisabled();

await popupPage.getByText('Topper by Uphold').click();

await popupExpect(
Expand All @@ -47,7 +43,7 @@ popup.describe('Popup UI: buy cspr', () => {
}
);

popup(
popup.skip(
'should redirect to Ramp provider page',
async ({ popupPage, unlockVault, context }) => {
await unlockVault();
Expand Down
4 changes: 4 additions & 0 deletions e2e-tests/popup/stakes/redelagation.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ popup.describe('Popup UI: Redelegation', () => {

await popupPage.getByPlaceholder('0.00', { exact: true }).fill('500');

await popupExpect(
popupPage.getByRole('button', { name: 'Next' })
).not.toBeDisabled();

await popupPage.getByRole('button', { name: 'Next' }).click();

await popupPage.getByText('Delegate', { exact: true }).click();
Expand Down
77 changes: 75 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,7 @@
"react-query": "^3.39.3",
"react-redux": "8.0.5",
"react-router-dom": "6.16.0",
"react-virtualized": "^9.22.5",
"redux": "4.2.1",
"redux-saga": "1.2.3",
"reselect": "4.1.7",
Expand Down Expand Up @@ -123,6 +124,7 @@
"@types/node": "^20.9.0",
"@types/react": "^18.2.55",
"@types/react-dom": "^18.2.18",
"@types/react-virtualized": "^9.21.30",
"@types/styled-components": "^5.1.26",
"babel-eslint": "^10.1.0",
"babel-loader": "9.1.0",
Expand Down
1 change: 0 additions & 1 deletion src/apps/popup/pages/create-account/content.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ export function CreateAccountPageContent({
{...register('name')}
error={!!errorMessage}
validationText={errorMessage}
autoComplete="off"
autoFocus
/>
</InputsContainer>
Expand Down
83 changes: 83 additions & 0 deletions src/apps/popup/pages/stakes/components/validator-list.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
import React from 'react';
import { Trans, useTranslation } from 'react-i18next';
import AutoSizer from 'react-virtualized/dist/commonjs/AutoSizer';
import List from 'react-virtualized/dist/commonjs/List';
import styled from 'styled-components';

import {
DropdownHeader,
SpacingSize,
VerticalSpaceContainer
} from '@libs/layout';
import { ValidatorResultWithId } from '@libs/services/validators-service';
import { Tile, Typography, ValidatorPlate } from '@libs/ui/components';

interface ValidatorListProps {
filteredValidatorsList: ValidatorResultWithId[];
handleValidatorClick: (validator: ValidatorResultWithId) => void;
totalStake: 'total_stake' | 'user_stake';
}

const Container = styled.div``;

export const ValidatorList = ({
filteredValidatorsList,
handleValidatorClick,
totalStake
}: ValidatorListProps) => {
const { t } = useTranslation();

return (
<VerticalSpaceContainer top={SpacingSize.Tiny}>
<Tile borderRadius="base">
<DropdownHeader>
<Typography type="labelMedium" color="contentSecondary">
<Trans t={t}>Validator</Trans>
</Typography>
<Typography type="labelMedium" color="contentSecondary">
<Trans t={t}>Total stake, fee, delegators</Trans>
</Typography>
</DropdownHeader>
<AutoSizer disableHeight>
{({ width }) => (
<List
overscanRowCount={5}
rowHeight={64}
height={Math.min(3 * 64, filteredValidatorsList.length * 64)}
width={width}
rowCount={filteredValidatorsList.length}
rowRenderer={({ index, key, style }) => {
const validator = filteredValidatorsList[index];
const logo =
validator?.account_info?.info?.owner?.branding?.logo?.svg ||
validator?.account_info?.info?.owner?.branding?.logo
?.png_256 ||
validator?.account_info?.info?.owner?.branding?.logo
?.png_1024;

return (
<Container style={style}>
<ValidatorPlate
key={key}
publicKey={validator?.public_key}
fee={validator.fee}
name={validator?.account_info?.info?.owner?.name}
logo={logo}
// TODO: remove user_stake after we merge recipient and amount steps for undelegation
totalStake={validator[totalStake]}
delegatorsNumber={validator?.delegators_number}
handleClick={() => {
handleValidatorClick(validator);
}}
withBorder
/>
</Container>
);
}}
/>
)}
</AutoSizer>
</Tile>
</VerticalSpaceContainer>
);
};
Loading
Loading