diff --git a/next.config.ts b/next.config.ts index fa0942f5..51ef58b3 100644 --- a/next.config.ts +++ b/next.config.ts @@ -1,4 +1,7 @@ import type { NextConfig } from 'next'; +import type { RemotePattern } from 'next/dist/shared/lib/image-config'; + +const isProd = process.env.NODE_ENV === 'production'; const nextConfig: NextConfig = { // output: 'standalone', @@ -31,7 +34,16 @@ const nextConfig: NextConfig = { hostname: 'www.zeroone.it.kr', pathname: '/**', }, - // CMS 개발 환경에서 사용하는 이미지 도메인 허용 설정 + ...(isProd + ? ([] as RemotePattern[]) + : ([ + { + protocol: 'http', + hostname: 'localhost', + port: '8080', + pathname: '/**', + }, + ] as RemotePattern[])), { protocol: 'http', hostname: 'localhost', diff --git a/src/app/(service)/home/home-content.tsx b/src/app/(service)/home/home-content.tsx index b20f2849..47f639eb 100644 --- a/src/app/(service)/home/home-content.tsx +++ b/src/app/(service)/home/home-content.tsx @@ -5,18 +5,24 @@ import CommunityTab from '@/features/study/one-to-one/balance-game/ui/community- import HallOfFameTab from '@/features/study/one-to-one/hall-of-fame/ui/hall-of-fame-tab'; import StudyHistoryTab from '@/features/study/one-to-one/history/ui/study-history-tab'; import StudyTab from '@/features/study/one-to-one/schedule/ui/home-study-tab'; +import { getServerCookie } from '@/utils/server-cookie'; +import { isNumeric } from '@/utils/validation'; interface HomeContentProps { activeTab: string; } -export default function HomeContent({ activeTab }: HomeContentProps) { +export default async function HomeContent({ activeTab }: HomeContentProps) { + const isHistoryTab = activeTab === 'history'; + const memberIdStr = isHistoryTab ? await getServerCookie('memberId') : null; + const isLoggedIn = !!memberIdStr && isNumeric(memberIdStr); + const renderTabContent = () => { switch (activeTab) { case 'study': return ; case 'history': - return ; + return isLoggedIn ? : ; case 'ranking': return ; case 'archive': diff --git a/src/components/card/voting-card.tsx b/src/components/card/voting-card.tsx index 81b2b836..365e2eb1 100644 --- a/src/components/card/voting-card.tsx +++ b/src/components/card/voting-card.tsx @@ -90,7 +90,7 @@ export default function VotingCard({ voting, onClick }: VotingCardProps) {

)} - {/* 간단한 투표 결과 미리보기 (투표했을 때만) */} + {/* 간단한 투표 결과 미리보기 */} {hasVoted && (
diff --git a/src/components/home/tab-navigation.tsx b/src/components/home/tab-navigation.tsx index 13a09619..5f791d13 100644 --- a/src/components/home/tab-navigation.tsx +++ b/src/components/home/tab-navigation.tsx @@ -8,7 +8,9 @@ import { History, } from 'lucide-react'; import { useRouter, useSearchParams } from 'next/navigation'; +import { getCookie } from '@/api/client/cookie'; import { cn } from '@/components/ui/(shadcn)/lib/utils'; +import { useAuth } from '@/hooks/common/use-auth'; interface TabNavigationProps { activeTab: string; @@ -50,6 +52,12 @@ const TABS = [ export default function TabNavigation({ activeTab }: TabNavigationProps) { const router = useRouter(); const searchParams = useSearchParams(); + const { isAuthenticated } = useAuth(); + const hasMemberId = !!getCookie('memberId'); + const canViewHistory = isAuthenticated && hasMemberId; + const visibleTabs = canViewHistory + ? TABS + : TABS.filter((tab) => tab.id !== 'history'); const handleTabChange = (tabId: string) => { const params = new URLSearchParams(searchParams.toString()); @@ -64,7 +72,7 @@ export default function TabNavigation({ activeTab }: TabNavigationProps) {