Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: enable holiday mode #2565

Merged
merged 1 commit into from
Dec 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 5 additions & 6 deletions src/pages/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import * as Sentry from '@sentry/react'
import { Suspense, lazy, useEffect } from 'react'
import { isMobile } from 'react-device-detect'
import { Navigate, Route, Routes, useLocation, useParams } from 'react-router-dom'
import { useNetwork, usePrevious } from 'react-use'
import styled from 'styled-components'
Expand All @@ -15,7 +14,6 @@ import Header from 'components/Header'
import Loader from 'components/LocalLoader'
import ModalsGlobal from 'components/ModalsGlobal'
import ProtectedRoute from 'components/ProtectedRoute'
import Snowfall from 'components/Snowflake/Snowfall'
import SupportButton from 'components/SupportButton'
import { APP_PATHS, CHAINS_SUPPORT_CROSS_CHAIN } from 'constants/index'
import { CLASSIC_NOT_SUPPORTED, ELASTIC_NOT_SUPPORTED, NETWORKS_INFO, SUPPORTED_NETWORKS } from 'constants/networks'
Expand All @@ -26,7 +24,6 @@ import useSessionExpiredGlobal from 'hooks/useSessionExpire'
import { useSyncNetworkParamWithStore } from 'hooks/web3/useSyncNetworkParamWithStore'
import { PROFILE_MANAGE_ROUTES } from 'pages/NotificationCenter/const'
import { RedirectPathToSwapV3Network } from 'pages/SwapV3/redirects'
import { useHolidayMode } from 'state/user/hooks'
import { isSupportLimitOrder } from 'utils'

import VerifyAuth from './Verify/VerifyAuth'
Expand Down Expand Up @@ -209,7 +206,7 @@ export default function App() {
useGlobalMixpanelEvents()
const isPartnerSwap = pathname.includes(APP_PATHS.PARTNER_SWAP)
const showFooter = !pathname.includes(APP_PATHS.ABOUT) && !isPartnerSwap
const [holidayMode] = useHolidayMode()
//const [holidayMode] = useHolidayMode()

const snowflake = new Image()
snowflake.src = snow
Expand All @@ -225,15 +222,17 @@ export default function App() {
<Header />
</HeaderWrapper>
<Suspense fallback={<Loader />}>
{holidayMode && (
{/*
holidayMode && (
<Snowfall
speed={[0.5, 1]}
wind={[-0.5, 0.25]}
snowflakeCount={isMobile ? 13 : 31}
images={[snowflake]}
radius={[5, 15]}
/>
)}
)
*/}

<BodyWrapper>
<Popups />
Expand Down
7 changes: 3 additions & 4 deletions src/state/user/hooks.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import {
updateUserSlippageTolerance,
} from 'state/user/actions'
import { CROSS_CHAIN_SETTING_DEFAULT, CrossChainSetting, VIEW_MODE } from 'state/user/reducer'
import { isAddress } from 'utils'
import { isAddress, isChristmasTime } from 'utils'

const MAX_FAVORITE_LIMIT = 12

Expand Down Expand Up @@ -439,14 +439,13 @@ export const usePaymentToken: () => [Token | null, (paymentToken: Token | null)

export const useHolidayMode: () => [boolean, () => void] = () => {
const dispatch = useAppDispatch()
// const holidayMode = useAppSelector(state => (state.user.holidayMode === undefined ? true : state.user.holidayMode))
const holidayMode = useAppSelector(state => (state.user.holidayMode === undefined ? true : state.user.holidayMode))

const toggle = useCallback(() => {
dispatch(toggleHolidayMode())
}, [dispatch])

// return [isChristmasTime() ? holidayMode : false, toggle]
return [false, toggle]
return [isChristmasTime() ? holidayMode : false, toggle]
}

export const useCrossChainSetting = () => {
Expand Down
3 changes: 1 addition & 2 deletions src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -394,9 +394,8 @@ export const findTx = (txs: GroupedTxsByHash | undefined, hash: string): Transac
}

export const isChristmasTime = () => {
return false
const currentTime = dayjs()
return false && currentTime.month() === 11 && currentTime.date() >= 15
return currentTime.month() === 11 && currentTime.date() >= 12
}

export const isSupportLimitOrder = (chainId: ChainId): boolean => {
Expand Down
Loading