Skip to content

Commit 85c586e

Browse files
committed
Merge remote-tracking branch 'origin/dev' into refactor/recipeFetch
2 parents dd44e1d + 049fd7b commit 85c586e

File tree

6 files changed

+37
-26
lines changed

6 files changed

+37
-26
lines changed

README.md

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
# SSOUL 프로젝트 인수인계 문서
1+
# SSOUL
2+
Ai 칵테일 추천 & 커뮤니티 사이트
23

34
## 프로젝트 개요
45

@@ -64,7 +65,7 @@ src/
6465

6566
### 1. 인증 시스템
6667
- **소셜 로그인**: Google, Kakao, Naver 지원
67-
- **상태 관리**: Zustand + localStorage persist
68+
- **상태 관리**: Zustand + cookie 기반
6869
- **주요 파일**:
6970
- `src/domains/shared/store/auth.ts`: 인증 상태 관리
7071
- `src/domains/login/hook/useAuthHooks.ts`: 로그인 관련 훅
@@ -73,8 +74,17 @@ src/
7374
### 2. 페이지별 기능
7475

7576
#### 메인 페이지 (`/`)
76-
- 현재 기본 구조만 구현됨
77-
- 추후 확장 예정
77+
- **3D 애니메이션**: GSAP + Three.js 기반 칵테일 드롭 애니메이션
78+
- **스크롤 슬라이더**: 커뮤니티, 레시피, 추천 섹션을 스크롤로 탐색
79+
- **반응형 디자인**: 모바일데스크톱 최적화
80+
- **주요 컴포넌트**:
81+
- `CocktailDrop`: 3D 칵테일 드롭 애니메이션
82+
- `MainSlide`: 스크롤 기반 슬라이더
83+
- `StarMain`: 별 배경 애니메이션
84+
- `HomeLogo`: 로고 애니메이션
85+
- **기능**:
86+
- 스크롤 스무딩 (ScrollSmoother)
87+
- 반응형 로고 위치 조정
7888

7989
#### 칵테일 레시피 (`/recipe`)
8090
- **주요 컴포넌트**:
@@ -153,9 +163,8 @@ src/
153163
## 주의사항
154164

155165
1. **환경 변수**: 개발/운영 환경에 맞는 API URL 설정 필요
156-
2. **인증 토큰**: localStorage에 저장되므로 보안 고려 필요
157-
3. **API 통신**: `credentials: 'include'` 설정으로 쿠키 기반 인증
158-
4. **Git Hooks**: Husky 설정으로 커밋 전 자동 검사
166+
2. **API 통신**: `credentials: 'include'` 설정으로 쿠키 기반 인증
167+
3. **Git Hooks**: Husky 설정으로 커밋 전 자동 검사
159168

160169
## 추가 문의
161170

src/domains/community/detail/DetailHeader.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@ import Label from '@/domains/shared/components/label/Label';
22
import EditDelete from './EditDelete';
33
import { useRouter } from 'next/navigation';
44
import { useAuthStore } from '@/domains/shared/store/auth';
5-
import { useToast } from '@/shared/hook/useToast';
65
import ConfirmModal from '@/shared/components/modal-pop/ConfirmModal';
76
import { useState } from 'react';
87
import { getApi } from '@/app/api/config/appConfig';
@@ -18,7 +17,6 @@ function DetailHeader({ categoryName, postId, userNickName }: Props) {
1817
const [deletePost, setDeletePost] = useState(false);
1918
const router = useRouter();
2019
const user = useAuthStore((state) => state.user);
21-
const { toastError } = useToast();
2220

2321
const handleConfirmDelete = async (postId: number | ParamValue) => {
2422
if (!user) {
@@ -28,7 +26,6 @@ function DetailHeader({ categoryName, postId, userNickName }: Props) {
2826

2927
try {
3028
const res = await fetch(`${getApi}/posts/${postId}`, { method: 'DELETE' });
31-
if (res.ok) console.log('deleted');
3229
router.push('/community');
3330
} catch (err) {
3431
console.error(err);

src/domains/community/detail/DetailPage.tsx

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -48,15 +48,26 @@ function DetailPage() {
4848

4949
useEffect(() => {
5050
const fetchLikeStatus = async () => {
51+
// 로그인 상태일 때만 좋아요 상태 조회
52+
if (!isLoggedIn) {
53+
setLike(false);
54+
return;
55+
}
56+
5157
try {
5258
const liked = await getLikePost(postId);
5359
setLike(liked);
5460
} catch (err) {
5561
console.error('좋아요 상태 불러오기 실패', err);
62+
setLike(false);
5663
}
5764
};
58-
fetchLikeStatus();
59-
}, [postId]);
65+
66+
// postId가 있을 때만 실행
67+
if (postId) {
68+
fetchLikeStatus();
69+
}
70+
}, [postId]); // isLoggedIn 의존성 제거하여 무한 루프 방지
6071

6172
useEffect(() => {
6273
if (postDetail) {

src/domains/community/hook/useComment.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@ import { useState, useEffect, useCallback } from 'react';
22
import { deleteComment, fetchComment, updateComment } from '../api/fetchComment';
33
import { getApi } from '@/app/api/config/appConfig';
44
import { CommentType } from '../types/post';
5-
import { User } from '@/domains/shared/store/auth';
65
import { ParamValue } from 'next/dist/server/request/params';
6+
import { User } from '@/domains/shared/store/auth';
77

88
export function useComments(postId: ParamValue, user: User | null) {
99
const [comments, setComments] = useState<CommentType[] | null>(null);
@@ -19,11 +19,11 @@ export function useComments(postId: ParamValue, user: User | null) {
1919
if (!data) return;
2020
setComments(data);
2121
setIsEnd(false);
22-
}, [postId]);
22+
}, [postId, user]);
2323

2424
useEffect(() => {
2525
fetchData();
26-
}, [postId]);
26+
}, [fetchData]);
2727

2828
const handleUpdateComment = async (commentId: number, content: string) => {
2929
if (!user) {
@@ -78,7 +78,7 @@ export function useComments(postId: ParamValue, user: User | null) {
7878

7979
setIsLoading(true);
8080
try {
81-
const res = await fetch(`${getApi}/posts/${postId}/comments?lastId=${lastCommentId}`);
81+
const res = await fetch(`${getApi}/posts/${postId}/comments?lastId=${lastCommentId}`, {});
8282
const newComments = await res.json();
8383

8484
if (newComments.data.length === 0) {

src/domains/shared/components/comment/CommentHeader.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,6 @@ function CommentHeader({
6161
intervalCall1000(async () => {
6262
const success = await createComment(newComment);
6363
if (!success) {
64-
console.log('칵테일 페이지에서 댓글은 한개만 입력 가능합니다');
6564
}
6665
});
6766
}

src/domains/shared/components/profile/Profile.tsx

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,20 @@
1-
import useFetchProfile from '@/domains/mypage/api/fetchProfile';
21
import SsuryImage from '@/domains/mypage/main/SsuryImage';
3-
import { useEffect } from 'react';
2+
import { useAuthStore } from '@/domains/shared/store/auth';
43

54
type Props = {
65
userNickname: string;
76
};
87

98
function Profile({ userNickname }: Props) {
10-
const { profile, fetchProfile } = useFetchProfile();
11-
useEffect(() => {
12-
fetchProfile();
13-
}, [fetchProfile, profile?.data?.abvLevel]);
9+
const user = useAuthStore((state) => state.user);
1410

15-
if (!profile?.data) return null;
16-
const { abvLevel } = profile.data;
11+
if (!user) return null;
1712

1813
return (
1914
<div className="flex gap-2 items-center justify-start">
2015
<div className="w-8 h-8 flex items-center justify-center" aria-label="작성자 아이콘">
2116
<div className="w-8 flex items-center justify-center">
22-
<SsuryImage abvLevel={abvLevel} />
17+
<SsuryImage abvLevel={user.abv_degree || 5.0} />
2318
</div>
2419
</div>
2520
<span aria-label="작성자 이름" className="text-sm">

0 commit comments

Comments
 (0)