-
Notifications
You must be signed in to change notification settings - Fork 0
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
1 parent
5e9229f
commit 3850c3f
Showing
65 changed files
with
1,487 additions
and
686 deletions.
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
examples/bifrost-starter/apps/frontend/app/[locale]/error.tsx
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,28 @@ | ||
'use client'; | ||
|
||
import { useEffect } from 'react'; | ||
|
||
import { CrashFallback } from 'components/CrashFallback/CrashFallback'; | ||
|
||
/** | ||
* use this error to handle server side errors, | ||
* you can put it directly in a page directory and it will be wrapped by the | ||
* layout at the same level and above it, | ||
* more info here: https://nextjs.org/docs/app/building-your-application/routing/error-handling | ||
*/ | ||
const ErrorPage = ({ | ||
error, | ||
reset, | ||
}: { | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}) => { | ||
useEffect(() => { | ||
// You can use your own error logging service here like sentry | ||
console.error({ error, errorInfo: error.digest }); | ||
}, [error]); | ||
|
||
return <CrashFallback reset={reset} />; | ||
}; | ||
|
||
export default ErrorPage; |
39 changes: 39 additions & 0 deletions
39
examples/bifrost-starter/apps/frontend/app/[locale]/layout.tsx
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,39 @@ | ||
import { Inter } from 'next/font/google'; | ||
import { notFound } from 'next/navigation'; | ||
import Script from 'next/script'; | ||
import { FC, PropsWithChildren } from 'react'; | ||
|
||
import { isValidLocale } from 'locales/locales'; | ||
import { SWRProvider } from 'providers/swr-provider'; | ||
|
||
// https://nextjs.org/docs/app/building-your-application/optimizing/fonts | ||
const inter = Inter({ | ||
subsets: ['latin'], | ||
display: 'swap', | ||
}); | ||
|
||
const RootLayout: FC< | ||
PropsWithChildren<{ | ||
params: { locale: string }; | ||
}> | ||
> = ({ children, params: { locale } }) => { | ||
if (!isValidLocale(locale)) { | ||
console.error(`Invalid locale: ${locale}`); | ||
notFound(); | ||
} | ||
|
||
return ( | ||
// Accessibility and SEO: change the lang attribute if other languages are present | ||
<html lang={locale} className={inter.className}> | ||
<head> | ||
<link rel="icon" href="/favicon.ico" sizes="any" /> | ||
</head> | ||
<body> | ||
<Script strategy="beforeInteractive" id="env-var" src="/__ENV.js" /> | ||
<SWRProvider>{children}</SWRProvider> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
export default RootLayout; |
3 changes: 3 additions & 0 deletions
3
examples/bifrost-starter/apps/frontend/app/[locale]/login/layout.tsx
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,3 @@ | ||
import { IntlLayoutWrapper } from 'locales/IntlLayoutWrapper'; | ||
|
||
export default IntlLayoutWrapper; |
13 changes: 13 additions & 0 deletions
13
examples/bifrost-starter/apps/frontend/app/[locale]/login/page.tsx
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,13 @@ | ||
import type { Metadata } from 'next'; | ||
import { FC } from 'react'; | ||
|
||
import { Login } from 'components/pages/Login/Login'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Login | Bifrost', | ||
description: 'Login page', | ||
}; | ||
|
||
const LoginPage: FC = () => <Login />; | ||
|
||
export default LoginPage; |
13 changes: 13 additions & 0 deletions
13
examples/bifrost-starter/apps/frontend/app/[locale]/page.tsx
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,13 @@ | ||
import { NextPage } from 'next'; | ||
import type { Metadata } from 'next'; | ||
|
||
import { Home } from 'components/pages/Home/Home'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Bifrost', | ||
description: 'Generated with bifrost', | ||
}; | ||
|
||
const HomePage: NextPage = () => <Home />; | ||
|
||
export default HomePage; |
3 changes: 3 additions & 0 deletions
3
examples/bifrost-starter/apps/frontend/app/[locale]/profile/layout.tsx
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,3 @@ | ||
import { IntlLayoutWrapper } from 'locales/IntlLayoutWrapper'; | ||
|
||
export default IntlLayoutWrapper; |
13 changes: 13 additions & 0 deletions
13
examples/bifrost-starter/apps/frontend/app/[locale]/profile/page.tsx
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,13 @@ | ||
import type { Metadata } from 'next'; | ||
import { FC } from 'react'; | ||
|
||
import { Profile } from 'components/pages/Profile/Profile'; | ||
|
||
export const metadata: Metadata = { | ||
title: 'Profile | Bifrost', | ||
description: 'You profile on Bifrost', | ||
}; | ||
|
||
const ProfilePage: FC = () => <Profile />; | ||
|
||
export default ProfilePage; |
32 changes: 32 additions & 0 deletions
32
examples/bifrost-starter/apps/frontend/app/global-error.tsx
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,32 @@ | ||
'use client'; | ||
|
||
import { FC, useEffect } from 'react'; | ||
|
||
import { CrashFallback } from 'components/CrashFallback/CrashFallback'; | ||
|
||
/** | ||
* Global catch all error page for root layout errors | ||
* more info here: https://nextjs.org/docs/app/building-your-application/routing/error-handling#handling-errors-in-root-layouts | ||
*/ | ||
const GlobalError: FC<{ | ||
error: Error & { digest?: string }; | ||
reset: () => void; | ||
}> = ({ error, reset }) => { | ||
useEffect(() => { | ||
// You can use your own error logging service here like sentry | ||
console.error({ error, errorInfo: error.digest }); | ||
}, [error]); | ||
|
||
return ( | ||
<html lang="en"> | ||
<body> | ||
<main> | ||
<h1> Something went wrong!</h1> | ||
<CrashFallback reset={reset} /> | ||
</main> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
export default GlobalError; |
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,8 @@ | ||
import { FC, PropsWithChildren } from 'react'; | ||
import 'styles/global.css'; | ||
import 'styles/stylesheet.css'; | ||
// Since we have a `not-found.tsx` page on the root, a layout file | ||
// is required, even if it's just passing children through. | ||
const RootLayout: FC<PropsWithChildren> = ({ children }) => children; | ||
|
||
export default RootLayout; |
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,18 @@ | ||
'use client'; | ||
|
||
import Error from 'next/error'; | ||
import { FC } from 'react'; | ||
|
||
// Render the default Next.js 404 page | ||
|
||
const NotFound: FC = () => { | ||
return ( | ||
<html lang="en"> | ||
<body> | ||
<Error statusCode={404} /> | ||
</body> | ||
</html> | ||
); | ||
}; | ||
|
||
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,2 @@ | ||
User-Agent: * | ||
Allow: * |
17 changes: 0 additions & 17 deletions
17
examples/bifrost-starter/apps/frontend/components/AppCrashFallback/AppCrashFallback.tsx
This file was deleted.
Oops, something went wrong.
1 change: 0 additions & 1 deletion
1
examples/bifrost-starter/apps/frontend/components/AppCrashFallback/index.ts
This file was deleted.
Oops, something went wrong.
11 changes: 6 additions & 5 deletions
11
...CrashFallback/AppCrashFallback.module.css → ...ts/CrashFallback/CrashFallback.module.css
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
29 changes: 29 additions & 0 deletions
29
examples/bifrost-starter/apps/frontend/components/CrashFallback/CrashFallback.tsx
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,29 @@ | ||
import { FC } from 'react'; | ||
|
||
import style from './CrashFallback.module.css'; | ||
|
||
export const CrashFallback: FC<{ reset?: () => void }> = ({ reset }) => ( | ||
<div className={style.fallbackContent}> | ||
<h2>Sorry, this is not working properly.</h2> | ||
<br /> | ||
<p>We know about this issue and are working to fix it.</p> | ||
<br /> | ||
<p>In the meantime, here is what you can do:</p> | ||
<ul className={style.helperList}> | ||
{reset && ( | ||
<li> | ||
<button | ||
onClick={ | ||
// Attempt to recover by trying to re-render the segment | ||
reset | ||
} | ||
> | ||
Try again | ||
</button> | ||
</li> | ||
)} | ||
<li>Refresh the page (sometimes it helps).</li> | ||
<li>Try again in 30 minutes.</li> | ||
</ul> | ||
</div> | ||
); |
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
1 change: 0 additions & 1 deletion
1
examples/bifrost-starter/apps/frontend/components/ErrorBoundary/index.ts
This file was deleted.
Oops, something went wrong.
6 changes: 3 additions & 3 deletions
6
examples/bifrost-starter/apps/frontend/components/atoms/VisuallyHidden/VisuallyHidden.tsx
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 |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import { FC } from 'react'; | ||
|
||
import style from './VisuallyHidden.module.css'; | ||
|
||
type VisuallyHiddenProps = { | ||
children: React.ReactNode; | ||
}; | ||
|
||
export const VisuallyHidden = ({ | ||
children, | ||
}: VisuallyHiddenProps): JSX.Element => ( | ||
export const VisuallyHidden: FC<VisuallyHiddenProps> = ({ children }) => ( | ||
<span className={style.visuallyHidden}>{children}</span> | ||
); |
1 change: 0 additions & 1 deletion
1
examples/bifrost-starter/apps/frontend/components/atoms/VisuallyHidden/index.ts
This file was deleted.
Oops, something went wrong.
3 changes: 1 addition & 2 deletions
3
examples/bifrost-starter/apps/frontend/components/atoms/forms/Input/Input.test.tsx
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
1 change: 0 additions & 1 deletion
1
examples/bifrost-starter/apps/frontend/components/atoms/forms/Input/index.ts
This file was deleted.
Oops, something went wrong.
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
1 change: 0 additions & 1 deletion
1
examples/bifrost-starter/apps/frontend/components/atoms/forms/PasswordInput/index.ts
This file was deleted.
Oops, something went wrong.
2 changes: 0 additions & 2 deletions
2
examples/bifrost-starter/apps/frontend/components/atoms/forms/index.ts
This file was deleted.
Oops, something went wrong.
8 changes: 4 additions & 4 deletions
8
examples/bifrost-starter/apps/frontend/components/atoms/icons/EyeClosed.tsx
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
4 changes: 3 additions & 1 deletion
4
examples/bifrost-starter/apps/frontend/components/atoms/icons/EyeOpen.tsx
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
2 changes: 0 additions & 2 deletions
2
examples/bifrost-starter/apps/frontend/components/atoms/icons/index.ts
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
examples/bifrost-starter/apps/frontend/components/atoms/index.ts
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.