Skip to content

Commit df52b7d

Browse files
EunbinJungmtm-git1018ahk0413
authored
Feat/community#24 (#94)
* 글 렌더링 * [feat] 글 렌더링 기능 구현, 탭 기능 구현, 포스트 상세페이지 연결 * [feat] 댓글개수 기능 구현 * [feat] 환경변수 설정 * 삭제된 파일 * [Fix]레시피 페이지 진입시 에러 해결 (#83) * [style]칵테일 페이지 스켈레톤 UI * [style]레시피페이지 스켈레톤 * [stlye]스켈레톤 Ui 수정 * [fix]레시피페이지 진입안되는 버그 수정 * [fix]레시피페이지 진입시 버그 수정 * [fix, refactor] 스크롤 커스텀 및 토스트/로그인 로직 및 훅 분리 (#84) * [fix] next이미지 경고 수정 및 챗봇 챗 로딩 위치 이동 * [style] 전체페이지 스크롤 커스텀 * [fix] toast 훅으로 변경, 로그아웃 로직 훅으로 변경 * [refactor] 훅 분리 * [docs] useToast 훅 폴더 경로 변경 * [docs] 폴더 명 변경 * [style] 마이페이지 탭별 페이지#29 #30 (#85) * [style]mybar * [style]알람설정 * [style] 탭 메뉴 접근성 * [style]마이페이지 * [style]마이페이지 반응형 수정 * [style]툴팁컴포넌트 * [chore]포매팅 * [chore] env환경변수설정 (#86) * [style]mybar * [style]알람설정 * [style] 탭 메뉴 접근성 * [style]마이페이지 * [style]마이페이지 반응형 수정 * [style]툴팁컴포넌트 * [chore]포매팅 * [style] 마이페이지 mybar 카드 정렬 수정 * [chore]환경변수설정 * [chore]auth getAPI사용 * [chore]환경변수 재설정 * 삭제된파일 다시복구 * 삭제된 파일 복구 * 삭제된 파일 복구 * 삭제된 파일 복구 * 수정 * 마이페이지 커뮤니티글컴포넌트 수정 * 패치로직 수정 * 수정 * 수정 * 수정 * 수정 * 글상세 렌더링 기능 * 오류 수정 * 오류 수정 * 수정 * 수정 * 스켈레톤 수정 * 주석처리 * 주석처리 * 주석처리 * 레이아웃 수정 * [style] 커뮤니티 리스트 간격 수정 --------- Co-authored-by: mtm-git1018 <[email protected]> Co-authored-by: ahk0413 <[email protected]> Co-authored-by: ahk0413 <[email protected]>
1 parent f74b097 commit df52b7d

File tree

37 files changed

+502
-232
lines changed

37 files changed

+502
-232
lines changed

next.config.ts

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,14 @@
11
import type { NextConfig } from 'next';
22

33
const nextConfig: NextConfig = {
4-
5-
images: {
6-
domains: ['www.thecocktaildb.com']
7-
},
8-
env: {
9-
NPUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL
10-
},
4+
images: {
5+
domains: ['www.thecocktaildb.com'],
6+
},
7+
env: {
8+
NPUBLIC_API_URL: process.env.NEXT_PUBLIC_API_URL,
9+
},
1110
// webpack 설정
1211
webpack: (config) => {
13-
1412
// @ts-expect-error 타입 에러 무시
1513
const fileLoaderRule = config.module.rules.find((rule) => rule.test?.test?.('.svg'));
1614

@@ -44,7 +42,7 @@ const nextConfig: NextConfig = {
4442
loaders: ['@svgr/webpack'],
4543
as: '*.js',
4644
},
47-
}
45+
},
4846
},
4947
};
5048

src.zip

997 KB
Binary file not shown.

src/app/community/[id]/loading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function loading() {
1+
function Loading() {
22
return (
33
<div className="w-full mb-10 flex relative animate-pulse">
44
{/* 메인 콘텐츠 */}
@@ -27,4 +27,4 @@ function loading() {
2727
);
2828
}
2929

30-
export default loading;
30+
export default Loading;

src/app/community/[id]/page.tsx

Lines changed: 49 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,67 @@
1+
'use client';
2+
3+
import { fetchPostById } from '@/domains/community/api/fetchPost';
14
import DetailContent from '@/domains/community/detail/DetailContent';
25
import DetailHeader from '@/domains/community/detail/DetailHeader';
36
import DetailTitle from '@/domains/community/detail/DetailTitle';
47
import DetailTabDesktop from '@/domains/community/detail/tab/DetailTabDesktop';
5-
import Comment from '@/domains/shared/components/comment/Comment';
8+
import { Post } from '@/domains/community/types/post';
9+
import Comment from '@/domains/community/detail/Comment';
610
import StarBg from '@/domains/shared/components/star-bg/StarBg';
11+
import { useParams } from 'next/navigation';
12+
import { useEffect, useState } from 'react';
713

814
function Page() {
15+
const params = useParams();
16+
const [postDetail, setPostDetail] = useState<Post | null>(null);
17+
18+
useEffect(() => {
19+
const postId = params.id;
20+
const fetchData = async () => {
21+
const data = await fetchPostById(postId);
22+
if (!data) return;
23+
24+
setPostDetail(data);
25+
};
26+
fetchData();
27+
}, [params.id, setPostDetail]);
28+
29+
if (!postDetail) return <div>게시글을 불러오지 못했습니다.</div>;
30+
31+
const {
32+
categoryName,
33+
title,
34+
userNickName,
35+
createdAt,
36+
viewCount,
37+
postId,
38+
tags,
39+
content,
40+
likeCount,
41+
commentCount,
42+
} = postDetail;
43+
944
return (
1045
<div className="w-full relative">
1146
<StarBg className="w-full h-32 absolute"></StarBg>
1247
<article className="page-layout max-w-824 z-5">
13-
<DetailHeader />
14-
<DetailTitle />
15-
<DetailContent />
48+
<DetailHeader categoryName={categoryName} />
49+
<DetailTitle title={title} userNickname={userNickName} />
50+
<DetailContent
51+
content={content}
52+
createdAt={createdAt}
53+
viewCount={viewCount}
54+
postId={postId}
55+
tags={tags}
56+
likeCount={likeCount}
57+
commentCount={commentCount}
58+
/>
1659
<section className="mb-10">
17-
<Comment />
60+
<Comment postId={postId} />
1861
</section>
1962
</article>
2063
<div className="hidden md:block">
21-
<DetailTabDesktop />
64+
<DetailTabDesktop likeCount={likeCount} commentCount={commentCount} />
2265
</div>
2366
</div>
2467
);

src/app/community/loading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function loading() {
1+
function Loading() {
22
return (
33
<div className="w-full animate-pulse">
44
<div className="page-layout max-w-[1024px]">
@@ -22,4 +22,4 @@ function loading() {
2222
);
2323
}
2424

25-
export default loading;
25+
export default Loading;

src/app/community/page.tsx

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,4 @@
1-
import CommunityFilter from '@/domains/community/main/CommunityFilter';
2-
import CommunityTab from '@/domains/community/main/CommunityTab';
3-
import PostCard from '@/domains/community/main/PostCard';
4-
import WriteBtn from '@/domains/community/main/WriteBtn';
5-
1+
import Community from '@/domains/community/main/Community';
62
import PageHeader from '@/domains/shared/components/page-header/PageHeader';
73
import { Metadata } from 'next';
84

@@ -22,22 +18,7 @@ function Page() {
2218
커뮤니티 페이지
2319
</h1>
2420
</section>
25-
26-
<section
27-
aria-label="탭과 글쓰기"
28-
className="flex justify-between item-center sm:flex-row flex-col gap-4 mt-1"
29-
>
30-
<CommunityTab />
31-
<WriteBtn />
32-
</section>
33-
34-
<section aria-label="게시물 목록">
35-
<CommunityFilter />
36-
<PostCard label="레시피" />
37-
<PostCard label="팁" />
38-
<PostCard label="질문" />
39-
<PostCard label="자유" />
40-
</section>
21+
<Community />
4122
</div>
4223
</div>
4324
</div>

src/app/community/write/loading.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
function loading() {
1+
function Loading() {
22
return (
33
<div className="w-full mb-20 flex relative animate-pulse">
44
<div className="page-layout max-w-[824px] flex-1 z-5 space-y-6 mt-12">
@@ -30,4 +30,4 @@ function loading() {
3030
);
3131
}
3232

33-
export default loading;
33+
export default Loading;

src/app/mypage/my-active/my-comment/page.tsx

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return (
11-
<>
12-
<CommentList />
13-
</>
14-
);
10+
return <>{/* <CommentList /> */}</>;
1511
}
1612
export default Page;

src/app/mypage/my-active/my-like/page.tsx

Lines changed: 1 addition & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,27 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return (
11-
<ul>
12-
<li>
13-
<PostCard label="레시피"></PostCard>
14-
</li>
15-
<li>
16-
<PostCard label="레시피"></PostCard>
17-
</li>
18-
<li>
19-
<PostCard label="레시피"></PostCard>
20-
</li>
21-
<li>
22-
<PostCard label="레시피"></PostCard>
23-
</li>
24-
<li>
25-
<PostCard label="레시피"></PostCard>
26-
</li>
27-
<li>
28-
<PostCard label="레시피"></PostCard>
29-
</li>
30-
</ul>
31-
);
10+
return <section>{/* <PostCard posts={posts} isLoading={isLoading} /> */}</section>;
3211
}
3312
export default Page;

src/app/mypage/my-active/my-post/page.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,18 +7,6 @@ export const metadata: Metadata = {
77
};
88

99
function Page() {
10-
return (
11-
<ul>
12-
<li>
13-
<PostCard label="레시피"></PostCard>
14-
</li>
15-
<li>
16-
<PostCard label="팁"></PostCard>
17-
</li>
18-
<li>
19-
<PostCard label="레시피"></PostCard>
20-
</li>
21-
</ul>
22-
);
10+
return <div>{/* <PostCard posts={posts} isLoading={isLoading} /> */}</div>;
2311
}
2412
export default Page;

0 commit comments

Comments
 (0)