From d528892dbf8eb72e64d0eb586ac10c18d6d98de9 Mon Sep 17 00:00:00 2001 From: moo-onthelawn <70078372+moo-onthelawn@users.noreply.github.com> Date: Thu, 20 Jun 2024 11:07:57 -0400 Subject: [PATCH] feat(staking): ui of validator selection (#691) --- package.json | 2 +- pnpm-lock.yaml | 8 +- src/components/Details.tsx | 2 - src/components/DropdownIcon.tsx | 36 +++ src/components/FormMaxInputToggleButton.tsx | 4 +- src/components/Popover.tsx | 3 + src/components/SearchSelectMenu.tsx | 19 +- src/components/Table.tsx | 25 +- src/components/ValidatorDropdown.tsx | 230 ++++++++++++++++++ src/components/ValidatorName.tsx | 40 ++- src/constants/validators.ts | 9 + src/hooks/useStakingValidator.ts | 81 ++++-- src/pages/token/rewards/StakingPanel.tsx | 4 +- src/pages/trade/UnopenedIsolatedPositions.tsx | 17 +- src/views/MarketsDropdown.tsx | 15 +- src/views/StakeRewardButtonAndReceipt.tsx | 2 + src/views/dialogs/UnstakeDialog.tsx | 14 +- .../forms/StakeForm/StakeButtonAndReceipt.tsx | 51 +++- src/views/forms/StakeForm/index.tsx | 30 ++- src/views/forms/UnstakeForm/index.tsx | 12 +- 20 files changed, 475 insertions(+), 129 deletions(-) create mode 100644 src/components/DropdownIcon.tsx create mode 100644 src/components/ValidatorDropdown.tsx create mode 100644 src/constants/validators.ts diff --git a/package.json b/package.json index f72c8b1c5..7b64dcfac 100644 --- a/package.json +++ b/package.json @@ -49,7 +49,7 @@ "@cosmjs/tendermint-rpc": "^0.32.1", "@dydxprotocol/v4-abacus": "^1.7.87", "@dydxprotocol/v4-client-js": "^1.1.23", - "@dydxprotocol/v4-localization": "^1.1.127", + "@dydxprotocol/v4-localization": "^1.1.128", "@ethersproject/providers": "^5.7.2", "@hugocxl/react-to-image": "^0.0.9", "@js-joda/core": "^5.5.3", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 33f6cbca6..129555f0f 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -36,8 +36,8 @@ dependencies: specifier: ^1.1.23 version: 1.1.23 '@dydxprotocol/v4-localization': - specifier: ^1.1.127 - version: 1.1.127 + specifier: ^1.1.128 + version: 1.1.128 '@ethersproject/providers': specifier: ^5.7.2 version: 5.7.2 @@ -1429,8 +1429,8 @@ packages: - utf-8-validate dev: false - /@dydxprotocol/v4-localization@1.1.127: - resolution: {integrity: sha512-6aN+pRLrOqbhZFHGcmfhBxC/S8mui/0zl2jt61Z8lP4BF8P9jLr7W0EF9UTCVydHJVUbjxJui8c1ApWtOBDZtQ==} + /@dydxprotocol/v4-localization@1.1.128: + resolution: {integrity: sha512-jVGDTQUXWkx325Pd0Kca2z7vLZy61Q0gG7oQuNdJ6TB15zMRU74XMQvDZgJvCeM2WmiIqdyR5HnRJwL/gdnzQA==} dev: false /@dydxprotocol/v4-proto@5.0.0-dev.0: diff --git a/src/components/Details.tsx b/src/components/Details.tsx index 52b3fcf71..32629fecd 100644 --- a/src/components/Details.tsx +++ b/src/components/Details.tsx @@ -153,8 +153,6 @@ const detailsLayoutVariants = { const itemLayoutVariants = { column: css` - isolation: isolate; - ${layoutMixins.scrollArea} ${layoutMixins.stickyArea0} diff --git a/src/components/DropdownIcon.tsx b/src/components/DropdownIcon.tsx new file mode 100644 index 000000000..4665e603d --- /dev/null +++ b/src/components/DropdownIcon.tsx @@ -0,0 +1,36 @@ +import styled, { css } from 'styled-components'; + +import { Icon, IconName } from '@/components/Icon'; + +type ElementProps = { + iconName?: IconName; + isOpen?: boolean; +}; + +type StyleProps = { + className?: string; +}; + +export const DropdownIcon = ({ + iconName = IconName.Triangle, + isOpen, + className, +}: ElementProps & StyleProps) => { + return ( + <$DropdownIcon aria-hidden="true" isOpen={isOpen} className={className}> +