Skip to content
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

[Feat] 올바르지 않은 경로/환경으로 요청시 오류를 반환하는 컴포넌트 추가 #377

Merged
merged 4 commits into from
Dec 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions apps/web/src/components/NotFound.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { Link } from '@tanstack/react-router';

import TicleCharacterBadge from '@/assets/images/ticle-character-badge.png';
import TicleLogo from '@/assets/ticle.svg?react';
import Button from '@/components/common/Button';

function NotFound() {
return (
<div className="flex h-dvh w-full flex-col items-center justify-center gap-8 px-2">
<img src={TicleCharacterBadge} alt="티클 캐릭터" width={150} height={150} />
<TicleLogo className="fill-primary" width={190} />
<h1 className="text-center text-2xl font-bold">페이지가 존재하지 않습니다</h1>
<Link to="/">
<Button>홈으로 돌아가기</Button>
</Link>
</div>
);
}

export default NotFound;
15 changes: 15 additions & 0 deletions apps/web/src/components/NotSupportedMobile.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import TicleCharacterBadge from '@/assets/images/ticle-character-badge.png';
import TicleLogo from '@/assets/ticle.svg?react';

function NotSupportedMobile() {
return (
<div className="flex h-dvh w-full flex-col items-center justify-center gap-8 px-2">
<img src={TicleCharacterBadge} alt="티클 캐릭터" width={150} height={150} />
<TicleLogo className="fill-primary" width={190} />
<h1 className="text-center text-2xl font-bold">모바일 환경은 지원하지 않습니다</h1>
<p className="text-center">데스크톱 브라우저에서 접속해주세요.</p>
</div>
);
}

export default NotSupportedMobile;
1 change: 0 additions & 1 deletion apps/web/src/hooks/mediasoup/useSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ const useSocket = (): UseSocketReturn => {
});

socket.on(SOCKET_EVENTS.disconnect, () => {
navigate({ to: '/', replace: true });
setIsConnected(false);
setIsError(null);
});
Expand Down
7 changes: 7 additions & 0 deletions apps/web/src/routes/__root.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
import { Outlet, ScrollRestoration, createRootRoute } from '@tanstack/react-router';

import NotFound from '@/components/NotFound';
import NotSupportedMobile from '@/components/NotSupportedMobile';
import { ToastContainer } from '@/components/toast/ToastContainer';

export const Route = createRootRoute({
component: RootComponent,
notFoundComponent: NotFound,
});

function RootComponent() {
if (/iPhone|iPad|iPod|Android/i.test(navigator.userAgent)) {
return <NotSupportedMobile />;
}

return (
<div className="h-full min-h-dvh bg-weak">
<ScrollRestoration />
Expand Down
Loading