From 0c839bcf7342252d825b031e02b46f39975fdb71 Mon Sep 17 00:00:00 2001 From: Alexandr Kazachenko Date: Wed, 1 Nov 2023 15:45:25 +0600 Subject: [PATCH] fix: revert halloween theme (#3306) * chore: revert og images * chore: revert layer3 banner * chore: revert halloween theme --- apps/cowswap-frontend/index.html | 10 ++++----- .../src/common/constants/theme.ts | 2 +- .../src/legacy/state/cowToken/middleware.ts | 5 ++--- .../orders/middleware/soundMiddleware.ts | 5 ++--- .../src/legacy/state/user/hooks.tsx | 20 +++++++++--------- .../containers/LimitOrdersWidget/index.tsx | 5 ----- .../modules/mainMenu/constants/mainMenu.tsx | 2 +- .../swap/containers/SwapWidget/index.tsx | 6 ------ libs/ui/src/index.ts | 1 - libs/ui/src/pure/Layer3Banner/index.tsx | 21 ------------------- 10 files changed, 21 insertions(+), 56 deletions(-) delete mode 100644 libs/ui/src/pure/Layer3Banner/index.tsx diff --git a/apps/cowswap-frontend/index.html b/apps/cowswap-frontend/index.html index a3ccb96e5e..a6995eafd3 100644 --- a/apps/cowswap-frontend/index.html +++ b/apps/cowswap-frontend/index.html @@ -25,17 +25,17 @@ property="og:description" content="CoW Swap finds the lowest prices from all decentralized exchanges and DEX aggregators & saves you more with p2p trading and protection from MEV" /> - - - + + + - - + + diff --git a/apps/cowswap-frontend/src/common/constants/theme.ts b/apps/cowswap-frontend/src/common/constants/theme.ts index 233b06488e..06c2636cc2 100644 --- a/apps/cowswap-frontend/src/common/constants/theme.ts +++ b/apps/cowswap-frontend/src/common/constants/theme.ts @@ -2,7 +2,7 @@ import fortuneCookieRegular from 'assets/images/fortune-cookie.png' import fortuneCookieHalloween from 'assets/images/fortuneCookieHalloween.svg' // Enable to activate halloween theme elements for dark mode -export const HALLOWEEN_MODE = true +export const HALLOWEEN_MODE = false export enum UI { // Colors diff --git a/apps/cowswap-frontend/src/legacy/state/cowToken/middleware.ts b/apps/cowswap-frontend/src/legacy/state/cowToken/middleware.ts index 634c7ddf11..a1212abec9 100644 --- a/apps/cowswap-frontend/src/legacy/state/cowToken/middleware.ts +++ b/apps/cowswap-frontend/src/legacy/state/cowToken/middleware.ts @@ -19,9 +19,8 @@ export const cowTokenMiddleware: Middleware, AppState> = const { chainId, hash } = action.payload const transaction = store.getState().transactions[chainId][hash] - // const { userDarkMode, matchesDarkMode } = store.getState().user - // const isDarkMode = userDarkMode === null ? matchesDarkMode : userDarkMode - const isDarkMode = true // TODO: revert after halloween + const { userDarkMode, matchesDarkMode } = store.getState().user + const isDarkMode = userDarkMode === null ? matchesDarkMode : userDarkMode if (transaction.swapVCow || transaction.swapLockedGNOvCow) { const status = transaction.receipt?.status diff --git a/apps/cowswap-frontend/src/legacy/state/orders/middleware/soundMiddleware.ts b/apps/cowswap-frontend/src/legacy/state/orders/middleware/soundMiddleware.ts index 7832744e8b..86c12e784c 100644 --- a/apps/cowswap-frontend/src/legacy/state/orders/middleware/soundMiddleware.ts +++ b/apps/cowswap-frontend/src/legacy/state/orders/middleware/soundMiddleware.ts @@ -59,9 +59,8 @@ export const soundMiddleware: Middleware, AppState> = (s } } - // const { userDarkMode, matchesDarkMode } = store.getState().user - // const isDarkMode = userDarkMode === null ? matchesDarkMode : userDarkMode - const isDarkMode = true // TODO: revert after halloween + const { userDarkMode, matchesDarkMode } = store.getState().user + const isDarkMode = userDarkMode === null ? matchesDarkMode : userDarkMode let cowSound let showLighningEffect = false diff --git a/apps/cowswap-frontend/src/legacy/state/user/hooks.tsx b/apps/cowswap-frontend/src/legacy/state/user/hooks.tsx index 89da465006..d4a328ff5a 100644 --- a/apps/cowswap-frontend/src/legacy/state/user/hooks.tsx +++ b/apps/cowswap-frontend/src/legacy/state/user/hooks.tsx @@ -6,6 +6,7 @@ import { useWalletInfo } from '@cowprotocol/wallet' import { Currency, Percent, Token } from '@uniswap/sdk-core' import JSBI from 'jsbi' +import { shallowEqual } from 'react-redux' import { addSerializedToken, @@ -37,16 +38,15 @@ export function deserializeToken(serializedToken: SerializedToken): Token { } export function useIsDarkMode(): boolean { - return true - // const { userDarkMode, matchesDarkMode } = useAppSelector( - // ({ user: { matchesDarkMode, userDarkMode } }) => ({ - // userDarkMode, - // matchesDarkMode, - // }), - // shallowEqual - // ) - - // return userDarkMode === null ? matchesDarkMode : userDarkMode + const { userDarkMode, matchesDarkMode } = useAppSelector( + ({ user: { matchesDarkMode, userDarkMode } }) => ({ + userDarkMode, + matchesDarkMode, + }), + shallowEqual + ) + + return userDarkMode === null ? matchesDarkMode : userDarkMode } export function useDarkModeManager(): [boolean, () => void] { diff --git a/apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersWidget/index.tsx b/apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersWidget/index.tsx index 1e76af9b36..a416b9bbb4 100644 --- a/apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersWidget/index.tsx +++ b/apps/cowswap-frontend/src/modules/limitOrders/containers/LimitOrdersWidget/index.tsx @@ -2,7 +2,6 @@ import { useAtom, useAtomValue, useSetAtom } from 'jotai' import React, { useMemo } from 'react' import { OrderKind } from '@cowprotocol/cow-sdk' -import { Layer3Banner } from '@cowprotocol/ui' import { Field } from 'legacy/state/types' @@ -16,7 +15,6 @@ import { BulletListItem, UnlockWidgetScreen } from 'modules/trade/pure/UnlockWid import { TradeFormValidation, useGetTradeFormValidation } from 'modules/tradeFormValidation' import { useSetTradeQuoteParams, useTradeQuote } from 'modules/tradeQuote' -import { FeatureGuard } from 'common/containers/FeatureGuard' import { useRateInfoParams } from 'common/hooks/useRateInfoParams' import { CurrencyInfo } from 'common/pure/CurrencyInputPanel/types' @@ -258,9 +256,6 @@ const LimitOrders = React.memo((props: LimitOrdersProps) => { inputCurrencyInfo={inputCurrencyInfo} outputCurrencyInfo={outputCurrencyInfo} /> - - - {tradeContext && ( - - - - diff --git a/libs/ui/src/index.ts b/libs/ui/src/index.ts index b37656d5f5..f4df9da04b 100644 --- a/libs/ui/src/index.ts +++ b/libs/ui/src/index.ts @@ -9,5 +9,4 @@ export * from './pure/SelectDropdown' export * from './pure/Tooltip' export * from './pure/Popover' export * from './pure/ExternalLink' -export * from './pure/Layer3Banner' export * from './enum' diff --git a/libs/ui/src/pure/Layer3Banner/index.tsx b/libs/ui/src/pure/Layer3Banner/index.tsx deleted file mode 100644 index a0ba00611a..0000000000 --- a/libs/ui/src/pure/Layer3Banner/index.tsx +++ /dev/null @@ -1,21 +0,0 @@ -import { Helmet } from 'react-helmet' -import styled from 'styled-components/macro' - -const Wrapper = styled.div` - ${({ addMargin = false }) => addMargin && 'margin: 15px 0;'} -` - -export interface Layer3BannerProps { - addMargin?: boolean -} - -export function Layer3Banner(props: Layer3BannerProps) { - return ( - - - - -
-
- ) -}