diff --git a/apps/root/src/common/components/modify-settings-modal/index.tsx b/apps/root/src/common/components/modify-settings-modal/index.tsx index f7207e5d8..85333d5a4 100644 --- a/apps/root/src/common/components/modify-settings-modal/index.tsx +++ b/apps/root/src/common/components/modify-settings-modal/index.tsx @@ -69,7 +69,6 @@ import useDcaAllowanceTarget from '@hooks/useDcaAllowanceTarget'; import { abs } from '@common/utils/bigint'; import ChangesSummary from './components/changes-summary'; import { AddPositionToCalendarButton } from '../add-position-to-calendar'; -import { Chains } from '@balmy/sdk'; const StyledSummaryContainer = styled.div` display: flex; @@ -584,7 +583,6 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr const minimumTokensNeeded = usdPriceToToken(from, minimumToUse, usdPrice); - const shouldDisableIncrease = position.chainId === Chains.ROOTSTOCK.chainId; let actions: { label: React.ReactNode; onClick: () => void; @@ -609,7 +607,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr /> ), onClick: () => handleApproveToken(), - disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!hasPendingApproval || shouldDisableByUsd || isIncreasingPosition, options: [ { text: ( @@ -627,7 +625,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr }} /> ), - disabled: !!hasPendingApproval || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!hasPendingApproval || shouldDisableByUsd || isIncreasingPosition, onClick: () => handleApproveToken(true), }, ], @@ -668,7 +666,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwaps, - disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || shouldDisableIncrease, + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -680,8 +678,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwaps, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -693,8 +690,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwapsSafe, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } @@ -706,8 +702,7 @@ const ModifySettingsModal = ({ position, open, onCancel }: ModifySettingsModalPr variant: 'contained', label: , onClick: handleModifyRateAndSwapsSafe, - disabled: - !!cantFund || frequencyValue === '0' || shouldDisableByUsd || (isIncreasingPosition && shouldDisableIncrease), + disabled: !!cantFund || frequencyValue === '0' || shouldDisableByUsd || isIncreasingPosition, }, ]; } diff --git a/apps/root/src/frame/components/navigation/index.tsx b/apps/root/src/frame/components/navigation/index.tsx index b84196093..5d9898d2c 100644 --- a/apps/root/src/frame/components/navigation/index.tsx +++ b/apps/root/src/frame/components/navigation/index.tsx @@ -14,7 +14,7 @@ import usePushToHistory from '@hooks/usePushToHistory'; import { changeRoute } from '@state/tabs/actions'; import { useRoute } from '@state/tabs/hooks'; import React, { useCallback } from 'react'; -import { defineMessage, useIntl } from 'react-intl'; +import { defineMessage, FormattedMessage, useIntl } from 'react-intl'; import { Switch, Navigation as NavigationUI, @@ -34,6 +34,9 @@ import { TrashIcon, MovingStarIcon, DollarSquareIcon, + Link, + Typography, + colors, } from 'ui-library'; // import { setSwitchActiveWalletOnConnectionThunk, toggleTheme } from '@state/config/actions'; // import { useSwitchActiveWalletOnConnection, useThemeMode } from '@state/config/hooks'; @@ -287,11 +290,34 @@ const Navigation = ({ children }: React.PropsWithChildren) => { ] : []; + const SunsetMessage = () => ( + + + `0px ${spacing(1)}`, + color: colors[mode].typography.white, + textDecorationColor: colors[mode].typography.white, + }} + > + + + + ); + return ( <> } + warning={} + warningLevel="error" headerContent={ ; + +export type UnitsIndexedByChainPercentage = Record< + Address, + Record> +>; // > + export const IncludedIndexerUnitsArrayTypes: IncludedIndexerUnits[] = [ IndexerUnits.DCA, IndexerUnits.AGG_SWAPS, - IndexerUnits.ERC20_APPROVALS, - IndexerUnits.ERC20_TRANSFERS, IndexerUnits.EARN, - IndexerUnits.NATIVE_TRANSFERS, ] as const; export default function useIsSomeWalletIndexed(wallet?: Address) { diff --git a/apps/root/src/pages/dca/create-position/components/dca-button/index.tsx b/apps/root/src/pages/dca/create-position/components/dca-button/index.tsx index d208ebe2d..9d51685c5 100644 --- a/apps/root/src/pages/dca/create-position/components/dca-button/index.tsx +++ b/apps/root/src/pages/dca/create-position/components/dca-button/index.tsx @@ -99,6 +99,7 @@ const DcaButton = ({ const swapsIsMax = BigInt(frequencyValue || '0') > maxUint32; const shouldDisableApproveButton = + true || !from || !to || !fromValue || @@ -106,7 +107,7 @@ const DcaButton = ({ cantFund || !balance || allowanceErrors || - parseUnits(fromValue, from.decimals) <= 0 || + parseUnits(fromValue, from?.decimals || 0) <= 0 || BigInt(frequencyValue) <= 0 || (shouldEnableYield && fromCanHaveYield && isUndefined(fromYield)) || (shouldEnableYield && toCanHaveYield && isUndefined(toYield)); diff --git a/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx b/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx index 4d2ab6b88..236267fa7 100644 --- a/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx +++ b/apps/root/src/pages/dca/positions/components/positions-list/current-positions/components/position-card-button/index.tsx @@ -107,9 +107,10 @@ const PositionCardButton = ({ const fromHasYield = !!position.from.underlyingTokens.length; const toHasYield = !!position.to.underlyingTokens.length; - const canAddFunds = VERSIONS_ALLOWED_MODIFY.includes(position.version); + const canAddFunds = false && VERSIONS_ALLOWED_MODIFY.includes(position.version); const disabledIncrease = + true || disabled || !dcaTokens[`${chainId}-${position.from.address.toLowerCase()}` as TokenListId] || !dcaTokens[`${chainId}-${position.to.address.toLowerCase()}` as TokenListId] || diff --git a/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx b/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx index 91b1e2fb2..70b202235 100644 --- a/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx +++ b/apps/root/src/pages/earn/components/strategies-display-wrapper/index.tsx @@ -24,7 +24,6 @@ interface StrategiesTableProps { withPagination?: boolean; showBalances?: boolean; farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen?: () => void; } const StrategiesDisplayWrapper = ({ @@ -35,7 +34,6 @@ const StrategiesDisplayWrapper = ({ withPagination, showBalances = true, farmsWithDepositableTokens, - handleMigrationModalOpen, }: StrategiesTableProps) => { const [page, setPage] = React.useState(0); const pushToHistory = usePushToHistory(); @@ -74,7 +72,6 @@ const StrategiesDisplayWrapper = ({ variant={variant} setPage={setPage} farmsWithDepositableTokens={farmsWithDepositableTokens} - handleMigrationModalOpen={handleMigrationModalOpen} /> {shouldShowMobileList ? ( ` - background-color: ${colors[palette.mode].accentPrimary}; - border-radius: 100px; - width: ${spacing(4.5)}; - height: ${spacing(4.5)}; - `} -`; +// const StyledMigrationAmount = styled(ContainerBox).attrs({ +// alignItems: 'center', +// justifyContent: 'center', +// })` +// ${({ theme: { palette, spacing } }) => ` +// background-color: ${colors[palette.mode].accentPrimary}; +// border-radius: 100px; +// width: ${spacing(4.5)}; +// height: ${spacing(4.5)}; +// `} +// `; -const AllStrategiesHeading = ({ - farmsWithDepositableTokens = [], - handleMigrationModalOpen, -}: { - farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen?: () => void; -}) => { - const { trackEvent } = useAnalytics(); +const AllStrategiesHeading = ( + { + // farmsWithDepositableTokens = [], + }: { + // farmsWithDepositableTokens?: FarmsWithAvailableDepositTokens; + } +) => { + // const { trackEvent } = useAnalytics(); const [isNotifyEmailModalOpen, setIsNotifyEmailModalOpen] = useState(false); - const migrableTokensAmount = farmsWithDepositableTokens?.filter( - (farm) => Number(farm.balance.amountInUSD) > 1 - ).length; - - const onMigrationModalOpen = () => { - if (!handleMigrationModalOpen) { - return; - } - handleMigrationModalOpen(); - trackEvent('Earn - One click migration - Table Toolbar - Open migration modal'); - }; + // const migrableTokensAmount = farmsWithDepositableTokens?.filter( + // (farm) => Number(farm.balance.amountInUSD) > 1 + // ).length; return ( <> @@ -55,7 +47,7 @@ const AllStrategiesHeading = ({ /> - + */} diff --git a/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx b/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx index a23c24c43..68fbae297 100644 --- a/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx +++ b/apps/root/src/pages/earn/components/strategies-table/components/toolbar/index.tsx @@ -34,8 +34,7 @@ const AllStrategiesTableToolbar = ({ variant, strategiesCount, setPage, - farmsWithDepositableTokens, - handleMigrationModalOpen, + // farmsWithDepositableTokens, }: AllStrategiesTableToolbarProps) => { const intl = useIntl(); const dispatch = useAppDispatch(); @@ -54,10 +53,7 @@ const AllStrategiesTableToolbar = ({ return ( {variant === StrategiesTableVariants.ALL_STRATEGIES ? ( - + ) : ( colors[mode].typography.typo1}> diff --git a/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx b/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx index ce21c7eec..3fbc560bd 100644 --- a/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx +++ b/apps/root/src/pages/earn/home/components/all-strategies-table/index.tsx @@ -11,10 +11,8 @@ const variant = StrategiesTableVariants.ALL_STRATEGIES; const AllStrategiesTable = ({ farmsWithDepositableTokens, - handleMigrationModalOpen, }: { farmsWithDepositableTokens: FarmsWithAvailableDepositTokens; - handleMigrationModalOpen: () => void; }) => { const hasFetchedAllStrategies = useHasFetchedAllStrategies(); const strategies = useAllStrategiesForTable(); @@ -34,7 +32,6 @@ const AllStrategiesTable = ({ isLoading={!hasFetchedAllStrategies} withPagination farmsWithDepositableTokens={farmsWithDepositableTokens} - handleMigrationModalOpen={handleMigrationModalOpen} /> ); }; diff --git a/apps/root/src/pages/earn/home/frame/index.tsx b/apps/root/src/pages/earn/home/frame/index.tsx index b624d35ac..1f6ab9b9e 100644 --- a/apps/root/src/pages/earn/home/frame/index.tsx +++ b/apps/root/src/pages/earn/home/frame/index.tsx @@ -9,18 +9,15 @@ import useEarnService from '@hooks/earn/useEarnService'; import AllStrategiesTable from '../components/all-strategies-table'; import useHasFetchedAllStrategies from '@hooks/earn/useHasFetchedAllStrategies'; import { FormattedMessage } from 'react-intl'; -import OneClickMigrationCard from '../components/one-click-migration-card'; import { useIsEarnMobile } from '@hooks/earn/useIsEarnMobile'; import useAvailableDepositTokens from '@hooks/earn/useAvailableDepositTokens'; -import OneClickMigrationModal from '../components/one-click-migration-modal'; const EarnFrame = () => { const dispatch = useAppDispatch(); const earnService = useEarnService(); const hasFetchedAllStrategies = useHasFetchedAllStrategies(); - const [migrationModalOpen, setMigrationModalOpen] = React.useState(false); - const { farmsWithDepositableTokens, updateFarmTokensBalances, isFetchingDepositTokenBalances } = - useAvailableDepositTokens(); + // const [migrationModalOpen, setMigrationModalOpen] = React.useState(false); + const { farmsWithDepositableTokens } = useAvailableDepositTokens(); React.useEffect(() => { dispatch(changeRoute(EARN_ROUTE.key)); }, []); @@ -34,21 +31,21 @@ const EarnFrame = () => { } }, []); - const handleMigrationModalOpen = () => { - setMigrationModalOpen(true); - void updateFarmTokensBalances(); - }; + // const handleMigrationModalOpen = () => { + // setMigrationModalOpen(true); + // void updateFarmTokensBalances(); + // }; const isEarnMobile = useIsEarnMobile(); return ( <> - setMigrationModalOpen(false)} farmsWithDepositableTokens={farmsWithDepositableTokens} isFetchingDepositTokenBalances={isFetchingDepositTokenBalances} - /> + /> */} @@ -65,17 +62,17 @@ const EarnFrame = () => { /> - + /> */} diff --git a/apps/root/src/pages/history/components/historyTable/index.tsx b/apps/root/src/pages/history/components/historyTable/index.tsx index 00c31faf1..9e70650a3 100644 --- a/apps/root/src/pages/history/components/historyTable/index.tsx +++ b/apps/root/src/pages/history/components/historyTable/index.tsx @@ -562,6 +562,8 @@ const HistoryTable = ({ search, tokens, height, solid }: HistoryTableProps) => { const isLoadingWithoutEvents = isLoading && events.length === 0; const preFilteredEvents = React.useMemo( + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore () => filterEventsByUnitIndexed(events, unitsByChainPercentages), [unitsByChainPercentages, events] ); diff --git a/apps/root/src/pages/home/components/activity/index.tsx b/apps/root/src/pages/home/components/activity/index.tsx index 0da1b71ea..acfa8c2d1 100644 --- a/apps/root/src/pages/home/components/activity/index.tsx +++ b/apps/root/src/pages/home/components/activity/index.tsx @@ -330,10 +330,14 @@ const Activity = ({ selectedWalletOption }: ActivityProps) => { const filteredEvents = React.useMemo(() => { if (selectedWalletOption === ALL_WALLETS) { + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore return filterEventsByUnitIndexed(events, unitsByChainPercentages); } else { return filterEventsByUnitIndexed( events.filter((event) => getTransactionInvolvedWallets(event).includes(selectedWalletOption)), + // eslint-disable-next-line @typescript-eslint/ban-ts-comment + // @ts-ignore unitsByChainPercentages ); } diff --git a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx index 2100b5c2d..98c68252e 100644 --- a/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx +++ b/apps/root/src/pages/position-detail/components/position-summary-controls/index.tsx @@ -152,7 +152,7 @@ const PositionSummaryControls = ({ show, pendingTransaction, position, ownerWall return () => { if (downloadUrl) URL.revokeObjectURL(downloadUrl); }; - }, []); + }, [position]); const onTerminate = () => { setShowTerminateModal(true); diff --git a/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx b/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx index 1b76617e6..15fbb3344 100644 --- a/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx +++ b/apps/root/src/pages/strategy-guardian-detail/strategy-management/deposit/cta-button/index.tsx @@ -73,7 +73,14 @@ const EarnDepositCTAButton = ({ !!asset && !!depositAmount && !!balance && parseUnits(depositAmount, asset.decimals) > BigInt(balance.amount); const shouldDisableApproveButton = - !asset || !depositAmount || cantFund || !balance || isLoading || allowanceErrors || Number(depositAmount) === 0; + true || + !asset || + !depositAmount || + cantFund || + !balance || + isLoading || + allowanceErrors || + Number(depositAmount) === 0; const shouldDisableButton = shouldDisableApproveButton || !isApproved; diff --git a/packages/ui-library/src/components/navigation/index.tsx b/packages/ui-library/src/components/navigation/index.tsx index d08d36e65..f350220a6 100644 --- a/packages/ui-library/src/components/navigation/index.tsx +++ b/packages/ui-library/src/components/navigation/index.tsx @@ -22,7 +22,7 @@ import { ListItemButton } from '../listitembutton'; import { ListItemIcon } from '../listitemicon'; import { ListItemText } from '../listitemtext'; import { Container } from '../container'; -import { Link, Typography, useMediaQuery, useTheme } from '@mui/material'; +import { Alert, Link, Typography, useMediaQuery, useTheme } from '@mui/material'; import BalmyLogoLight from '../../assets/balmy-logo-light'; import BalmyLogoDark from '../../assets/balmy-logo-dark'; import styled from 'styled-components'; @@ -73,6 +73,8 @@ type NavigationProps = React.PropsWithChildren<{ headerContent?: React.ReactNode; promotedBanner?: React.ReactNode; shareReferralLink?: React.ReactNode; + warning?: React.ReactNode; + warningLevel?: 'info' | 'warning' | 'error'; }>; const drawerWidthLg = 240; @@ -344,6 +346,8 @@ const Navigation = ({ headerContent, promotedBanner, shareReferralLink, + warning, + warningLevel, }: NavigationProps) => { const [mobileOpen, setMobileOpen] = useState(false); const { @@ -403,6 +407,18 @@ const Navigation = ({ backgroundColor: colors[mode].background.secondary, }} > + {warning && ( + + {warning} + + )}