diff --git a/package.json b/package.json index 9a30cca..baf7e1d 100644 --- a/package.json +++ b/package.json @@ -41,7 +41,7 @@ "@cosmjs/tendermint-rpc": "^0.31.0", "@dydxprotocol/v4-abacus": "^1.1.33", "@dydxprotocol/v4-client-js": "^1.0.11", - "@dydxprotocol/v4-localization": "^1.1.7", + "@dydxprotocol/v4-localization": "^1.1.9", "@ethersproject/providers": "^5.7.2", "@js-joda/core": "^5.5.3", "@radix-ui/react-accordion": "^1.1.2", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5bdf292..261b75a 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -1,9 +1,5 @@ lockfileVersion: '6.0' -settings: - autoInstallPeers: true - excludeLinksFromLockfile: false - dependencies: '@0xsquid/sdk': specifier: ^1.10.0 @@ -33,8 +29,8 @@ dependencies: specifier: ^1.0.11 version: 1.0.11 '@dydxprotocol/v4-localization': - specifier: ^1.1.7 - version: 1.1.7 + specifier: ^1.1.9 + version: 1.1.9 '@ethersproject/providers': specifier: ^5.7.2 version: 5.7.2 @@ -1023,8 +1019,8 @@ packages: - utf-8-validate dev: false - /@dydxprotocol/v4-localization@1.1.7: - resolution: {integrity: sha512-pmRZTszmoee9Ml2v7E1wmIiaZCZpqQE66d/20I/xdnwwEIPt0iOriP59nlep+O/P1r9/Qxf/l+ZzvVbO720xjg==} + /@dydxprotocol/v4-localization@1.1.9: + resolution: {integrity: sha512-3wvgiX7Phq20Rd4JWx1qzLl8mNw5AaTAvCa9Inos7U6oPmPOTnsajHHgsEJSKjBkmcCZsl+sSbf5o6rW9cr0UA==} dev: false /@dydxprotocol/v4-proto@0.4.1: @@ -14813,3 +14809,7 @@ packages: /zwitch@2.0.4: resolution: {integrity: sha512-bXE4cR/kVZhKZX/RjPEflHaKVhUVl85noU3v6b8apfQEc1x4A+zBxjZ4lN8LqGd6WZ3dl98pY4o717VFmoPp+A==} dev: true + +settings: + autoInstallPeers: true + excludeLinksFromLockfile: false diff --git a/src/components/Table.tsx b/src/components/Table.tsx index df7dc1a..13e7d8d 100644 --- a/src/components/Table.tsx +++ b/src/components/Table.tsx @@ -33,19 +33,19 @@ import { import { useAsyncList } from 'react-stately'; -import { useBreakpoints } from '@/hooks'; +import { useBreakpoints, useStringGetter } from '@/hooks'; import { MediaQueryKeys } from '@/hooks/useBreakpoints'; -import { Checkbox } from '@/components/Checkbox'; - import { breakpoints } from '@/styles'; import { layoutMixins } from '@/styles/layoutMixins'; +import { STRING_KEYS } from '@/constants/localization'; +import { CaretIcon } from '@/icons'; + import { Icon, IconName } from './Icon'; import { Tag } from './Tag'; import { MustBigNumber } from '@/lib/numbers'; import { Button } from './Button'; -import { CaretIcon } from '@/icons'; export { TableCell } from './Table/TableCell'; export { TableColumnHeader } from './Table/TableColumnHeader'; @@ -141,6 +141,7 @@ export const Table = ({ }: ElementProps & StyleProps) => { const [selectedKeys, setSelectedKeys] = useState(new Set()); const [numRowsToShow, setNumRowsToShow] = useState(initialNumRowsToShow); + const stringGetter = useStringGetter(); const currentBreakpoints = useBreakpoints(); const shownColumns = columns.filter( @@ -260,7 +261,7 @@ export const Table = ({ onClick={() => setNumRowsToShow(data.length)} slotRight={} > - View more + {stringGetter({ key: STRING_KEYS.VIEW_MORE })} )} diff --git a/src/pages/Profile.tsx b/src/pages/Profile.tsx index 5117cd5..94b91b6 100644 --- a/src/pages/Profile.tsx +++ b/src/pages/Profile.tsx @@ -31,6 +31,8 @@ import { truncateAddress } from '@/lib/wallet'; import { DYDXBalancePanel } from './rewards/DYDXBalancePanel'; import { MigratePanel } from './rewards/MigratePanel'; +import { GovernancePanel } from './rewards/GovernancePanel'; +import { StakingPanel } from './rewards/StakingPanel'; const ENS_CHAIN_ID = 1; // Ethereum @@ -177,7 +179,7 @@ const Profile = () => { onClick={() => dispatch(openDialog({ type: DialogTypes.Help }))} /> - + @@ -229,6 +231,9 @@ const Profile = () => { withInnerBorders={false} /> + + + ); }; @@ -242,6 +247,7 @@ Styled.MobileProfileLayout = styled.div` gap: 1rem; padding: 1.25rem 0.9rem; + max-width: 100vw; `; Styled.Header = styled.header` @@ -336,7 +342,7 @@ Styled.Details = styled(Details)` Styled.RewardsPanel = styled(Panel)` align-self: flex-start; - + &, > * { height: 100%; diff --git a/src/pages/rewards/GovernancePanel.tsx b/src/pages/rewards/GovernancePanel.tsx new file mode 100644 index 0000000..9a0fcae --- /dev/null +++ b/src/pages/rewards/GovernancePanel.tsx @@ -0,0 +1,79 @@ +import styled, { AnyStyledComponent } from 'styled-components'; +import { useDispatch } from 'react-redux'; + +import { ButtonAction, ButtonSize } from '@/constants/buttons'; +import { STRING_KEYS } from '@/constants/localization'; +import { DialogTypes } from '@/constants/dialogs'; + +import { useStringGetter, useURLConfigs } from '@/hooks'; + +import { Panel } from '@/components/Panel'; +import { IconName } from '@/components/Icon'; +import { IconButton } from '@/components/IconButton'; +import { Link } from '@/components/Link'; + +import { openDialog } from '@/state/dialogs'; + +export const GovernancePanel = () => { + const stringGetter = useStringGetter(); + const dispatch = useDispatch(); + const { governanceLearnMore } = useURLConfigs(); + + return ( + {stringGetter({ key: STRING_KEYS.GOVERNANCE })} + } + slotRight={ + + + + } + onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))} + > + + {stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })} + e.stopPropagation()}> + {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → + + + + ); +}; + +const Styled: Record = {}; + +Styled.Panel = styled(Panel)` + height: fit-content; +`; + +Styled.Description = styled.div` + color: var(--color-text-0); + --link-color: var(--color-text-1); + + a { + display: inline; + ::before { + content: ' '; + } + } +`; + +Styled.IconButton = styled(IconButton)` + color: var(--color-text-0); + --color-border: var(--color-layer-6); +`; + +Styled.Arrow = styled.div` + padding-right: 1.5rem; +`; + +Styled.Title = styled.h3` + font: var(--font-medium-book); + color: var(--color-text-2); + margin-bottom: -1rem; +`; diff --git a/src/pages/rewards/RewardHistoryPanel.tsx b/src/pages/rewards/RewardHistoryPanel.tsx index 39c9ef1..ee2b328 100644 --- a/src/pages/rewards/RewardHistoryPanel.tsx +++ b/src/pages/rewards/RewardHistoryPanel.tsx @@ -40,7 +40,7 @@ export const RewardHistoryPanel = () => { ); return ( - @@ -73,26 +73,21 @@ export const RewardHistoryPanel = () => { ) : ( )} - + ); }; const Styled: Record = {}; -Styled.Panel = styled(Panel)` - --panel-paddingX: 1.5rem; - --panel-paddingY: 1.25rem; - - @media ${breakpoints.tablet} { - --panel-paddingY: 1.5rem; - } -`; - Styled.Header = styled.div` ${layoutMixins.spacedRow} - padding: 1rem 1.5rem 0; + padding: 1rem 1rem 0; margin-bottom: -0.5rem; + + @media ${breakpoints.notTablet} { + padding: 1.25rem 1.5rem 0; + } `; Styled.Title = styled.div` diff --git a/src/pages/rewards/RewardsPage.tsx b/src/pages/rewards/RewardsPage.tsx index 08c1d06..d85fc72 100644 --- a/src/pages/rewards/RewardsPage.tsx +++ b/src/pages/rewards/RewardsPage.tsx @@ -1,13 +1,11 @@ import styled, { AnyStyledComponent } from 'styled-components'; -import { useDispatch } from 'react-redux'; import { useNavigate } from 'react-router-dom'; import { STRING_KEYS } from '@/constants/localization'; import { ButtonAction, ButtonSize } from '@/constants/buttons'; -import { DialogTypes } from '@/constants/dialogs'; import { AppRoute } from '@/constants/routes'; -import { useBreakpoints, useStringGetter, useURLConfigs } from '@/hooks'; +import { useBreakpoints, useStringGetter } from '@/hooks'; import { breakpoints } from '@/styles'; import { layoutMixins } from '@/styles/layoutMixins'; @@ -16,9 +14,6 @@ import { BackButton } from '@/components/BackButton'; import { Panel } from '@/components/Panel'; import { IconName } from '@/components/Icon'; import { IconButton } from '@/components/IconButton'; -import { Link } from '@/components/Link'; - -import { openDialog } from '@/state/dialogs'; import { DYDXBalancePanel } from './DYDXBalancePanel'; import { MigratePanel } from './MigratePanel'; @@ -26,24 +21,14 @@ import { LaunchIncentivesPanel } from './LaunchIncentivesPanel'; import { RewardsHelpPanel } from './RewardsHelpPanel'; import { TradingRewardsSummaryPanel } from './TradingRewardsSummaryPanel'; import { RewardHistoryPanel } from './RewardHistoryPanel'; +import { GovernancePanel } from './GovernancePanel'; +import { StakingPanel } from './StakingPanel'; const RewardsPage = () => { - const dispatch = useDispatch(); const stringGetter = useStringGetter(); - const { governanceLearnMore, stakingLearnMore } = useURLConfigs(); const { isTablet, isNotTablet } = useBreakpoints(); const navigate = useNavigate(); - const panelArrow = ( - - - - ); - return ( {isTablet && ( @@ -55,42 +40,25 @@ const RewardsPage = () => { {import.meta.env.VITE_V3_TOKEN_ADDRESS && isNotTablet && } + {isTablet ? ( + + ) : ( + <> + + + + )} + {isTablet && } - + {isNotTablet && ( - {stringGetter({ key: STRING_KEYS.GOVERNANCE })} - } - slotRight={panelArrow} - onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))} - > - - {stringGetter({ key: STRING_KEYS.GOVERNANCE_DESCRIPTION })} - e.stopPropagation()}> - {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → - - - - - {stringGetter({ key: STRING_KEYS.STAKING })}} - slotRight={panelArrow} - onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))} - > - - {stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })} - e.stopPropagation()}> - {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → - - - - + + )} @@ -129,15 +97,6 @@ Styled.MobileHeader = styled.header` ${layoutMixins.stickyHeader} z-index: 2; padding: 1.25rem 0; - margin-bottom: -1.5rem; - - font: var(--font-large-medium); - color: var(--color-text-2); - background-color: var(--color-layer-2); -`; - -Styled.Panel = styled(Panel)` - height: fit-content; font: var(--font-large-medium); color: var(--color-text-2); @@ -199,30 +158,3 @@ Styled.RewardHistoryHeader = styled.div` padding: 1rem 1.5rem 0; margin-bottom: -0.5rem; `; - -Styled.Title = styled.h3` - font: var(--font-medium-book); - color: var(--color-text-2); - margin-bottom: -1rem; -`; - -Styled.Description = styled.div` - color: var(--color-text-0); - --link-color: var(--color-text-1); - - a { - display: inline; - ::before { - content: ' '; - } - } -`; - -Styled.IconButton = styled(IconButton)` - color: var(--color-text-0); - --color-border: var(--color-layer-6); -`; - -Styled.Arrow = styled.div` - padding-right: 1.5rem; -`; diff --git a/src/pages/rewards/StakingPanel.tsx b/src/pages/rewards/StakingPanel.tsx new file mode 100644 index 0000000..82fa35a --- /dev/null +++ b/src/pages/rewards/StakingPanel.tsx @@ -0,0 +1,77 @@ +import styled, { AnyStyledComponent } from 'styled-components'; +import { useDispatch } from 'react-redux'; + +import { ButtonAction, ButtonSize } from '@/constants/buttons'; +import { STRING_KEYS } from '@/constants/localization'; +import { DialogTypes } from '@/constants/dialogs'; + +import { useStringGetter, useURLConfigs } from '@/hooks'; + +import { Panel } from '@/components/Panel'; +import { IconName } from '@/components/Icon'; +import { IconButton } from '@/components/IconButton'; +import { Link } from '@/components/Link'; + +import { openDialog } from '@/state/dialogs'; + +export const StakingPanel = () => { + const stringGetter = useStringGetter(); + const dispatch = useDispatch(); + const { stakingLearnMore } = useURLConfigs(); + + return ( + {stringGetter({ key: STRING_KEYS.STAKING })}} + slotRight={ + + + + } + onClick={() => dispatch(openDialog({ type: DialogTypes.ExternalNavKeplr }))} + > + + {stringGetter({ key: STRING_KEYS.STAKING_DESCRIPTION })} + e.stopPropagation()}> + {stringGetter({ key: STRING_KEYS.LEARN_MORE })} → + + + + ); +}; + +const Styled: Record = {}; + +Styled.Panel = styled(Panel)` + height: fit-content; +`; + +Styled.Description = styled.div` + color: var(--color-text-0); + --link-color: var(--color-text-1); + + a { + display: inline; + ::before { + content: ' '; + } + } +`; + +Styled.IconButton = styled(IconButton)` + color: var(--color-text-0); + --color-border: var(--color-layer-6); +`; + +Styled.Arrow = styled.div` + padding-right: 1.5rem; +`; + +Styled.Title = styled.h3` + font: var(--font-medium-book); + color: var(--color-text-2); + margin-bottom: -1rem; +`; diff --git a/src/pages/rewards/TradingRewardsSummaryPanel.tsx b/src/pages/rewards/TradingRewardsSummaryPanel.tsx index 3050abe..9263587 100644 --- a/src/pages/rewards/TradingRewardsSummaryPanel.tsx +++ b/src/pages/rewards/TradingRewardsSummaryPanel.tsx @@ -2,7 +2,6 @@ import styled, { AnyStyledComponent } from 'styled-components'; import { shallowEqual, useSelector } from 'react-redux'; import { STRING_KEYS } from '@/constants/localization'; -import breakpoints from '@/styles/breakpoints'; import { layoutMixins } from '@/styles/layoutMixins'; import { useStringGetter, useTokenConfigs } from '@/hooks'; @@ -21,13 +20,7 @@ export const TradingRewardsSummaryPanel = () => { const { chainTokenLabel } = useTokenConfigs(); return ( - - Trading Rewards Summary - - } - > + Trading Reward Summary}> {currentWeekTradingReward ? ( { )} - + ); }; const Styled: Record = {}; -Styled.Panel = styled(Panel)` - --panel-paddingX: 1.5rem; - --panel-paddingY: 1.25rem; - - @media ${breakpoints.tablet} { - --panel-paddingY: 1.5rem; - } -`; - Styled.Header = styled.div` - ${layoutMixins.spacedRow} - gap: 1rem; padding: var(--panel-paddingY) var(--panel-paddingX) 0; -`; - -Styled.Title = styled.h3` - ${layoutMixins.inlineRow} font: var(--font-medium-book); color: var(--color-text-2); - margin-bottom: -0.5rem; - - img { - font-size: 1.5rem; - } `; Styled.Content = styled.div` @@ -137,10 +110,6 @@ Styled.Label = styled.div` color: var(--color-text-1); `; -Styled.ComingSoon = styled.div` - color: var(--color-text-0); -`; - Styled.TimePeriod = styled.div` ${layoutMixins.inlineRow}