-
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
153 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { Center, Container, rem, Stack, Tabs, Text, Title } from '@mantine/core' | ||
import { type GetStaticProps } from 'next' | ||
import { useTranslation } from 'next-i18next' | ||
import { useState } from 'react' | ||
|
||
import { SearchBox } from '@weareinreach/ui/components/core/SearchBox' | ||
import { getServerSideTranslations } from '~app/utils/i18n' | ||
|
||
const NotFound = () => { | ||
const [isLoading, setLoading] = useState(false) | ||
const { t } = useTranslation('common') | ||
|
||
return ( | ||
<Container> | ||
<Stack | ||
m={{ base: `${rem(48)} ${rem(0)}`, xs: `${rem(80)} ${rem(0)}`, sm: `${rem(100)} ${rem(0)}` }} | ||
align='center' | ||
spacing={32} | ||
> | ||
<Stack spacing={0} align='center'> | ||
{/* eslint-disable-next-line i18next/no-literal-string */} | ||
<Title order={1}>🏝️</Title> | ||
<Title order={1}>{t('errors.404-title')}</Title> | ||
</Stack> | ||
<Text ta='center'>{t('errors.404-body')}</Text> | ||
<Tabs defaultValue='location' w='100%' maw={636}> | ||
<Tabs.List grow position='apart'> | ||
<Tabs.Tab value='location'>{t('common:words.location')}</Tabs.Tab> | ||
<Tabs.Tab value='name'>{t('common:words.organization')}</Tabs.Tab> | ||
</Tabs.List> | ||
<Tabs.Panel value='location' m={0}> | ||
<Center> | ||
<SearchBox | ||
type='location' | ||
loadingManager={{ isLoading, setLoading }} | ||
placeholderTextKey='search.location-placeholder-searchby' | ||
/> | ||
</Center> | ||
</Tabs.Panel> | ||
<Tabs.Panel value='name' m={0}> | ||
<SearchBox | ||
type='organization' | ||
loadingManager={{ isLoading, setLoading }} | ||
placeholderTextKey='search.organization-placeholder-searchby' | ||
/> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Stack> | ||
</Container> | ||
) | ||
} | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale }) => { | ||
return { | ||
props: { | ||
...(await getServerSideTranslations(locale, ['common'])), | ||
}, | ||
revalidate: 60 * 60 * 24 * 7, | ||
} | ||
} | ||
|
||
export default NotFound |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { Center, Container, rem, Stack, Tabs, Text, Title } from '@mantine/core' | ||
import * as Sentry from '@sentry/nextjs' | ||
import { type GetStaticProps, type NextPage, type NextPageContext } from 'next' | ||
import { useTranslation } from 'next-i18next' | ||
import { useState } from 'react' | ||
|
||
import { SearchBox } from '@weareinreach/ui/components/core/SearchBox' | ||
// import { getServerSideTranslations } from '~app/utils/i18n' | ||
|
||
const ServerError: NextPage = () => { | ||
const [isLoading, setLoading] = useState(false) | ||
const { t } = useTranslation('common') | ||
|
||
return ( | ||
<Container> | ||
<Stack | ||
m={{ base: `${rem(48)} ${rem(0)}`, xs: `${rem(80)} ${rem(0)}`, sm: `${rem(100)} ${rem(0)}` }} | ||
align='center' | ||
spacing={32} | ||
> | ||
<Stack spacing={0} align='center'> | ||
{/* eslint-disable-next-line i18next/no-literal-string */} | ||
<Title order={1}>🔦</Title> | ||
<Title order={1}>{t('errors.500-title')}</Title> | ||
</Stack> | ||
<Text ta='center'>{t('errors.500-body')}</Text> | ||
<Tabs defaultValue='location' w='100%' maw={636}> | ||
<Tabs.List grow position='apart'> | ||
<Tabs.Tab value='location'>{t('common:words.location')}</Tabs.Tab> | ||
<Tabs.Tab value='name'>{t('common:words.organization')}</Tabs.Tab> | ||
</Tabs.List> | ||
<Tabs.Panel value='location' m={0}> | ||
<Center> | ||
<SearchBox | ||
type='location' | ||
loadingManager={{ isLoading, setLoading }} | ||
placeholderTextKey='search.location-placeholder-searchby' | ||
/> | ||
</Center> | ||
</Tabs.Panel> | ||
<Tabs.Panel value='name' m={0}> | ||
<SearchBox | ||
type='organization' | ||
loadingManager={{ isLoading, setLoading }} | ||
placeholderTextKey='search.organization-placeholder-searchby' | ||
/> | ||
</Tabs.Panel> | ||
</Tabs> | ||
</Stack> | ||
</Container> | ||
) | ||
} | ||
|
||
export const getStaticProps: GetStaticProps = async ({ locale }) => { | ||
const getServerSideTranslations = await import('../utils/i18n').then((mod) => mod.getServerSideTranslations) | ||
return { | ||
props: { | ||
...(await getServerSideTranslations(locale, ['common'])), | ||
}, | ||
} | ||
} | ||
export const getInitialProps = async (ctx: NextPageContext) => { | ||
await Sentry.captureUnderscoreErrorException(ctx) | ||
} | ||
|
||
export default ServerError |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
import * as Sentry from '@sentry/nextjs' | ||
import { type NextPageContext } from 'next' | ||
import NextErrorComponent from 'next/error' | ||
import { type ComponentProps } from 'react' | ||
|
||
const CustomErrorComponent = (props: ComponentProps<typeof NextErrorComponent>) => ( | ||
<NextErrorComponent statusCode={props.statusCode} /> | ||
) | ||
|
||
CustomErrorComponent.getInitialProps = async (contextData: NextPageContext) => { | ||
// In case this is running in a serverless function, await this in order to give Sentry | ||
// time to send the error before the lambda exits | ||
await Sentry.captureUnderscoreErrorException(contextData) | ||
|
||
// This will contain the status code of the response | ||
return NextErrorComponent.getInitialProps(contextData) | ||
} | ||
|
||
export default CustomErrorComponent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters