Skip to content

Commit

Permalink
[Web] [Chore] 빌드 에러 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
suwonthugger committed Nov 10, 2024
1 parent 64b49a0 commit 5e418fe
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 18 deletions.
18 changes: 0 additions & 18 deletions apps/web/src/app/layout.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
'use client';

import { Theme } from '@radix-ui/themes';
import '@radix-ui/themes/styles.css';
import type { Metadata } from 'next';
Expand Down Expand Up @@ -35,22 +33,6 @@ export default function RootLayout({
children: React.ReactNode;
modal: React.ReactNode;
}>) {
useEffect(() => {
// 모바일 기기 확인 함수
const isMobile = () => {
return /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent,
);
};

console.log('isMobile 테스트', isMobile(), navigator.userAgent);

if (isMobile() && window.location.hostname === 'rankit.run') {
const newUrl = `https://m.rankit.run${window.location.pathname}`;
window.location.replace(newUrl);
}
}, []);

return (
<html lang="en">
<head>
Expand Down
11 changes: 11 additions & 0 deletions apps/web/src/shared/components/layout/header/header.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ const Header = () => {
const menuRef = useRef(null);

React.useEffect(() => {
const isMobile = () => {
return /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
navigator.userAgent,
);
};

if (isMobile() && window.location.hostname === 'rankit.run') {
const newUrl = `https://m.rankit.run${window.location.pathname}`;
window.location.replace(newUrl);
}

const handleResize = () => {
if (window.innerWidth <= 700) {
console.log('화면 너비가 700px 이하입니다.');
Expand Down

0 comments on commit 5e418fe

Please sign in to comment.