diff --git a/src/core/state/quickPromo/index.ts b/src/core/state/quickPromo/index.ts index ab35c8d169..bd1990c927 100644 --- a/src/core/state/quickPromo/index.ts +++ b/src/core/state/quickPromo/index.ts @@ -6,6 +6,7 @@ export enum promoTypes { command_k = 'command_k', wallet_switcher = 'wallet_switcher', network_settings = 'network_settings', + degen_mode = 'degen_mode', } export type PromoTypes = keyof typeof promoTypes; @@ -20,6 +21,7 @@ export const quickPromoStore = createStore( command_k: false, wallet_switcher: false, network_settings: false, + degen_mode: false, }, setSeenPromo: (key: PromoTypes) => { const seenPromos = get().seenPromos; diff --git a/src/entries/popup/pages/swap/index.tsx b/src/entries/popup/pages/swap/index.tsx index 8a21494b07..fca9dc4f28 100644 --- a/src/entries/popup/pages/swap/index.tsx +++ b/src/entries/popup/pages/swap/index.tsx @@ -7,11 +7,13 @@ import config from '~/core/firebase/remoteConfig'; import { i18n } from '~/core/languages'; import { shortcuts } from '~/core/references/shortcuts'; import { useCurrentAddressStore, useGasStore } from '~/core/state'; +import { useFeatureFlagsStore } from '~/core/state/currentSettings/featureFlags'; import { computeUniqueIdForHiddenAsset, useHiddenAssetStore, } from '~/core/state/hiddenAssets/hiddenAssets'; import { usePopupInstanceStore } from '~/core/state/popupInstances'; +import { promoTypes, useQuickPromoStore } from '~/core/state/quickPromo'; import { useSelectedTokenStore } from '~/core/state/selectedToken'; import { ParsedSearchAsset, ParsedUserAsset } from '~/core/types/assets'; import { ChainId } from '~/core/types/chains'; @@ -219,6 +221,80 @@ const MissingPriceExplanation = ({ ); }; +const DegenModePromo = ({ onClick }: { onClick: () => void }) => { + const { featureFlags } = useFeatureFlagsStore(); + const { seenPromos, setSeenPromo } = useQuickPromoStore(); + const isDegenModeEnabled = useDegenMode((s) => s.isDegenModeEnabled); + + if (!featureFlags.degen_mode && !config.degen_mode) return null; + if (seenPromos.degen_mode || isDegenModeEnabled) return null; + + return ( + + { + setSeenPromo(promoTypes.degen_mode); + onClick(); + }} + > + + + + + + {i18n.t('swap.promo.degen_mode.title')} + + + + + + + ); +}; + +const SwapAlerts = ({ + timeEstimate, + priceImpact, + quote, + onClick, +}: { + timeEstimate?: SwapTimeEstimate | null; + priceImpact?: SwapPriceImpact; + quote: Quote | CrosschainQuote | QuoteError | undefined; + onClick: () => void; +}) => { + const showWarning = useMemo(() => { + return ( + priceImpact?.type !== SwapPriceImpactType.none || timeEstimate?.isLongWait + ); + }, [priceImpact?.type, timeEstimate?.isLongWait]); + + const quoteError = (quote as QuoteError)?.error; + + if (showWarning) { + return ( + + ); + } else if (quote && !quoteError) { + return ; + } + return null; +}; + function SwapButton({ quote, assetToSell, @@ -813,14 +889,12 @@ export function Swap({ bridge = false }: { bridge?: boolean }) { /> - - {/* */} diff --git a/static/json/languages/en_US.json b/static/json/languages/en_US.json index ed1b8d5065..0af93da120 100644 --- a/static/json/languages/en_US.json +++ b/static/json/languages/en_US.json @@ -733,6 +733,11 @@ "description": "If you decide to continue, be sure that you are satisfied receiving the quoted amount." } }, + "promo": { + "degen_mode": { + "title": "Try Degen Mode to skip the review" + } + }, "aggregators": { "rainbow": "Auto" },