From bfdef78fd6364752c164a22f8621660b6d92056e Mon Sep 17 00:00:00 2001 From: ChefMomota <98292246+ChefMomota@users.noreply.github.com> Date: Wed, 20 Apr 2022 17:58:32 +0800 Subject: [PATCH] feat: Migration page integration (#3580) * feat: MasterChefFarmCalls totalAllocPoint change to totalRegularAllocPoint * fix: Eslint * fix: Migration pool step 1 total staked amount * feat: Pool and Farms v1 remove unstakeFarm utils * refactor: Using menu height and banner heigth in config * feat: Remove BountyCard, BountyModal, HelpButton component * refactor: Remove ifo at pool data list * feat: Add vakeVaultV2 Abi & deposit add lockDuration * feat: Version 2 Auto Cake rename to Lock Cake * fix: IFO handleDeposit methodArgs * fix: Wrong file direction * feat: Update tester contract address * fix: V1 pool unstake contract * feat: Filter manual cake and change mock cake address * fix: Develop mode rpc CORS * feat: Adding AutoRenewIcon * fix: UsePollCoreFarmData and usePriceCakeBusd * feat: Remove sousId 0 unused code * style: Change Spinner component, add border in pool and farm table * add locked component * fix types * fix: V1 auto pool * card vault action * merge v2 back * fix build * fix: Remove multiplier zero * feat: Ifo page remove unused code * Add lock amount and duration * remove log * fix require sucess false * add vault position * feat: Add button props for locked button * refactor: Remove all ifo in state * feat: Remove unused IfoPool code * chore: Change node and add annotate * feat: New IfoPoolVaultCardMobile * feat: New ifo vault card with v1 data * fix: Remove fetchIfoPoolFees * chore: Add comment * apy (#8) * apy * memo * clean up * fix * apply table * feat: Decorator for lock button (#7) * fix table stake modal button * feat: Adding v1 farms link * flexible done * fix table view * fix build * fix deposit * fix: Pools withdraw decimals * style: Update css * use duck typing for cake pool utils * clean up vault apy hook * feat: Migration step2 using new pool layout * update vault position enum * update vault position enum none * feat: Update pool history wording * vault position table view desktop * add test * feat: Update cakeVault contract address and ABI * feat: disabled with soon decorator for lock button (#13) * feat: disabled with soon decorator for lock button * chore: use maxDuration isZero method * chore: change the disabled condtion * chore: adjustment for disabled * fix: isLockedEnd and cakePool test * feat: Locked Pool table layout * feat: Update vaultPosition * hoist cake balance and minus fee (#15) * hoist cake balance and minus fee * temp update pid * chore: Add Stake Modal * chore: Add Lock Stake Card style * feat(locked-pool): Implement user data presenter * chore: Add Locked Card Actions condition * feat(lock-pool): Add static amount modal * chore: Add Overview implementation * chore(locked-pool): Refactor Locked Modal * chore(pool-limit): Add duration max * chore(locked-pool): Add Extend and Add Cake Modal * chore: Add Burning state * chore(locked-pool): Add BalanceWithLoading * chore(locked-pool): Add ExtendDuration logic * feat(locked-pool): Add Renew Cake logic * chore: Add burning count down * chore: Add Burned Cake in Locked Card * chore: Add Switch To Flexible logic * chore: Styling Lock Pool Row * chore: Add Locked Actions in Pool Row * chore(locked-pool): Move to LockPool directory * chore: Add LockedStakeModal in Lock Button * chore: Update LoadingBalance * chore: Add Type * chore: Fix minor type mismatch * chore: Fix Cake Balance * fix: Show - when duration is exceeded * fix: Round remaining weeks * chore: Update UI * chore: Update lock logic * chore: Update text color * fix: Update Renew logic * chore: Update gaslimit * chore: Disable Add Cake when balance is zero * chore: Update Cake Locked display logic * chore: Update current locked amount in modal * chore: Add translation * chore: Fix date mismatch between card and modal * chore: Update auto tooltip (#21) * feat: UseVaultPoolContract add useMemo (#23) Co-authored-by: Chef Momota * feat: Add locked roi calc (#20) * feat: Add locked roi calc * update roi deposit * update withdraw method * add vault roi to table * remove interest break down tooltip * chore: Add new mock cake pool address (#22) * update abi * feat: Improve suggestions * chore: Fix merge * chore: Update Lock Row * fix: Add float in balance field * chore: Style button * fix: Not show Roi and APY * chore: Add RoiCalculatorModalProvider * chore: Update modal title * chore: Adjust color for new text * chore: Update Roi Calculator * chore: Hide convert to lock when max duration is 0 * chore: Update test * small ui fix * feat: Locked warning tableview * chore: Remove BurnedCake component * fix: Small ui fix (#28) * fix: Small ui fix * update contract address * update duration * fix: Lock pool ui * feat: Flexable warning table view (#27) * max duration optional * feat: Adding convertTimeToDistance utils * fix: Pool burn cake ui * feat: Cake Pool Namecell * chore: merge render condition * style: Migration table style * chore: Adding m from farmer motion * update apy roi base on select * chore: Move to config * chore: Update string * feat: Cake pool UI details * chore: Use Insufficient modal instead of disable the Add CAKE button * move mock timer * chore: Update localization * fix: Details to display in after burning state * feat: Dynamic unit for duration displays * chore: Update variable naming * chore: Migration FE wording fixes * chore: Add yield boost * chore: WeekDuration using formatSecondsToWeeks * chore: Naming remainingWeeks change to remainingTime * chore: Update wording * style: Sort pool card detail * feat: LockedModal add boostFactor * chore: Add prefix * chore: adjust cake pool wording * chore: Add Skeleton in Add CAKE button * fix: Utils distanceToNowStrict handle invalid time * chore: Update useVaultApy * style: Migration v1 farms token size * chore: Add Boost Yield Duration Rows * chore: Update migration page link * style: AfterLockedAction css * chore: Revert MC v1 contract address * fix: Test * feat: Update MCv2 contract address * chore: Fix failed test * feat(flexible-pool): Add staking fee row * chore: Fix fee squash in flexible box * chore: Avoid NaN in BalanceLoading * chore: Vpid -> v1pid * fix: Lint * memo * fix: Locked amount little deviation (#53) * fix: lockedAmount deviation * chore: locked amount bignumber issue * chore: use getDecimalAmount * chore: Add warning for Insufficient CAKE balance * chore: Remove unused translations keys * chore: Add new translations keys * fix: Remove legacy strategy file * chorr: useUserEnoughValidator * chore: Remove unused code * chore: Remove BigNumber * fix: Reduce effect loop * perf: Reduce new pool request * get user data loading * style: Update cake pool table style * chore: Mobile show Flexible APR & Locked APR at ActionPanel * fix: ROI footer when apy 0 * apy 0 * chore: use stakingTokenBalance to handle * fix: Safari flex (#67) * fix: APY fixed number (#69) * fix: APY fixed number * no show fix apy yet * fix test * clean up * chore: Hide ROI calculator Co-authored-by: Chef Momota Co-authored-by: ChefJoJo <94336009+chef-jojo@users.noreply.github.com> Co-authored-by: Chef Yogi <99634186+Chef-Yogi@users.noreply.github.com> Co-authored-by: chefilip Co-authored-by: Philip <97418926+chefilip@users.noreply.github.com> --- .../src/components/BalanceInput/types.ts | 3 +- .../src/components/Button/StyledButton.tsx | 25 +- .../src/components/Button/index.stories.tsx | 5 +- packages/uikit/src/components/Button/types.ts | 6 + .../uikit/src/components/Card/CardRibbon.tsx | 2 +- .../src/components/Dropdown/Dropdown.tsx | 4 + .../FallingBunnies/FallingBunnies.tsx | 1 + packages/uikit/src/components/Link/Link.tsx | 1 + .../uikit/src/components/Message/Message.tsx | 15 +- .../uikit/src/components/Message/types.ts | 2 + .../uikit/src/components/Svg/Icons/Hot.tsx | 16 + .../uikit/src/components/Svg/Icons/Lock.tsx | 16 + .../uikit/src/components/Svg/Icons/Split.tsx | 16 + .../uikit/src/components/Svg/Icons/Unlock.tsx | 16 + packages/uikit/src/components/Svg/index.tsx | 42 +- packages/uikit/src/components/Tag/Tag.tsx | 1 + packages/uikit/src/components/Text/Text.tsx | 8 +- packages/uikit/src/components/Text/types.ts | 1 - .../uikit/src/widgets/Modal/ModalContext.tsx | 2 +- src/components/Balance.tsx | 29 +- src/components/Divider/index.tsx | 8 + .../RoiCalculatorFooter.tsx | 46 +- src/components/RoiCalculatorModal/index.tsx | 65 +- .../useRoiCalculatorReducer.ts | 163 +- src/config/__tests__/farms.test.ts | 2 +- src/config/abi/cakeVaultV2.json | 576 ++ src/config/abi/masterchef.json | 555 +- src/config/abi/masterchefV1.json | 581 ++ src/config/constants/contracts.ts | 10 +- src/config/constants/farms.ts | 5163 ++--------------- src/config/constants/pools.tsx | 18 +- src/config/constants/types.ts | 1 + src/config/localization/translations.json | 128 +- src/hooks/Trades.test.ts | 10 +- src/hooks/useContract.ts | 42 +- src/hooks/useVaultApy.test.ts | 47 + src/hooks/useVaultApy.ts | 132 + src/hooks/useVaultMaxDuration.ts | 12 + src/pages/migration.tsx | 3 + src/state/farms/fetchFarms.ts | 4 +- src/state/farms/fetchMasterChefData.ts | 2 +- src/state/farms/hooks.ts | 6 +- src/state/farms/index.ts | 2 +- src/state/farms/selectors.ts | 2 +- src/state/farmsV1/fetchFarmUser.ts | 74 + src/state/farmsV1/fetchFarms.ts | 47 + src/state/farmsV1/fetchMasterChefData.ts | 51 + src/state/farmsV1/fetchPublicFarmData.ts | 53 + src/state/farmsV1/getFarmsPrices.ts | 107 + src/state/farmsV1/hooks.ts | 149 + src/state/farmsV1/index.ts | 188 + src/state/index.ts | 2 + src/state/pools/fetchVaultPublic.ts | 39 +- src/state/pools/fetchVaultUser.ts | 31 +- src/state/pools/helpers.ts | 59 +- src/state/pools/hooks.ts | 60 +- src/state/pools/index.ts | 127 +- src/state/pools/selectors.ts | 60 +- src/state/swap/hooks.test.ts | 8 +- src/state/types.ts | 59 +- src/testUtils.tsx | 8 +- src/utils/addressHelpers.ts | 6 +- src/utils/cakePool.test.ts | 68 + src/utils/cakePool.ts | 46 + src/utils/calls/farms.ts | 9 - src/utils/contractHelpers.ts | 22 +- src/utils/farmHelpers.ts | 7 +- src/utils/formatBalance.ts | 2 +- src/utils/isUndefinedOrNull.ts | 3 + src/utils/timeHelper.ts | 12 + src/views/Farms/Farms.tsx | 36 +- .../Farms/components/MigrationSticky.tsx | 84 +- .../Home/components/FarmsPoolsRow/index.tsx | 4 - src/views/Home/hooks/useGetTopPoolsByApr.tsx | 3 +- .../Ifos/components/ComingSoonSection.tsx | 35 +- .../IfoPoolCard/IfoCardTokens.tsx | 10 +- .../IfoFoldableCard/StakeVaultButton.tsx | 22 +- .../Ifos/components/IfoPoolVaultCard.tsx | 169 +- .../components/IfoPoolVaultCardDesktop.tsx | 151 + .../components/IfoPoolVaultCardMobile.tsx | 174 + src/views/Ifos/components/IfoSteps.tsx | 93 +- .../Ifos/hooks/v3/useGetWalletIfoData.ts | 10 +- src/views/Ifos/index.tsx | 3 +- .../OldFarm/ActionPanel/ActionPanel.tsx | 91 + .../OldFarm/ActionPanel/Earned.tsx | 70 + .../OldFarm/ActionPanel/Liquidity.tsx | 61 + .../OldFarm/ActionPanel/Multiplier.tsx | 70 + .../OldFarm/ActionPanel/Staked.tsx | 58 + .../MigrationStep1/OldFarm/Cells/Earned.tsx | 42 + .../MigrationStep1/OldFarm/Cells/Farm.tsx | 58 + .../OldFarm/Cells/Liquidity.tsx | 64 + .../OldFarm/Cells/Multiplier.tsx | 74 + .../MigrationStep1/OldFarm/Cells/Staked.tsx | 60 + .../MigrationStep1/OldFarm/Cells/Unstake.tsx | 31 + .../MigrationStep1/OldFarm/FarmRow.tsx | 94 + .../MigrationStep1/OldFarm/FarmTable.tsx | 53 + .../MigrationStep1/OldFarm/UnstakeButton.tsx | 68 + .../MigrationStep1/OldFarm/index.tsx | 115 + .../OldPool/ActionPanel/ActionPanel.tsx | 123 + .../OldPool/ActionPanel/AutoEarning.tsx | 84 + .../OldPool/ActionPanel/Earning.tsx | 86 + .../OldPool/ActionPanel/Stake.tsx | 88 + .../OldPool/ActionPanel/TotalStaked.tsx | 53 + .../OldPool/Cells/AutoEarningsCell.tsx | 48 + .../OldPool/Cells/EarningsCell.tsx | 57 + .../OldPool/Cells/ExpandActionCell.tsx | 41 + .../MigrationStep1/OldPool/Cells/NameCell.tsx | 81 + .../OldPool/Cells/StakedCell.tsx | 83 + .../OldPool/Cells/TotalStakedCell.tsx | 60 + .../MigrationStep1/OldPool/Cells/Unstaked.tsx | 33 + .../MigrationStep1/OldPool/PoolRow.tsx | 124 + .../MigrationStep1/OldPool/PoolTable.tsx | 49 + .../MigrationStep1/OldPool/UnstakeButton.tsx | 114 + .../MigrationStep1/OldPool/index.tsx | 16 + .../NewFarm/ActionPanel/ActionPanel.tsx | 93 + .../NewFarm/ActionPanel/AprRow.tsx | 29 + .../NewFarm/ActionPanel/Staked.tsx | 62 + .../MigrationStep2/NewFarm/Cells/AprCell.tsx | 33 + .../NewFarm/Cells/StakeButtonCells.tsx | 25 + .../MigrationStep2/NewFarm/FarmRow.tsx | 109 + .../MigrationStep2/NewFarm/FarmTable.tsx | 53 + .../MigrationStep2/NewFarm/StakeButton.tsx | 174 + .../MigrationStep2/NewFarm/index.tsx | 140 + .../NewPool/ActionPanel/AprRow.tsx | 56 + .../NewPool/Cells/StakedCell.tsx | 94 + .../MigrationStep2/NewPool/PoolRow.tsx | 75 + .../MigrationStep2/NewPool/PoolTable.tsx | 49 + .../MigrationStep2/NewPool/index.tsx | 37 + .../Migration/components/MigrationSticky.tsx | 104 + .../components/MigrationTable/EmptyText.tsx | 16 + .../components/MigrationTable/Loading.tsx | 12 + .../components/MigrationTable/StyledTable.tsx | 21 + .../components/MigrationTable/TableHeader.tsx | 18 + .../Migration/components/ProgressSteps.tsx | 167 + src/views/Migration/components/types.ts | 101 + .../hook/V1/Farms/useUnstakeFarms.ts | 30 + .../hook/V1/Pool}/fetchIfoPoolPublic.ts | 31 +- .../hook/V1/Pool}/fetchIfoPoolUser.ts | 5 +- .../Migration/hook/V1/Pool/fetchPoolsUser.ts | 14 + .../Migration/hook/V1/Pool/useFetchIfoPool.ts | 122 + .../hook/V1/Pool/useFetchPublicPoolsData.ts | 16 + .../hook/V1/Pool/useFetchUserPools.ts | 86 + .../Migration/hook/V1/Pool/useUnstakePool.ts | 46 + src/views/Migration/index.tsx | 105 + .../Achievements/AchievementDescription.tsx | 4 +- src/views/Pools/components/Apr.tsx | 4 +- .../components/AutoEarningsBreakdown.tsx | 65 +- src/views/Pools/components/BountyCard.tsx | 134 - src/views/Pools/components/BountyModal.tsx | 152 - .../CakeVaultCard/RecentCakeProfitRow.tsx | 7 +- .../components/CakeVaultCard/StakingApy.tsx | 90 + .../UnstakingFeeCountdownRow.tsx | 3 +- .../VaultCardActions/HasSharesActions.tsx | 87 +- .../VaultCardActions/VaultApprovalAction.tsx | 6 +- .../VaultCardActions/VaultStakeActions.tsx | 20 +- .../CakeVaultCard/VaultCardActions/index.tsx | 71 +- .../CakeVaultCard/VaultStakeModal.tsx | 87 +- .../CakeVaultCard/WithdrawalFeeTimer.tsx | 6 +- .../Pools/components/CakeVaultCard/index.tsx | 161 +- src/views/Pools/components/HelpButton.tsx | 44 - .../LockedPool/Buttons/AddCakeButton.tsx | 61 + .../LockedPool/Buttons/CalculatorButton.tsx | 16 + .../Buttons/ConvertToFlexibleButton.tsx | 54 + .../Buttons/ExtendDurationButton.tsx | 38 + .../LockedPool/Common/AfterLockedActions.tsx | 69 + .../LockedPool/Common/BalanceField.tsx | 128 + .../LockedPool/Common/BurningCountDown.tsx | 32 + .../LockedPool/Common/ConvertToLock.tsx | 42 + .../LockedPool/Common/LockDurationField.tsx | 66 + .../LockedPool/Common/LockDurationRow.tsx | 19 + .../LockedPool/Common/LockedActions.tsx | 77 + .../LockedPool/Common/LockedModalBody.tsx | 78 + .../LockedPool/Common/Overview/BalanceRow.tsx | 66 + .../LockedPool/Common/Overview/CrossText.tsx | 8 + .../LockedPool/Common/Overview/DateRow.tsx | 21 + .../LockedPool/Common/Overview/TextRow.tsx | 47 + .../LockedPool/Common/Overview/index.tsx | 94 + .../LockedPool/Common/StaticAmount.tsx | 44 + .../LockedPool/Common/YieldBoostRow.tsx | 37 + .../LockedPool/LockedStakingApy.tsx | 137 + .../LockedPool/Modals/AddAmountModal.tsx | 131 + .../LockedPool/Modals/ExtendDurationModal.tsx | 90 + .../LockedPool/Modals/LockedStakeModal.tsx | 52 + .../Modals/RoiCalculatorModalProvider.tsx | 40 + .../LockedPool/hooks/useLockedPool.tsx | 90 + .../hooks/useUserDataInVaultPrensenter.ts | 40 + .../hooks/useUserEnoughCakeValidator.ts | 16 + .../components/LockedPool/types/index.ts | 127 + .../components/LockedPool/utils/formatRoi.ts | 14 + .../LockedPool/utils/formatSecondsToWeeks.ts | 16 + .../PoolCard/CardFooter/ExpandedFooter.tsx | 111 +- .../components/PoolCard/CardFooter/index.tsx | 16 +- .../PoolsTable/ActionPanel/ActionPanel.tsx | 139 +- .../PoolsTable/ActionPanel/AutoHarvest.tsx | 142 +- .../PoolsTable/ActionPanel/CakeVaultApr.tsx | 104 + .../PoolsTable/ActionPanel/Harvest.tsx | 2 +- .../PoolsTable/ActionPanel/Stake.tsx | 302 +- .../PoolsTable/ActionPanel/styles.ts | 21 +- .../PoolsTable/Cells/AutoAprCell.tsx | 157 +- .../PoolsTable/Cells/AutoEarningsCell.tsx | 14 +- .../PoolsTable/Cells/IFOCreditCell.tsx | 111 - .../components/PoolsTable/Cells/NameCell.tsx | 47 +- .../PoolsTable/Cells/StakedCell.tsx | 18 +- .../PoolsTable/Cells/TotalStakedCell.tsx | 19 +- .../Pools/components/PoolsTable/PoolRow.tsx | 9 +- src/views/Pools/components/Stat.tsx | 85 + .../components/Vault/VaultPositionTag.tsx | 71 + .../Vault/VaultRoiCalculatorModal.tsx | 137 + .../Vault/VaultStakeButtonGroup.tsx | 44 + src/views/Pools/components/types/index.ts | 121 + .../components/utils/formatSecondsToWeeks.ts | 16 + src/views/Pools/helpers.tsx | 7 +- src/views/Pools/hooks/useApprove.tsx | 9 +- src/views/Pools/hooks/useHarvestPool.ts | 10 +- src/views/Pools/hooks/useStakePool.ts | 9 +- src/views/Pools/hooks/useUnstakePool.ts | 9 +- src/views/Pools/index.tsx | 53 +- 217 files changed, 11572 insertions(+), 6854 deletions(-) create mode 100644 packages/uikit/src/components/Svg/Icons/Hot.tsx create mode 100644 packages/uikit/src/components/Svg/Icons/Lock.tsx create mode 100644 packages/uikit/src/components/Svg/Icons/Split.tsx create mode 100644 packages/uikit/src/components/Svg/Icons/Unlock.tsx create mode 100644 src/components/Divider/index.tsx create mode 100644 src/config/abi/cakeVaultV2.json create mode 100644 src/config/abi/masterchefV1.json create mode 100644 src/hooks/useVaultApy.test.ts create mode 100644 src/hooks/useVaultApy.ts create mode 100644 src/hooks/useVaultMaxDuration.ts create mode 100644 src/pages/migration.tsx create mode 100644 src/state/farmsV1/fetchFarmUser.ts create mode 100644 src/state/farmsV1/fetchFarms.ts create mode 100644 src/state/farmsV1/fetchMasterChefData.ts create mode 100644 src/state/farmsV1/fetchPublicFarmData.ts create mode 100644 src/state/farmsV1/getFarmsPrices.ts create mode 100644 src/state/farmsV1/hooks.ts create mode 100644 src/state/farmsV1/index.ts create mode 100644 src/utils/cakePool.test.ts create mode 100644 src/utils/cakePool.ts create mode 100644 src/utils/isUndefinedOrNull.ts create mode 100644 src/views/Ifos/components/IfoPoolVaultCardDesktop.tsx create mode 100644 src/views/Ifos/components/IfoPoolVaultCardMobile.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/ActionPanel/ActionPanel.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/ActionPanel/Earned.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/ActionPanel/Liquidity.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/ActionPanel/Multiplier.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/ActionPanel/Staked.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Earned.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Farm.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Liquidity.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Multiplier.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Staked.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/Cells/Unstake.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/FarmRow.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/FarmTable.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/UnstakeButton.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldFarm/index.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/ActionPanel/ActionPanel.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/ActionPanel/AutoEarning.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/ActionPanel/Earning.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/ActionPanel/Stake.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/ActionPanel/TotalStaked.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/AutoEarningsCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/EarningsCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/ExpandActionCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/NameCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/StakedCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/TotalStakedCell.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/Cells/Unstaked.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/PoolRow.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/PoolTable.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/UnstakeButton.tsx create mode 100644 src/views/Migration/components/MigrationStep1/OldPool/index.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/ActionPanel/ActionPanel.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/ActionPanel/AprRow.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/ActionPanel/Staked.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/Cells/AprCell.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/Cells/StakeButtonCells.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/FarmRow.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/FarmTable.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/StakeButton.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewFarm/index.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewPool/ActionPanel/AprRow.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewPool/Cells/StakedCell.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewPool/PoolRow.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewPool/PoolTable.tsx create mode 100644 src/views/Migration/components/MigrationStep2/NewPool/index.tsx create mode 100644 src/views/Migration/components/MigrationSticky.tsx create mode 100644 src/views/Migration/components/MigrationTable/EmptyText.tsx create mode 100644 src/views/Migration/components/MigrationTable/Loading.tsx create mode 100644 src/views/Migration/components/MigrationTable/StyledTable.tsx create mode 100644 src/views/Migration/components/MigrationTable/TableHeader.tsx create mode 100644 src/views/Migration/components/ProgressSteps.tsx create mode 100644 src/views/Migration/components/types.ts create mode 100644 src/views/Migration/hook/V1/Farms/useUnstakeFarms.ts rename src/{state/pools => views/Migration/hook/V1/Pool}/fetchIfoPoolPublic.ts (54%) rename src/{state/pools => views/Migration/hook/V1/Pool}/fetchIfoPoolUser.ts (87%) create mode 100644 src/views/Migration/hook/V1/Pool/fetchPoolsUser.ts create mode 100644 src/views/Migration/hook/V1/Pool/useFetchIfoPool.ts create mode 100644 src/views/Migration/hook/V1/Pool/useFetchPublicPoolsData.ts create mode 100644 src/views/Migration/hook/V1/Pool/useFetchUserPools.ts create mode 100644 src/views/Migration/hook/V1/Pool/useUnstakePool.ts create mode 100644 src/views/Migration/index.tsx delete mode 100644 src/views/Pools/components/BountyCard.tsx delete mode 100644 src/views/Pools/components/BountyModal.tsx create mode 100644 src/views/Pools/components/CakeVaultCard/StakingApy.tsx delete mode 100644 src/views/Pools/components/HelpButton.tsx create mode 100644 src/views/Pools/components/LockedPool/Buttons/AddCakeButton.tsx create mode 100644 src/views/Pools/components/LockedPool/Buttons/CalculatorButton.tsx create mode 100644 src/views/Pools/components/LockedPool/Buttons/ConvertToFlexibleButton.tsx create mode 100644 src/views/Pools/components/LockedPool/Buttons/ExtendDurationButton.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/AfterLockedActions.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/BalanceField.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/BurningCountDown.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/ConvertToLock.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/LockDurationField.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/LockDurationRow.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/LockedActions.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/LockedModalBody.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/Overview/BalanceRow.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/Overview/CrossText.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/Overview/DateRow.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/Overview/TextRow.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/Overview/index.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/StaticAmount.tsx create mode 100644 src/views/Pools/components/LockedPool/Common/YieldBoostRow.tsx create mode 100644 src/views/Pools/components/LockedPool/LockedStakingApy.tsx create mode 100644 src/views/Pools/components/LockedPool/Modals/AddAmountModal.tsx create mode 100644 src/views/Pools/components/LockedPool/Modals/ExtendDurationModal.tsx create mode 100644 src/views/Pools/components/LockedPool/Modals/LockedStakeModal.tsx create mode 100644 src/views/Pools/components/LockedPool/Modals/RoiCalculatorModalProvider.tsx create mode 100644 src/views/Pools/components/LockedPool/hooks/useLockedPool.tsx create mode 100644 src/views/Pools/components/LockedPool/hooks/useUserDataInVaultPrensenter.ts create mode 100644 src/views/Pools/components/LockedPool/hooks/useUserEnoughCakeValidator.ts create mode 100644 src/views/Pools/components/LockedPool/types/index.ts create mode 100644 src/views/Pools/components/LockedPool/utils/formatRoi.ts create mode 100644 src/views/Pools/components/LockedPool/utils/formatSecondsToWeeks.ts create mode 100644 src/views/Pools/components/PoolsTable/ActionPanel/CakeVaultApr.tsx delete mode 100644 src/views/Pools/components/PoolsTable/Cells/IFOCreditCell.tsx create mode 100644 src/views/Pools/components/Stat.tsx create mode 100644 src/views/Pools/components/Vault/VaultPositionTag.tsx create mode 100644 src/views/Pools/components/Vault/VaultRoiCalculatorModal.tsx create mode 100644 src/views/Pools/components/Vault/VaultStakeButtonGroup.tsx create mode 100644 src/views/Pools/components/types/index.ts create mode 100644 src/views/Pools/components/utils/formatSecondsToWeeks.ts diff --git a/packages/uikit/src/components/BalanceInput/types.ts b/packages/uikit/src/components/BalanceInput/types.ts index 75a811cc1d275..bc4cc6b871b2f 100644 --- a/packages/uikit/src/components/BalanceInput/types.ts +++ b/packages/uikit/src/components/BalanceInput/types.ts @@ -1,5 +1,6 @@ import { InputHTMLAttributes, ReactNode, ReactText } from "react"; import { BoxProps } from "../Box"; +import { InputProps } from "../Input"; export interface BalanceInputProps extends BoxProps { value: ReactText; @@ -7,7 +8,7 @@ export interface BalanceInputProps extends BoxProps { innerRef?: React.RefObject; currencyValue?: ReactNode; placeholder?: string; - inputProps?: Omit, "value" | "placeholder" | "onChange">; + inputProps?: Omit, "value" | "placeholder" | "onChange"> & InputProps; isWarning?: boolean; decimals?: number; unit?: string; diff --git a/packages/uikit/src/components/Button/StyledButton.tsx b/packages/uikit/src/components/Button/StyledButton.tsx index f1b2422ed0ff6..4ce55b10b2477 100644 --- a/packages/uikit/src/components/Button/StyledButton.tsx +++ b/packages/uikit/src/components/Button/StyledButton.tsx @@ -1,4 +1,4 @@ -import styled, { DefaultTheme } from "styled-components"; +import styled, { DefaultTheme, css } from "styled-components"; import { space, layout, variant } from "styled-system"; import { scaleVariants, styleVariants } from "./theme"; import { BaseButtonProps } from "./types"; @@ -44,6 +44,7 @@ const getOpacity = ({ $isLoading = false }: TransientButtonProps) => { }; const StyledButton = styled.button` + position: relative; align-items: center; border: 0; border-radius: 16px; @@ -80,6 +81,28 @@ const StyledButton = styled.button` })} ${layout} ${space} + ${({ decorator, theme }) => + decorator && + css` + &::before { + content: "${decorator.text}"; + position: absolute; + border-bottom: 20px solid ${decorator.backgroundColor ?? theme.colors.secondary}; + border-left: 34px solid transparent; + border-right: 12px solid transparent; + height: 0; + top: -1px; + right: -12px; + width: 75px; + text-align: center; + padding-right: 30px; + line-height: 20px; + font-size: 12px; + font-weight: 400; + transform: rotate(31.17deg); + color: ${decorator.color ?? "white"}; + } + `} `; export default StyledButton; diff --git a/packages/uikit/src/components/Button/index.stories.tsx b/packages/uikit/src/components/Button/index.stories.tsx index 8cfdbe7b713d7..69d26d42cd594 100644 --- a/packages/uikit/src/components/Button/index.stories.tsx +++ b/packages/uikit/src/components/Button/index.stories.tsx @@ -50,9 +50,12 @@ export const Default: React.FC = () => { - + ); diff --git a/packages/uikit/src/components/Button/types.ts b/packages/uikit/src/components/Button/types.ts index e81c229f5aa1b..964e791fed6c8 100644 --- a/packages/uikit/src/components/Button/types.ts +++ b/packages/uikit/src/components/Button/types.ts @@ -31,6 +31,12 @@ export interface BaseButtonProps extends LayoutProps, SpaceProps { disabled?: boolean; startIcon?: ReactNode; endIcon?: ReactNode; + decorator?: { + backgroundColor?: string; + color?: string; + text: string; + direction?: "left" | "right"; + }; } export type ButtonProps

= PolymorphicComponentProps; diff --git a/packages/uikit/src/components/Card/CardRibbon.tsx b/packages/uikit/src/components/Card/CardRibbon.tsx index 7d55961d6f9d5..0a0faa87952db 100644 --- a/packages/uikit/src/components/Card/CardRibbon.tsx +++ b/packages/uikit/src/components/Card/CardRibbon.tsx @@ -61,7 +61,7 @@ const CardRibbon: React.FC = ({ variantColor, text, ribbonPosit }; CardRibbon.defaultProps = { - /* eslint-disable react/default-props-match-prop-types */ + // eslint-disable-next-line react/default-props-match-prop-types ribbonPosition: "right", }; diff --git a/packages/uikit/src/components/Dropdown/Dropdown.tsx b/packages/uikit/src/components/Dropdown/Dropdown.tsx index fba22a3238dc7..ddc4d7ede31bf 100644 --- a/packages/uikit/src/components/Dropdown/Dropdown.tsx +++ b/packages/uikit/src/components/Dropdown/Dropdown.tsx @@ -54,5 +54,9 @@ const Dropdown: React.FC = ({ target, position = "bottom", childr ); }; +Dropdown.defaultProps = { + // eslint-disable-next-line react/default-props-match-prop-types + position: "bottom", +}; export default Dropdown; diff --git a/packages/uikit/src/components/FallingBunnies/FallingBunnies.tsx b/packages/uikit/src/components/FallingBunnies/FallingBunnies.tsx index 0aad89da73f6f..660ddc7015e73 100644 --- a/packages/uikit/src/components/FallingBunnies/FallingBunnies.tsx +++ b/packages/uikit/src/components/FallingBunnies/FallingBunnies.tsx @@ -72,6 +72,7 @@ const FallingBunnies: React.FC = ({ duration = 10, }) => { const bunnies = [...Array(count)].map((_, index) => ( + // eslint-disable-next-line react/no-array-index-key diff --git a/packages/uikit/src/components/Link/Link.tsx b/packages/uikit/src/components/Link/Link.tsx index fe57e647443a7..2aedeb88bb9fa 100644 --- a/packages/uikit/src/components/Link/Link.tsx +++ b/packages/uikit/src/components/Link/Link.tsx @@ -18,6 +18,7 @@ const Link: React.FC = ({ external, ...props }) => { return ; }; +/* eslint-disable react/default-props-match-prop-types */ Link.defaultProps = { color: "primary", }; diff --git a/packages/uikit/src/components/Message/Message.tsx b/packages/uikit/src/components/Message/Message.tsx index 34a8d90356715..2e26fcd79fbe1 100644 --- a/packages/uikit/src/components/Message/Message.tsx +++ b/packages/uikit/src/components/Message/Message.tsx @@ -16,7 +16,6 @@ const Icons = { }; const MessageContainer = styled.div` - display: flex; background-color: gray; padding: 16px; border-radius: 16px; @@ -28,6 +27,10 @@ const MessageContainer = styled.div` })} `; +const Flex = styled.div` + display: flex; +`; + const colors = { // these color names should be place in the theme once the palette is finalized warning: "#D67E0A", @@ -44,13 +47,17 @@ export const MessageText: React.FC = ({ children, ...props }) => { ); }; -const Message: React.FC = ({ children, variant, icon, ...props }) => { +const Message: React.FC = ({ children, variant, icon, action, actionInline, ...props }) => { const Icon = Icons[variant]; return ( - {icon ?? } - {children} + + {icon ?? } + {children} + {actionInline && action} + + {!actionInline && action} ); diff --git a/packages/uikit/src/components/Message/types.ts b/packages/uikit/src/components/Message/types.ts index 2807f8a9e7fde..2c9c36cec517b 100644 --- a/packages/uikit/src/components/Message/types.ts +++ b/packages/uikit/src/components/Message/types.ts @@ -12,4 +12,6 @@ export type Variant = typeof variants[keyof typeof variants]; export interface MessageProps extends SpaceProps { variant: Variant; icon?: React.ReactNode; + action?: React.ReactNode; + actionInline?: boolean; } diff --git a/packages/uikit/src/components/Svg/Icons/Hot.tsx b/packages/uikit/src/components/Svg/Icons/Hot.tsx new file mode 100644 index 0000000000000..3eff661cb4138 --- /dev/null +++ b/packages/uikit/src/components/Svg/Icons/Hot.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import Svg from "../Svg"; +import { SvgProps } from "../types"; + +const Icon: React.FC = (props) => { + return ( + + + + ); +}; + +export default Icon; diff --git a/packages/uikit/src/components/Svg/Icons/Lock.tsx b/packages/uikit/src/components/Svg/Icons/Lock.tsx new file mode 100644 index 0000000000000..aab8fb732177e --- /dev/null +++ b/packages/uikit/src/components/Svg/Icons/Lock.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import Svg from "../Svg"; +import { SvgProps } from "../types"; + +const Icon: React.FC = (props) => { + return ( + + + + ); +}; + +export default Icon; diff --git a/packages/uikit/src/components/Svg/Icons/Split.tsx b/packages/uikit/src/components/Svg/Icons/Split.tsx new file mode 100644 index 0000000000000..b37cd1859bab2 --- /dev/null +++ b/packages/uikit/src/components/Svg/Icons/Split.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import Svg from "../Svg"; +import { SvgProps } from "../types"; + +const Icon: React.FC = (props) => { + return ( + + + + ); +}; + +export default Icon; diff --git a/packages/uikit/src/components/Svg/Icons/Unlock.tsx b/packages/uikit/src/components/Svg/Icons/Unlock.tsx new file mode 100644 index 0000000000000..86494b2af5b59 --- /dev/null +++ b/packages/uikit/src/components/Svg/Icons/Unlock.tsx @@ -0,0 +1,16 @@ +import React from "react"; +import Svg from "../Svg"; +import { SvgProps } from "../types"; + +const Icon: React.FC = (props) => { + return ( + + + + ); +}; + +export default Icon; diff --git a/packages/uikit/src/components/Svg/index.tsx b/packages/uikit/src/components/Svg/index.tsx index e882aaeda9e6f..5463440c7d037 100644 --- a/packages/uikit/src/components/Svg/index.tsx +++ b/packages/uikit/src/components/Svg/index.tsx @@ -1,5 +1,5 @@ -export { default as AccountIcon } from "./Icons/Account"; export { default as AccountFilledIcon } from "./Icons/AccountFilled"; +export { default as AccountIcon } from "./Icons/Account"; export { default as AddIcon } from "./Icons/Add"; export { default as ArrowBackIcon } from "./Icons/ArrowBack"; export { default as ArrowDownIcon } from "./Icons/ArrowDown"; @@ -8,12 +8,12 @@ export { default as ArrowDropUpIcon } from "./Icons/ArrowDropUp"; export { default as ArrowFirstIcon } from "./Icons/ArrowFirst"; export { default as ArrowForwardIcon } from "./Icons/ArrowForward"; export { default as ArrowLastIcon } from "./Icons/ArrowLast"; -export { default as ArrowUpIcon } from "./Icons/ArrowUp"; export { default as ArrowUpDownIcon } from "./Icons/ArrowUpDown"; +export { default as ArrowUpIcon } from "./Icons/ArrowUp"; export { default as AutoRenewIcon } from "./Icons/AutoRenew"; export { default as BackForwardIcon } from "./Icons/BackForwardIcon"; -export { default as BinanceIcon } from "./Icons/Binance"; export { default as BinanceChainIcon } from "./Icons/BinanceChain"; +export { default as BinanceIcon } from "./Icons/Binance"; export { default as BlockIcon } from "./Icons/Block"; export { default as BnbUsdtPairTokenIcon } from "./Icons/BnbUsdtPairToken"; export { default as BscScanIcon } from "./Icons/BscScan"; @@ -23,11 +23,11 @@ export { default as CalculateIcon } from "./Icons/Calculate"; export { default as CameraIcon } from "./Icons/Camera"; export { default as Cards } from "./Icons/Cards"; export { default as CardViewIcon } from "./Icons/CardView"; -export { default as ChartIcon } from "./Icons/Chart"; export { default as ChartDisableIcon } from "./Icons/ChartDisable"; -export { default as CheckmarkIcon } from "./Icons/Checkmark"; -export { default as CheckmarkCircleIcon } from "./Icons/CheckmarkCircle"; +export { default as ChartIcon } from "./Icons/Chart"; export { default as CheckmarkCircleFillIcon } from "./Icons/CheckmarkCircleFill"; +export { default as CheckmarkCircleIcon } from "./Icons/CheckmarkCircle"; +export { default as CheckmarkIcon } from "./Icons/Checkmark"; export { default as ChevronDownIcon } from "./Icons/ChevronDown"; export { default as ChevronLeftIcon } from "./Icons/ChevronLeft"; export { default as ChevronRightIcon } from "./Icons/ChevronRight"; @@ -37,34 +37,36 @@ export { default as CloseIcon } from "./Icons/Close"; export { default as CogIcon } from "./Icons/Cog"; export { default as Coin98Icon } from "./Icons/Coin98"; export { default as CoinbaseWalletIcon } from "./Icons/CoinbaseWallet"; -export { default as CommunityIcon } from "./Icons/Community"; export { default as CommunityFilledIcon } from "./Icons/CommunityFilled"; +export { default as CommunityIcon } from "./Icons/Community"; export { default as CopyIcon } from "./Icons/Copy"; export { default as CurrencyIcon } from "./Icons/Currency"; export { default as DiscordIcon } from "./Icons/Discord"; -export { default as EarnIcon } from "./Icons/Earn"; -export { default as EarnFillIcon } from "./Icons/EarnFill"; export { default as EarnFilledIcon } from "./Icons/EarnFilled"; +export { default as EarnFillIcon } from "./Icons/EarnFill"; +export { default as EarnIcon } from "./Icons/Earn"; export { default as EllipsisIcon } from "./Icons/Ellipsis"; export { default as ErrorIcon } from "./Icons/Error"; export { default as ExpandIcon } from "./Icons/Expand"; export { default as FarmIcon } from "./Icons/Farm"; export { default as GithubIcon } from "./Icons/Github"; export { default as GroupsIcon } from "./Icons/Groups"; -export { default as HamburgerIcon } from "./Icons/Hamburger"; export { default as HamburgerCloseIcon } from "./Icons/HamburgerClose"; +export { default as HamburgerIcon } from "./Icons/Hamburger"; export { default as HelpIcon } from "./Icons/Help"; export { default as HistoryIcon } from "./Icons/History"; export { default as HomeIcon } from "./Icons/Home"; +export { default as HotIcon } from "./Icons/Hot"; export { default as IfoIcon } from "./Icons/Ifo"; export { default as InfoIcon } from "./Icons/Info"; export { default as InstagramIcon } from "./Icons/Instagram"; -export { default as LanguageIcon } from "./Icons/Language"; export { default as LanguageCurrencyIcon } from "./Icons/LanguageCurrency"; +export { default as LanguageIcon } from "./Icons/Language"; export { default as LaurelLeftIcon } from "./Icons/LaurelLeft"; export { default as LaurelRightIcon } from "./Icons/LaurelRight"; export { default as LineGraphIcon } from "./Icons/LineGraph"; export { default as ListViewIcon } from "./Icons/ListView"; +export { default as LockIcon } from "./Icons/Lock"; export { default as LoginIcon } from "./Icons/Login"; export { default as LogoIcon } from "./Icons/Logo"; export { default as LogoRoundIcon } from "./Icons/LogoRound"; @@ -80,12 +82,12 @@ export { default as MediumIcon } from "./Icons/Medium"; export { default as MetamaskIcon } from "./Icons/Metamask"; export { default as MinusIcon } from "./Icons/Minus"; export { default as MoonIcon } from "./Icons/Moon"; -export { default as MoreIcon } from "./Icons/More"; export { default as MoreHorizontalIcon } from "./Icons/MoreHorizontal"; +export { default as MoreIcon } from "./Icons/More"; export { default as MoreVerticalIcon } from "./Icons/MoreVertical"; -export { default as NftIcon } from "./Icons/Nft"; -export { default as NftFillIcon } from "./Icons/NftFill"; export { default as NftFilledIcon } from "./Icons/NftFilled"; +export { default as NftFillIcon } from "./Icons/NftFill"; +export { default as NftIcon } from "./Icons/Nft"; export { default as NoProfileAvatarIcon } from "./Icons/NoProfileAvatar"; export { default as OpenNewIcon } from "./Icons/OpenNew"; export { default as PancakeRoundIcon } from "./Icons/PancakeRound"; @@ -103,8 +105,8 @@ export { default as ProposalIcon } from "./Icons/Proposal"; export { default as RedditIcon } from "./Icons/Reddit"; export { default as RefreshIcon } from "./Icons/Refresh"; export { default as RemoveIcon } from "./Icons/Remove"; -export { default as ResourcesIcon } from "./Icons/Resources"; export { default as ResourcesFilledIcon } from "./Icons/ResourcesFilled"; +export { default as ResourcesIcon } from "./Icons/Resources"; export { default as SafePalIcon } from "./Icons/SafePal"; export { default as SearchIcon } from "./Icons/Search"; export { default as SellIcon } from "./Icons/Sell"; @@ -112,11 +114,12 @@ export { default as ShareIcon } from "./Icons/Share"; export { default as ShrinkIcon } from "./Icons/Shrink"; export { default as SmallDotIcon } from "./Icons/SmallDot"; export { default as SmartContractIcon } from "./Icons/SmartContract"; +export { default as SplitIcon } from "./Icons/Split"; export { default as StarFillIcon } from "./Icons/StarFill"; export { default as StarLineIcon } from "./Icons/StarLine"; export { default as SunIcon } from "./Icons/Sun"; -export { default as SwapIcon } from "./Icons/Swap"; export { default as SwapFillIcon } from "./Icons/SwapFill"; +export { default as SwapIcon } from "./Icons/Swap"; export { default as SwapVertIcon } from "./Icons/SwapVert"; export { default as SyncAltIcon } from "./Icons/SyncAlt"; export { default as TeamBattleIcon } from "./Icons/TeamBattle"; @@ -128,15 +131,16 @@ export { default as TicketFillIcon } from "./Icons/TicketFill"; export { default as TicketRound } from "./Icons/TicketRound"; export { default as TimerIcon } from "./Icons/Timer"; export { default as TokenPocketIcon } from "./Icons/TokenPocket"; -export { default as TradeIcon } from "./Icons/Trade"; export { default as TradeFilledIcon } from "./Icons/TradeFilled"; +export { default as TradeIcon } from "./Icons/Trade"; export { default as TradingViewIcon } from "./Icons/TradingView"; -export { default as TrophyIcon } from "./Icons/Trophy"; export { default as TrophyFillIcon } from "./Icons/TrophyFill"; export { default as TrophyGoldIcon } from "./Icons/TrophyGold"; +export { default as TrophyIcon } from "./Icons/Trophy"; export { default as TrustWalletIcon } from "./Icons/TrustWallet"; export { default as TuneIcon } from "./Icons/Tune"; export { default as TwitterIcon } from "./Icons/Twitter"; +export { default as UnlockIcon } from "./Icons/Unlock"; export { default as VerifiedIcon } from "./Icons/Verified"; export { default as VisibilityOff } from "./Icons/VisibilityOff"; export { default as VisibilityOn } from "./Icons/VisibilityOn"; @@ -144,9 +148,9 @@ export { default as VolumeOffIcon } from "./Icons/VolumeOff"; export { default as VolumeUpIcon } from "./Icons/VolumeUp"; export { default as VoteIcon } from "./Icons/Vote"; export { default as WaitIcon } from "./Icons/Wait"; -export { default as WalletIcon } from "./Icons/Wallet"; export { default as WalletConnectIcon } from "./Icons/WalletConnect"; export { default as WalletFilledIcon } from "./Icons/WalletFilled"; +export { default as WalletIcon } from "./Icons/Wallet"; export { default as WarningIcon } from "./Icons/Warning"; export { default as Svg } from "./Svg"; export type { SvgProps } from "./types"; diff --git a/packages/uikit/src/components/Tag/Tag.tsx b/packages/uikit/src/components/Tag/Tag.tsx index ef99d63afb58d..ac4308d19be4f 100644 --- a/packages/uikit/src/components/Tag/Tag.tsx +++ b/packages/uikit/src/components/Tag/Tag.tsx @@ -16,6 +16,7 @@ const Tag: React.FC = ({ startIcon, endIcon, children, ...props }) => ); +/* eslint-disable react/default-props-match-prop-types */ Tag.defaultProps = { variant: "primary", scale: scales.MD, diff --git a/packages/uikit/src/components/Text/Text.tsx b/packages/uikit/src/components/Text/Text.tsx index fee916b42b319..87250985a0695 100644 --- a/packages/uikit/src/components/Text/Text.tsx +++ b/packages/uikit/src/components/Text/Text.tsx @@ -11,13 +11,8 @@ const getColor = ({ color, theme }: ThemedProps) => { return getThemeValue(`colors.${color}`, color)(theme); }; -const getFontSize = ({ fontSize, small }: TextProps) => { - return small ? "14px" : fontSize || "16px"; -}; - const Text = styled.div` color: ${getColor}; - font-size: ${getFontSize}; font-weight: ${({ bold }) => (bold ? 600 : 400)}; line-height: 1.5; ${({ textTransform }) => textTransform && `text-transform: ${textTransform};`} @@ -30,11 +25,14 @@ const Text = styled.div` ${space} ${typography} ${layout} + + ${({ small }) => small && `font-size: 14px;`} `; Text.defaultProps = { color: "text", small: false, + fontSize: "16px", ellipsis: false, }; diff --git a/packages/uikit/src/components/Text/types.ts b/packages/uikit/src/components/Text/types.ts index 34dd9403f132e..8654aeb181fb5 100644 --- a/packages/uikit/src/components/Text/types.ts +++ b/packages/uikit/src/components/Text/types.ts @@ -2,7 +2,6 @@ import { LayoutProps, SpaceProps, TypographyProps } from "styled-system"; export interface TextProps extends SpaceProps, TypographyProps, LayoutProps { color?: string; - fontSize?: string; bold?: boolean; small?: boolean; ellipsis?: boolean; diff --git a/packages/uikit/src/widgets/Modal/ModalContext.tsx b/packages/uikit/src/widgets/Modal/ModalContext.tsx index cbc7f18b46104..5af55b77a3980 100644 --- a/packages/uikit/src/widgets/Modal/ModalContext.tsx +++ b/packages/uikit/src/widgets/Modal/ModalContext.tsx @@ -1,4 +1,4 @@ -import { AnimatePresence, m, Variants, LazyMotion, domAnimation } from "framer-motion"; +import { AnimatePresence, Variants, m, LazyMotion, domAnimation } from "framer-motion"; import React, { createContext, useState, useRef } from "react"; import styled, { keyframes } from "styled-components"; import { Overlay } from "../../components/Overlay"; diff --git a/src/components/Balance.tsx b/src/components/Balance.tsx index c65604af85ba5..d663de0ffcd28 100644 --- a/src/components/Balance.tsx +++ b/src/components/Balance.tsx @@ -1,7 +1,12 @@ -import { Text, TextProps } from '@pancakeswap/uikit' +import { Text, TextProps, Skeleton } from '@pancakeswap/uikit' import { useEffect, useRef } from 'react' import CountUp from 'react-countup' import styled, { keyframes } from 'styled-components' +import isUndefinedOrNull from 'utils/isUndefinedOrNull' +import _toNumber from 'lodash/toNumber' +import _isNaN from 'lodash/isNaN' +import _replace from 'lodash/replace' +import _toString from 'lodash/toString' interface BalanceProps extends TextProps { value: number @@ -43,18 +48,34 @@ const Balance: React.FC = ({ ) } -export default Balance +export const BalanceWithLoading: React.FC & { value: string | number }> = ({ + value, + fontSize, + ...props +}) => { + if (isUndefinedOrNull(value)) { + return + } + + const trimedValue = _replace(_toString(value), /,/g, '') + + const finalValue = _isNaN(trimedValue) || _isNaN(_toNumber(trimedValue)) ? 0 : _toNumber(trimedValue) + + return +} const appear = keyframes` from { opacity:0; } - + to { opacity:1; } -` + ` export const AnimatedBalance = styled(Balance)` animation: ${appear} 0.65s ease-in-out forwards; ` + +export default Balance diff --git a/src/components/Divider/index.tsx b/src/components/Divider/index.tsx new file mode 100644 index 0000000000000..17bdfce09a2d9 --- /dev/null +++ b/src/components/Divider/index.tsx @@ -0,0 +1,8 @@ +import styled from 'styled-components' + +const Divider = styled.hr` + border: 1px solid ${({ theme }) => theme.colors.cardBorder}; + width: 100%; +` + +export default Divider diff --git a/src/components/RoiCalculatorModal/RoiCalculatorFooter.tsx b/src/components/RoiCalculatorModal/RoiCalculatorFooter.tsx index 24a949ad96b21..5cc1a861b519b 100644 --- a/src/components/RoiCalculatorModal/RoiCalculatorFooter.tsx +++ b/src/components/RoiCalculatorModal/RoiCalculatorFooter.tsx @@ -29,7 +29,8 @@ const BulletList = styled.ul` interface RoiCalculatorFooterProps { isFarm: boolean - apr: number + apr?: number + apy?: number displayApr: string autoCompoundFrequency: number multiplier: string @@ -41,6 +42,7 @@ interface RoiCalculatorFooterProps { const RoiCalculatorFooter: React.FC = ({ isFarm, apr, + apy, displayApr, autoCompoundFrequency, multiplier, @@ -70,7 +72,6 @@ const RoiCalculatorFooter: React.FC = ({ ) const gridRowCount = isFarm ? 4 : 2 - const apy = (getApy(apr, autoCompoundFrequency > 0 ? autoCompoundFrequency : 1, 365, performanceFee) * 100).toFixed(2) return (