Skip to content

Commit

Permalink
Ledgers page index.html redirect (#1022)
Browse files Browse the repository at this point in the history
## High Level Overview of Change
Obseleted path (/index.html) now redirects to current path to ledgers
page (/).

<!--
Please include a summary/list of the changes.
If too broad, please consider splitting into multiple PRs.
-->

### Context of Change

<!--
Please include the context of a change.
If a bug fix, when was the bug introduced? What was the behavior?
If a new feature, why was this architecture chosen? What were the
alternatives?
If a refactor, how is this better than the previous implementation?

If there is a design document for this feature, please link it here.
-->

### Type of Change

<!--
Please check relevant options, delete irrelevant ones.
-->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to not work as expected)
- [ ] Refactor (non-breaking change that only restructures code)
- [ ] Tests (You added tests for code that already exists, or your new
feature included in this PR)
- [ ] Documentation Updates
- [ ] Translation Updates
- [ ] Release

### TypeScript/Hooks Update

<!--
In an effort to modernize the codebase, you should convert the files
that you work with to React Hooks and TypeScript.
If this is not possible (e.g. it's too many changes, touching too many
files, etc.) please explain why here.
-->

- [ ] Updated files to React Hooks
- [ ] Updated files to TypeScript

## Before / After

<!--
If just refactoring / back-end changes, this can be just an in-English
description of the change at a technical level.
If a UI change, screenshots should be included.
-->

## Test Plan

<!--
Please describe the tests that you ran to verify your changes and
provide instructions so that others can reproduce.
-->

<!--
## Future Tasks
For future tasks related to PR.
-->
  • Loading branch information
achowdhry-ripple authored Aug 6, 2024
1 parent 7db7962 commit 7570cb1
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/containers/App/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,14 @@ export const AppWrapper = () => {
path={updatePath('/ledgers')}
element={<Navigate to={updatePath('/')} replace />}
/>
<Route
path={updatePath('/index.html')}
element={<Navigate to={updatePath('/')} replace />}
/>
<Route
path={updatePath('/index.htm')}
element={<Navigate to={updatePath('/')} replace />}
/>
{/* End: Redirects */}
{mode === 'custom' && (
<Route path="/" element={<CustomNetworkHome />} />
Expand Down
34 changes: 34 additions & 0 deletions src/containers/App/test/App.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,40 @@ describe('App container', () => {
])
})

it('renders ledger explorer page from index.html redirect', async () => {
wrapper = createWrapper('/index.html')
await flushPromises()
await flushPromises()
wrapper.update()

expect(document.title).toEqual('xrpl_explorer | ledgers')
expect(window.dataLayer).toEqual([
{
page_path: '/',
page_title: `xrpl_explorer | ledgers`,
event: 'screen_view',
network: 'mainnet',
},
])
})

it('renders ledger explorer page from index.htm redirect', async () => {
wrapper = createWrapper('/index.html')
await flushPromises()
await flushPromises()
wrapper.update()

expect(document.title).toEqual('xrpl_explorer | ledgers')
expect(window.dataLayer).toEqual([
{
page_path: '/',
page_title: `xrpl_explorer | ledgers`,
event: 'screen_view',
network: 'mainnet',
},
])
})

it('renders not found page', () => {
wrapper = createWrapper('/zzz')
return new Promise((r) => setTimeout(r, 10)).then(() => {
Expand Down

0 comments on commit 7570cb1

Please sign in to comment.