-
로그인 정보
-
-
-
이름
-
{user?.name || '-'}
+ {/* 관리자 정보 카드 */}
+
+
+
+ 관리자 정보
+
+
+
+
+
+
+
+
+
+
닉네임
+
{user?.name || '-'}
+
+
+
-
-
-
+
- {/* 관리 기능 카드 */}
-
- {/* 서버 상태 */}
-
-
-
-
서버 상태
-
-
- 마인크래프트 서버 상태 모니터링 및 관리
-
-
- 정상 작동 중
-
-
+ {/* 서버 관리 섹션 */}
+
+
+
+ 서버 관리
+
+
+
+ {/* 서버 명령어 */}
+
+
+
+ 마인크래프트 서버에 명령어를 전송합니다.
+
+
+ 추후 업데이트 예정
+
+
- {/* 플레이어 관리 */}
-
-
-
-
플레이어 관리
+ {/* 공지 전송 */}
+
+
+
+ 게임 내 모든 플레이어에게 공지를 전송합니다.
+
+
+ 추후 업데이트 예정
+
+
-
+
+
+ {/* 플레이어 관리 섹션 */}
+
+
+
+ 플레이어 관리
+
+
+
접속 중인 플레이어 목록 및 관리 기능
추후 업데이트 예정
-
+
- {/* 설정 */}
-
-
-
-
설정
-
-
+ {/* 설정 섹션 */}
+
+
+
+ 설정
+
+
+
대시보드 설정 및 구성 관리
추후 업데이트 예정
-
-
+
+
);
}
+
diff --git a/frontend/src/pages/ProfilePage.jsx b/frontend/src/pages/ProfilePage.jsx
index 1a856e0..1591a72 100644
--- a/frontend/src/pages/ProfilePage.jsx
+++ b/frontend/src/pages/ProfilePage.jsx
@@ -10,7 +10,7 @@ import { ArrowLeft, Copy, Check, Gamepad2, Link as LinkIcon, Unlink, RefreshCw,
import { motion, AnimatePresence } from 'framer-motion';
import { io } from 'socket.io-client';
-export default function ProfilePage() {
+export default function ProfilePage({ isMobile = false }) {
const navigate = useNavigate();
const location = useLocation();
const { user, isLoggedIn, loading, checkAuth, logout } = useAuth();
@@ -32,6 +32,20 @@ export default function ProfilePage() {
}, [loading, isLoggedIn, navigate, location.pathname]);
// 연동 상태 확인
+ const fetchLinkStatus = async () => {
+ try {
+ const token = localStorage.getItem('token');
+ const res = await fetch('/link/status', {
+ headers: { 'Authorization': `Bearer ${token}` }
+ });
+ const data = await res.json();
+ setLinkStatus(data);
+ return data;
+ } catch (error) {
+ return null;
+ }
+ };
+
useEffect(() => {
fetchLinkStatus();
}, []);
@@ -46,7 +60,6 @@ export default function ProfilePage() {
setPolling(false);
setLinkToken(null);
setCommand('');
- // 유저 정보 새로고침
await checkAuth();
}
}, 3000);
@@ -59,10 +72,8 @@ export default function ProfilePage() {
if (!linkToken) return;
const handleBeforeUnload = (e) => {
- // 토큰 무효화 API 호출 (sendBeacon으로 페이지 이탈 전 전송)
const token = localStorage.getItem('token');
navigator.sendBeacon('/link/cancel', JSON.stringify({ authToken: token }));
-
e.preventDefault();
e.returnValue = '연동이 진행 중입니다. 페이지를 떠나시겠습니까?';
return e.returnValue;
@@ -77,15 +88,22 @@ export default function ProfilePage() {
if (!linkStatus?.minecraftUuid) return;
const socket = io(window.location.origin, { path: '/socket.io' });
+ let isSyncing = false;
socket.on('status', async (status) => {
- if (status?.online && status?.players?.list) {
- const playerInGame = status.players.list.find(p => p.uuid === linkStatus.minecraftUuid);
- // 게임 내 닉네임과 현재 저장된 닉네임이 다르면 동기화
- if (playerInGame && playerInGame.name !== user?.name) {
- // fetchLinkStatus가 DB 업데이트 → 완료 후 checkAuth로 user.name 갱신
+ if (!status?.online || !status?.players?.list) return;
+ if (isSyncing) return;
+
+ const playerInGame = status.players.list.find(p => p.uuid === linkStatus.minecraftUuid);
+ if (playerInGame && playerInGame.name !== user?.name) {
+ isSyncing = true;
+ try {
await fetchLinkStatus();
await checkAuth();
+ } catch (error) {
+ // 무시
+ } finally {
+ isSyncing = false;
}
}
});
@@ -93,21 +111,6 @@ export default function ProfilePage() {
return () => socket.disconnect();
}, [linkStatus?.minecraftUuid, user?.name]);
- const fetchLinkStatus = async () => {
- try {
- const token = localStorage.getItem('token');
- const res = await fetch('/link/status', {
- headers: { 'Authorization': `Bearer ${token}` }
- });
- const data = await res.json();
- setLinkStatus(data);
- return data;
- } catch (error) {
- console.error('연동 상태 확인 실패:', error);
- return null;
- }
- };
-
const handleRequestLink = async () => {
setIsLoading(true);
try {
@@ -175,26 +178,33 @@ export default function ProfilePage() {
if (!user) return null;
return (
-
- {/* 헤더 */}
-
-
-
+
+ {/* 모바일용 헤더 */}
+ {isMobile && (
+
+
-
-
프로필
-
계정 정보 및 마인크래프트 연동
+
+
프로필
+
계정 정보 및 마인크래프트 연동
-
-
+
+ )}
-
+
+ {/* 데스크탑용 타이틀 */}
+ {!isMobile && (
+
+
프로필 관리
+
계정 정보 및 마인크래프트 연동
+
+ )}
{/* 프로필 정보 카드 */}
@@ -310,14 +320,14 @@ export default function ProfilePage() {
{/* 계정 관리 섹션 */}
-
+
계정 관리
-
+
회원 탈퇴 시 모든 데이터가 삭제되며 복구할 수 없습니다.