'use client'; import Styles from '../styles/layout.module.scss'; import { useCallback } from 'react'; import Link from 'next/link'; import { usePathname } from 'next/navigation'; import useAuth from '@/hooks/useAuth'; import useDragScroll from '@/hooks/useDragScroll'; import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; import { faBars, faXmark, faCartShopping, faChevronLeft, faChevronRight } from '@fortawesome/free-solid-svg-icons'; import NotificationBell from '@/app/component/NotificationBell'; import HeaderSearch from '@/app/component/HeaderSearch'; import Profile from '@/app/component/Profile'; import Logo from '@/app/component/Logo'; import PointChargeIcon from '@/public/icons/layout/point.svg'; import useCart from '@/hooks/useCart'; import { FEATURE_CHANNEL } from '@/constants/features'; // 채널/방송 메뉴(생방송·크리에이터)는 채널 기능 ON 일 때만 노출 const channelNavItems = [ { href: '/live', label: '생방송' }, { href: '/creators', label: '크리에이터' } ]; const baseNavItems = [ { href: '/stock', label: '종목' }, { href: '/paper', label: '모의투자' }, { href: '/games', label: '게임' }, { href: '/feed/all', label: '피드' }, { href: '/chat', label: '채팅' }, { href: '/store', label: '상점' }, { href: '/attendance', label: '출석부' }, { href: '/board/notice', label: '고객지원' } ]; const navItems = FEATURE_CHANNEL ? [...channelNavItems, ...baseNavItems] : baseNavItems; const SCROLL_AMOUNT = 120; type Props = { sidebarOpen: boolean; onToggle: () => void; }; export default function Header({ sidebarOpen, onToggle }: Props) { const { isAuthenticated } = useAuth(); const { totalCount: cartCount } = useCart(); const pathname = usePathname(); const dragScroll = useDragScroll(); const scrollTabs = useCallback((dir: 'left' | 'right') => { const el = dragScroll.ref.current; if (!el) { return; } el.scrollBy({ left: dir === 'left' ? -SCROLL_AMOUNT : SCROLL_AMOUNT, behavior: 'smooth' }); }, [dragScroll.ref]); const handlePopupCharge = useCallback(() => { const w = 450, h = 635; const left = window.screenX + (window.outerWidth - w) / 2; const top = window.screenY + (window.outerHeight - h) / 2; window.open('/charge', 'charge', `width=${w},height=${h},left=${left},top=${top},scrollbars=no,resizable=no`); }, []); return ( ); }