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

Rename onramp callback page #187

Merged
merged 1 commit into from
Feb 3, 2025
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
51 changes: 5 additions & 46 deletions src/pages/banxa-callback.tsx
Original file line number Diff line number Diff line change
@@ -1,50 +1,9 @@
import styled, { ThemeProvider } from 'styled-components'
import { useEffect } from 'react'

import GlobalStyle from '../styles/global-style'
import { darkTheme } from '../styles/themes'
const BanxaCallback = () => {
useEffect(() => window.location.replace('/onramp-callback'), [])

import PageSectionContainer from '../components/PageSectionContainer'
import { useEffect, useState } from 'react'

const CLOSE_BANXA_TAB_DEEP_LINK = 'alephium://close-banxa-tab'

const BanxaCallbackPage = () => {
const [countdown, setCountdown] = useState(5)

useEffect(() => {
if (countdown === 0) {
window.open(CLOSE_BANXA_TAB_DEEP_LINK, '_self')
} else {
const interval = setInterval(() => setCountdown(countdown - 1), 1000)

return () => clearInterval(interval)
}
}, [countdown])

return (
<ThemeProvider theme={darkTheme}>
<GlobalStyle />
<main style={{ height: '100vh' }}>
<PageSectionContainerStyled>
<div className="contents">
<h1>Purchace completed! ✅</h1>
<h2>The funds will be sent to your wallet shortly.</h2>
{countdown > 0 && <CountdownText>Redirecting to your wallet in {countdown}...</CountdownText>}
</div>
</PageSectionContainerStyled>
</main>
</ThemeProvider>
)
return null
}

export default BanxaCallbackPage

const PageSectionContainerStyled = styled(PageSectionContainer)`
display: flex;
align-items: center;
justify-content: center;
`

const CountdownText = styled.h3`
color: ${({ theme }) => theme.textSecondary};
`
export default BanxaCallback
50 changes: 50 additions & 0 deletions src/pages/onramp-callback.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import styled, { ThemeProvider } from 'styled-components'

import GlobalStyle from '../styles/global-style'
import { darkTheme } from '../styles/themes'

import PageSectionContainer from '../components/PageSectionContainer'
import { useEffect, useState } from 'react'

const CLOSE_ONRAMP_TAB_DEEP_LINK = 'alephium://close-onramp-tab'

const OnrampCallbackPage = () => {
const [countdown, setCountdown] = useState(5)

useEffect(() => {
if (countdown === 0) {
window.open(CLOSE_ONRAMP_TAB_DEEP_LINK, '_self')
} else {
const interval = setInterval(() => setCountdown(countdown - 1), 1000)

return () => clearInterval(interval)
}
}, [countdown])

return (
<ThemeProvider theme={darkTheme}>
<GlobalStyle />
<main style={{ height: '100vh' }}>
<PageSectionContainerStyled>
<div className="contents">
<h1>Purchace completed! ✅</h1>
<h2>The funds will be sent to your wallet shortly.</h2>
{countdown > 0 && <CountdownText>Redirecting to your wallet in {countdown}...</CountdownText>}
</div>
</PageSectionContainerStyled>
</main>
</ThemeProvider>
)
}

export default OnrampCallbackPage

const PageSectionContainerStyled = styled(PageSectionContainer)`
display: flex;
align-items: center;
justify-content: center;
`

const CountdownText = styled.h3`
color: ${({ theme }) => theme.textSecondary};
`
3 changes: 3 additions & 0 deletions static/robots.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,6 @@ Disallow: /cmc-application-proof.txt

User-agent: *
Disallow: /banxa-callback

User-agent: *
Disallow: /onramp-callback