Skip to content

Commit 664c52c

Browse files
committed
add condition for display warning
1 parent c3ee7cb commit 664c52c

File tree

2 files changed

+10
-7
lines changed

2 files changed

+10
-7
lines changed

apps/kyberswap-interface/src/pages/Earns/PoolExplorer/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ export const BaseWarningWrapper = styled.div`
5151
margin: 0 auto;
5252
`
5353

54+
export const isWithinBaseMaintenanceWindow = () => {
55+
const nowMs = Date.now()
56+
const MAINTENANCE_END_UTC_MS = Date.UTC(2025, 10, 20, 1, 0, 0) // 1:00 AM UTC, 20 Nov 2025
57+
const MAINTENANCE_START_UTC_MS = MAINTENANCE_END_UTC_MS - 2 * 60 * 60 * 1000 // 2 hours before
58+
return nowMs >= MAINTENANCE_START_UTC_MS && nowMs <= MAINTENANCE_END_UTC_MS
59+
}
60+
5461
const PoolExplorer = () => {
5562
const [search, setSearch] = useState('')
5663
const deboundedSearch = useDebounce(search, DEBOUNCE_DELAY)
@@ -68,10 +75,6 @@ const PoolExplorer = () => {
6875
const { data: poolData, isError } = usePoolsExplorerQuery(filters, { pollingInterval: POLLING_INTERVAL })
6976

7077
const upToLarge = useMedia(`(max-width: ${MEDIA_WIDTHS.upToLarge}px)`)
71-
// const nowMs = Date.now()
72-
// const MAINTENANCE_END_UTC_MS = Date.UTC(2025, 10, 20, 1, 0, 0) // 1:00 AM UTC, 20 Nov 2025
73-
// const MAINTENANCE_START_UTC_MS = MAINTENANCE_END_UTC_MS - 2 * 60 * 60 * 1000 // 2 hours before
74-
// const isWithinMaintenanceWindow = nowMs >= MAINTENANCE_START_UTC_MS && nowMs <= MAINTENANCE_END_UTC_MS
7578

7679
const onSortChange = (sortBy: string) => {
7780
if (!filters.sortBy || filters.sortBy !== sortBy) {
@@ -194,7 +197,7 @@ const PoolExplorer = () => {
194197
</div>
195198

196199
<Filter filters={filters} updateFilters={updateFilters} search={search} setSearch={setSearch} />
197-
{filters.chainId === ChainId.BASE && (
200+
{filters.chainId === ChainId.BASE && isWithinBaseMaintenanceWindow() && (
198201
<BaseWarningWrapper>
199202
<Text color={theme.subText} fontSize={12} fontWeight={500} fontStyle={'italic'}>
200203
Kyber Earn data on Base is being updated. This may take a moment and will be available again at 1:00 AM UTC

apps/kyberswap-interface/src/pages/Earns/UserPositions/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ import Pagination from 'components/Pagination'
1414
import { APP_PATHS } from 'constants/index'
1515
import { useActiveWeb3React } from 'hooks'
1616
import useTheme from 'hooks/useTheme'
17-
import { BaseWarningWrapper } from 'pages/Earns/PoolExplorer'
17+
import { BaseWarningWrapper, isWithinBaseMaintenanceWindow } from 'pages/Earns/PoolExplorer'
1818
import { ContentWrapper, Disclaimer, NavigateButton } from 'pages/Earns/PoolExplorer/styles'
1919
import { IconArrowLeft } from 'pages/Earns/PositionDetail/styles'
2020
import Filter from 'pages/Earns/UserPositions/Filter'
@@ -382,7 +382,7 @@ const UserPositions = () => {
382382
}}
383383
/>
384384

385-
{filters.chainIds?.split(',').includes(ChainId.BASE.toString()) && (
385+
{filters.chainIds?.split(',').includes(ChainId.BASE.toString()) && isWithinBaseMaintenanceWindow() && (
386386
<BaseWarningWrapper>
387387
<Text color={theme.subText} fontSize={12} fontWeight={500} fontStyle={'italic'}>
388388
Kyber Earn data on Base is being updated. This may take a moment and will be available again at 1:00 AM

0 commit comments

Comments
 (0)