-
Notifications
You must be signed in to change notification settings - Fork 0
[feat] 404 50x 에러페이지 구현 #155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
The head ref may contain hidden characters: "154-feat-404-50x-\uC5D0\uB7EC\uD398\uC774\uC9C0-\uAD6C\uD604"
Merged
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
f86c35d
feat: 404 페이지 구현
ff1451 2afa81d
feat: 50x 페이지 구현
ff1451 4675b5a
refactor: 경로 상수화
ff1451 7ddcb27
refactor: 에러페이지 컴포넌트 분리
ff1451 9ee1e84
refactor: 경로 상수화 및 에러 처리 변경
ff1451 acd314a
refactor: 에러 구조 통일
ff1451 df3054e
refactor: 에러처리 훅 분리
ff1451 a6ff349
refactor: 한글화
ff1451 7630943
refactor: 에러 처리추가
ff1451 6ab06f6
refactor: 에러처리 추가
ff1451 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or 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 hidden or 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,37 @@ | ||
| import type { ReactNode } from 'react'; | ||
|
|
||
| interface ErrorPageLayoutProps { | ||
| imageSrc: string; | ||
| imageAlt: string; | ||
| title: string; | ||
| message: ReactNode; | ||
| primaryLabel: string; | ||
| onPrimaryClick: () => void; | ||
| } | ||
|
|
||
| function ErrorPageLayout({ imageSrc, imageAlt, title, message, primaryLabel, onPrimaryClick }: ErrorPageLayoutProps) { | ||
| return ( | ||
| <section className="bg-indigo-5 flex min-h-(--viewport-height) w-full flex-col items-center px-8 pt-[22vh]"> | ||
| <div className="flex w-full max-w-[323px] flex-col items-center gap-3"> | ||
| <img src={imageSrc} alt={imageAlt} className="h-auto w-[243px]" /> | ||
|
|
||
| <div className="flex w-full flex-col items-center gap-[26px] text-center"> | ||
| <div className="flex flex-col items-center gap-3"> | ||
| <h1 className="text-[24px] leading-[22px] font-bold tracking-[-0.408px] text-black">{title}</h1> | ||
| <p className="text-[16px] leading-[22px] tracking-[-0.408px] text-indigo-200">{message}</p> | ||
| </div> | ||
|
|
||
| <button | ||
| type="button" | ||
| onClick={onPrimaryClick} | ||
| className="text-indigo-5 w-full rounded-[10px] bg-[#69BFDF] py-[15px] text-[16px] leading-[22px] font-bold tracking-[-0.408px]" | ||
| > | ||
| {primaryLabel} | ||
| </button> | ||
| </div> | ||
| </div> | ||
| </section> | ||
| ); | ||
| } | ||
|
|
||
| export default ErrorPageLayout; |
This file contains hidden or 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 hidden or 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,26 @@ | ||
| import NotFoundCatImage from '@/assets/image/not-found-cat.webp'; | ||
| import ErrorPageLayout from '@/components/common/ErrorPageLayout'; | ||
| import { useErrorPageHomeNavigation } from '@/utils/hooks/useErrorPageHomeNavigation'; | ||
|
|
||
| function NotFoundPage() { | ||
| const handleGoHome = useErrorPageHomeNavigation(); | ||
|
|
||
| return ( | ||
| <ErrorPageLayout | ||
| imageSrc={NotFoundCatImage} | ||
| imageAlt="오류 캐릭터" | ||
| title="오류가 발생했어요" | ||
| message={ | ||
| <> | ||
| 주소가 잘못 입력되었거나 | ||
| <br /> | ||
| 삭제되어 페이지를 찾을 수 없어요 | ||
| </> | ||
| } | ||
| primaryLabel="홈으로 가기" | ||
| onPrimaryClick={handleGoHome} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default NotFoundPage; |
This file contains hidden or 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,26 @@ | ||
| import NotFoundCatImage from '@/assets/image/not-found-cat.webp'; | ||
| import ErrorPageLayout from '@/components/common/ErrorPageLayout'; | ||
| import { useErrorPageHomeNavigation } from '@/utils/hooks/useErrorPageHomeNavigation'; | ||
|
|
||
| function ServerErrorPage() { | ||
| const handleGoHome = useErrorPageHomeNavigation(); | ||
|
|
||
| return ( | ||
| <ErrorPageLayout | ||
| imageSrc={NotFoundCatImage} | ||
| imageAlt="서버 오류 캐릭터" | ||
| title="오류가 발생했어요" | ||
| message={ | ||
| <> | ||
| 서버에 일시적인 문제가 생겼어요 | ||
| <br /> | ||
| 잠시 후 다시 시도해 주세요 | ||
| </> | ||
| } | ||
| primaryLabel="홈으로 가기" | ||
| onPrimaryClick={handleGoHome} | ||
| /> | ||
| ); | ||
| } | ||
|
|
||
| export default ServerErrorPage; |
This file contains hidden or 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,11 @@ | ||
| import { useNavigate } from 'react-router-dom'; | ||
| import { useAuthStore } from '@/stores/authStore'; | ||
|
|
||
| export function useErrorPageHomeNavigation() { | ||
| const navigate = useNavigate(); | ||
| const isAuthenticated = useAuthStore((state) => state.isAuthenticated); | ||
|
|
||
| return () => { | ||
| navigate(isAuthenticated ? '/home' : '/', { replace: true }); | ||
| }; | ||
| } |
This file contains hidden or 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,12 @@ | ||
| export const SERVER_ERROR_PATH = '/server-error'; | ||
|
|
||
| export function isServerErrorStatus(status: number): boolean { | ||
| return status >= 500 && status < 600; | ||
| } | ||
|
|
||
| export function redirectToServerErrorPage(): void { | ||
| if (typeof window === 'undefined') return; | ||
| if (window.location.pathname === SERVER_ERROR_PATH) return; | ||
|
|
||
| window.location.replace(SERVER_ERROR_PATH); | ||
| } |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.