Skip to content

Commit

Permalink
setup temp /mock route in app-root (#6290)
Browse files Browse the repository at this point in the history
  • Loading branch information
goplayoutside3 authored Sep 12, 2024
1 parent e753cc7 commit 439aac3
Show file tree
Hide file tree
Showing 6 changed files with 84 additions and 1 deletion.
25 changes: 25 additions & 0 deletions packages/app-root/src/app/mock/faq/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AboutHeader } from '@zooniverse/content'

export default function MockPage() {
const links = [
{
href: '/mock',
label: 'Mock'
},
{
href: '/mock/resources',
label: 'Resources'
},
{
href: '/mock/faq',
label: 'FAQ'
}
]

return (
<>
<AboutHeader links={links} navTitle='Mock' />
<p>This is /mock/faq</p>
</>
)
}
25 changes: 25 additions & 0 deletions packages/app-root/src/app/mock/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AboutHeader } from '@zooniverse/content'

export default function MockPage() {
const links = [
{
href: '/mock',
label: 'Mock'
},
{
href: '/mock/resources',
label: 'Resources'
},
{
href: '/mock/faq',
label: 'FAQ'
}
]

return (
<>
<AboutHeader links={links} navTitle='Mock' />
<p>This is /mock</p>
</>
)
}
25 changes: 25 additions & 0 deletions packages/app-root/src/app/mock/resources/page.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { AboutHeader } from '@zooniverse/content'

export default function MockPage() {
const links = [
{
href: '/mock',
label: 'Mock'
},
{
href: '/mock/resources',
label: 'Resources'
},
{
href: '/mock/faq',
label: 'FAQ'
}
]

return (
<>
<AboutHeader links={links} navTitle='Mock' />
<p>This is /mock/resources</p>
</>
)
}
7 changes: 6 additions & 1 deletion packages/app-root/src/middleware.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@
import { NextResponse } from 'next/server'

export function middleware(req) {
/* This is a temporary mocked env */
if (req.nextUrl.pathname.startsWith('/mock/wrong')) {
return NextResponse.redirect(new URL('/mock', req.url))
}

/*
Redirect legacy PFE /about and /get-involved paths to new FEM paths
*/
Expand Down Expand Up @@ -45,5 +50,5 @@ export function middleware(req) {

/* Only care about /about and /get-involved routes */
export const config = {
matcher: ['/about/:path*', '/get-involved/:paths*']
matcher: ['/mock/:path*', '/about/:path*', '/get-involved/:paths*']
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
'use client'

import { Box } from 'grommet'
import { ZooniverseLogotype } from '@zooniverse/react-components'
import styled from 'styled-components'
Expand Down
1 change: 1 addition & 0 deletions packages/lib-content/src/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
export { default as About } from './screens/About/About.js'
export { default as AboutHeader } from './components/AboutHeader/AboutHeader.js'
export { default as Collaborate } from './screens/Collaborate/Collaborate.js'
export { default as CommunityContainer } from './screens/Home/Community/CommunityContainer.js'
export { default as Default404 } from './screens/404/Default404.js'
Expand Down

0 comments on commit 439aac3

Please sign in to comment.