Files
a301_client/src/pages/HomePage.jsx
tolelom 1359c38222 feat: 관리자 페이지 추가 (공지사항, 다운로드, 유저 관리)
- /admin 라우트 추가 (admin 권한 전용)
- 공지사항 CRUD, 다운로드 정보 수정, 유저 권한/삭제 관리
- AuthContext에 role 추가 및 localStorage 저장
- 홈 헤더에 admin 링크 표시 (admin만 노출)

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-02-24 14:52:28 +09:00

43 lines
1.3 KiB
JavaScript

import { Link } from 'react-router-dom';
import { useAuth } from '../context/AuthContext';
import DownloadSection from '../components/DownloadSection';
import AnnouncementBoard from '../components/AnnouncementBoard';
import './HomePage.css';
export default function HomePage() {
const { user, logout } = useAuth();
return (
<div className="home-page">
<header className="home-header">
<h1 className="home-logo">A301</h1>
<div className="home-user">
{user ? (
<>
<span className="home-username">{user.username}</span>
{user.role === 'admin' && (
<Link to="/admin" className="btn-admin-link">관리자</Link>
)}
<button className="btn-logout" onClick={logout}>로그아웃</button>
</>
) : (
<Link to="/login" className="btn-header-login">로그인</Link>
)}
</div>
</header>
<section className="hero-banner">
<div className="hero-overlay">
<h2 className="hero-title">A301 MULTIPLAYER</h2>
<p className="hero-desc">Unity 3D 멀티플레이어 테스트에 참여하세요</p>
</div>
</section>
<main className="home-main">
<DownloadSection />
<AnnouncementBoard />
</main>
</div>
);
}