generated from t3-oss/create-t3-turbo
-
-
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.
Optimize package imports and add error pages (#103)
* control * treeshaking * optimize packages * treeshaking * Update apps/nextjs/src/app/forbidden.tsx Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com> Signed-off-by: Gabe Mendoza <[email protected]> * unauth page * lint --------- Signed-off-by: Gabe Mendoza <[email protected]> Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
- Loading branch information
1 parent
5cd3c6b
commit fffc91a
Showing
4 changed files
with
110 additions
and
2 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,19 @@ | ||
import Link from "next/link"; | ||
|
||
export default function Forbidden() { | ||
return ( | ||
<main | ||
role="main" | ||
className="flex min-h-screen flex-col items-center justify-center text-center" | ||
> | ||
<div className="container mx-auto px-4"> | ||
<h2>Forbidden</h2> | ||
<p>You are not authorized to access this resource.</p> | ||
<p className="mt-4 text-sm text-gray-600"> | ||
If you believe this is an error, please contact support. | ||
</p> | ||
<Link href="/">Return Home</Link> | ||
</div> | ||
</main> | ||
); | ||
} |
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,49 @@ | ||
import Link from "next/link"; | ||
|
||
export default function Unauthorized() { | ||
const returnUrl = | ||
typeof window !== "undefined" ? window.location.pathname : ""; | ||
const signInUrl = `/sign-in${returnUrl ? `?returnUrl=${encodeURIComponent(returnUrl)}` : ""}`; | ||
|
||
return ( | ||
<ErrorPageLayout | ||
title="Unauthorized" | ||
message="Please log in to access this page." | ||
actionLink={{ | ||
href: signInUrl, | ||
text: "Go to Login", | ||
}} | ||
/> | ||
); | ||
} | ||
|
||
interface ErrorPageLayoutProps { | ||
title: string; | ||
message: string; | ||
actionLink: { | ||
href: string; | ||
text: string; | ||
}; | ||
children?: React.ReactNode; | ||
} | ||
|
||
function ErrorPageLayout({ | ||
title, | ||
message, | ||
actionLink, | ||
children, | ||
}: ErrorPageLayoutProps) { | ||
return ( | ||
<main | ||
role="main" | ||
className="flex min-h-screen flex-col items-center justify-center text-center" | ||
> | ||
<div className="container mx-auto px-4"> | ||
<h2>{title}</h2> | ||
<p>{message}</p> | ||
{children} | ||
<Link href={actionLink.href}>{actionLink.text}</Link> | ||
</div> | ||
</main> | ||
); | ||
} |
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 |
---|---|---|
|
@@ -36,6 +36,7 @@ dictionaries: | |
- markdown | ||
- lorem-ipsum | ||
words: | ||
- actioncable | ||
- adbanner | ||
- adsbygoogle | ||
- adsense | ||
|
fffc91a
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
nextjs – ./
battlestadium.gg
www.battlestadium.gg
nextjs-git-main-battlestadium.vercel.app
nextjs-battlestadium.vercel.app