Skip to content
This repository has been archived by the owner on Nov 10, 2023. It is now read-only.

Commit

Permalink
Fix: rm countdown redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
katspaugh committed Nov 9, 2022
1 parent 2a2da70 commit d620b91
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 82 deletions.
45 changes: 0 additions & 45 deletions src/components/PsaBanner/Countdown.tsx

This file was deleted.

10 changes: 0 additions & 10 deletions src/components/PsaBanner/index.module.scss
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,6 @@
.banner a {
color: inherit;
font-weight: bold;
text-decoration: none;
}

.banner a:hover {
text-decoration: underline;
}

.banner a:not([href]) {
text-decoration: underline;
cursor: pointer;
}

.wrapper {
Expand Down
33 changes: 6 additions & 27 deletions src/components/PsaBanner/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,41 +6,20 @@ import { currentChainId } from 'src/logic/config/store/selectors'
import { hasFeature } from 'src/logic/safe/utils/safeVersion'
import useCachedState from 'src/utils/storage/useCachedState'
import styles from './index.module.scss'
import Countdown from './Countdown'
import { useLocation } from 'react-router-dom'

const NEW_URL = 'https://app.safe.global'

const redirectToNewApp = (): void => {
const path = window.location.pathname.replace(/^\/app/, '')
window.location.replace(NEW_URL + path)
}

const WARNING_BANNER = 'WARNING_BANNER'
const NO_REDIRECT_PARAM = 'no-redirect'
const EXPORT_HELP = 'https://help.gnosis-safe.io/en/articles/5299068-address-book-export-and-import'

const WebCoreBanner = (): ReactElement | null => {
const { search } = useLocation()
const [shouldRedirect = true, setShouldRedirect] = useCachedState<boolean>(`${WARNING_BANNER}_shouldRedirect`, true)

useEffect(() => {
// Prevent refresh from overwriting the cached value
const noRedirect = new URLSearchParams(search).get(NO_REDIRECT_PARAM)
if (noRedirect) {
setShouldRedirect(false)
}
// eslint-disable-next-line react-hooks/exhaustive-deps
}, [])

return (
<>
⚠️ Safe&apos;s new official URL is <a href={NEW_URL}>app.safe.global</a>.<br />
Please update your bookmarks.{' '}
{shouldRedirect && (
<Countdown seconds={10} onEnd={redirectToNewApp}>
{(count) => <>Redirecting in {count} seconds...</>}
</Countdown>
)}
We recommend{' '}
<a href={EXPORT_HELP} target="_blank" rel="noreferrer">
exporting your address book
</a>{' '}
as CSV and importing it in the new app.
</>
)
}
Expand Down

0 comments on commit d620b91

Please sign in to comment.