Skip to content

Commit 92d237d

Browse files
Merge pull request #1564 from curvefi/refactor/phishing-warn
refactor: remove unused modal
2 parents a0de586 + ddd2b84 commit 92d237d

File tree

5 files changed

+8
-112
lines changed

5 files changed

+8
-112
lines changed

packages/curve-ui-kit/src/hooks/useLocalStorage.ts

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import lodash from 'lodash'
2-
import { SetStateAction, useCallback, useMemo } from 'react'
2+
import { useMemo } from 'react'
33
import type { Address } from '@curvefi/prices-api'
44
import type { ColumnFiltersState } from '@tanstack/table-core'
55
import type { VisibilityVariants } from '@ui-kit/shared/ui/DataTable/visibility.types'
66
import { defaultReleaseChannel, ReleaseChannel } from '@ui-kit/utils'
7-
import { GetAndSet, type MigrationOptions, useStoredState } from './useStoredState'
7+
import { type MigrationOptions, useStoredState } from './useStoredState'
88

99
const { kebabCase } = lodash
1010

1111
// old keys that are not used anymore - clean them up
12-
window.localStorage.removeItem('isNewDomainNotificationSeen')
12+
window.localStorage.removeItem('phishing-warning-dismissed')
1313

1414
function getFromLocalStorage<T>(storageKey: string): T | null {
1515
if (typeof window === 'undefined') {
@@ -78,14 +78,3 @@ export const useFavoriteMarkets = () => {
7878
const initialValue = useMemo(() => [], [])
7979
return useLocalStorage<Address[]>('favoriteMarkets', initialValue)
8080
}
81-
82-
export const usePhishingWarningDismissed = (): GetAndSet<Date | null> => {
83-
const [dateStr, setDateStr] = useLocalStorage<string | null>(`phishing-warning-dismissed`, null)
84-
const date = useMemo(() => (dateStr == null ? null : new Date(dateStr)), [dateStr])
85-
const setDate = useCallback(
86-
(setter: SetStateAction<Date | null>) =>
87-
setDateStr((typeof setter === 'function' ? setter(date) : setter)?.toISOString() ?? null),
88-
[setDateStr, date],
89-
)
90-
return [date, setDate] as const
91-
}

packages/curve-ui-kit/src/widgets/Header/PhishingWarningModal.tsx

Lines changed: 0 additions & 80 deletions
This file was deleted.

tests/cypress/e2e/all/header.cy.ts

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,7 @@ describe('Header', () => {
3030
cy.viewport(...viewport)
3131
route = oneAppRoute()
3232
cy.visit(`/${route}`, {
33-
onBeforeLoad: (win) => {
34-
win.localStorage.setItem('phishing-warning-dismissed', `"${new Date().toISOString()}"`)
35-
isDarkMode = checkIsDarkMode(win)
36-
},
33+
onBeforeLoad: (win) => (isDarkMode = checkIsDarkMode(win)),
3734
})
3835
waitIsLoaded(route)
3936
})
@@ -98,9 +95,7 @@ describe('Header', () => {
9895
viewport = oneMobileOrTabletViewport()
9996
cy.viewport(...viewport)
10097
route = oneAppRoute()
101-
cy.visit(`/${route}`, {
102-
onBeforeLoad: (win) => win.localStorage.setItem('phishing-warning-dismissed', `"${new Date().toISOString()}"`),
103-
})
98+
cy.visit(`/${route}`)
10499
waitIsLoaded(route)
105100
})
106101

tests/cypress/e2e/all/legal.cy.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,7 @@ describe('Legal', () => {
1313
const viewport = oneOf(oneDesktopViewport, oneTabletViewport)()
1414
it(`it should contain footer legal link for ${viewport.join('x')}`, () => {
1515
cy.viewport(...viewport)
16-
cy.visit(`/${oneAppPath() || 'dex'}/`, {
17-
onBeforeLoad: (win) => win.localStorage.setItem('phishing-warning-dismissed', `"${new Date().toISOString()}"`),
18-
})
16+
cy.visit(`/${oneAppPath() || 'dex'}/`)
1917

2018
//Navigate to legal route from footer link
2119
cy.get(`[data-testid='footer']`, LOAD_TIMEOUT).should('be.visible')
@@ -29,9 +27,7 @@ describe('Legal', () => {
2927
const [width, height] = oneViewport()
3028
it(`should contain multiple tabs for ${width}x${height}`, () => {
3129
cy.viewport(width, height)
32-
cy.visit(`/${oneAppPath() || 'dex'}/ethereum/legal`, {
33-
onBeforeLoad: (win) => win.localStorage.setItem('phishing-warning-dismissed', `"${new Date().toISOString()}"`),
34-
})
30+
cy.visit(`/${oneAppPath() || 'dex'}/ethereum/legal`)
3531

3632
// Make sure there's tabs available and click one.
3733
cy.get(`[data-testid='legal-page']`, LOAD_TIMEOUT).should('be.visible')

tests/cypress/e2e/llamalend/llamalend-markets.cy.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -352,11 +352,7 @@ describe(`LlamaLend Storage Migration`, () => {
352352

353353
function visitAndWait([width, height]: [number, number, Breakpoint], options?: Partial<Cypress.VisitOptions>) {
354354
cy.viewport(width, height)
355-
cy.visit('/llamalend/ethereum/markets/', {
356-
onBeforeLoad: (win) => win.localStorage.setItem('phishing-warning-dismissed', `"${new Date().toISOString()}"`),
357-
...LOAD_TIMEOUT,
358-
...options,
359-
})
355+
cy.visit('/llamalend/ethereum/markets/', { ...LOAD_TIMEOUT, ...options })
360356
cy.get('[data-testid="data-table"]', LOAD_TIMEOUT).should('be.visible')
361357
}
362358

0 commit comments

Comments
 (0)