Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feat/#65] 커뮤니티 뷰/ 대분류 구현 #107

Merged
merged 50 commits into from
Jan 21, 2025

Conversation

Leeyoonji23
Copy link
Collaborator

@Leeyoonji23 Leeyoonji23 commented Jan 17, 2025

🔥 Related Issues

✅ 작업 리스트

<커뮤니티 메인 뷰>

  • 커뮤니티 헤더
  • 인기글/최신글
  • 배너
  • Divider 붙이기
  • 플로팅버튼

<커뮤니티- 대분류들>

  • 쿼리 파라미터 세팅
  • 대분류 헤더 ( 대분류 이름들은 map 돌리기)
  • 필터 버튼 -> 코코스 매거진에만 없게
  • 플로팅버튼 -> 코코스 매거진에만 없게
  • 필터 활성화

🔧 작업 내용

기존 커뮤니티 뷰는 동일한데 추가된 점은 Category 폴더입니다,
Path.ts 에
CATEGORY:"/community/category",
추가,

Community.tsx 에
{ path: PATH.COMMUNITY.CATEGORY, element: <Category /> },
추가했습니다.

각 페이지 별 주소는 노션 참고해주시면 될 것 같습니다 !

  • 쿼리 파라미터 사용했습니다.

  • 기존 width:"37.5rem" 으로 고정시킨것도 반응형 고려하여 다시 스타일링 했습니다.

  • 하단 Nav 바 max-width 적용 안시켰더니 반응형으로 돌렸을 때 화면에 넘쳐서 maxWidth : "76.8rem" 적용시켰습니다 !

📣 리뷰어에게 어떠신가요?

살벌한 코리 부탁드립니도.
많관부 ~~

📸 스크린샷 / GIF / Link

커뮤니티 메인 뷰

bandicam.2025-01-19.07-46-52-941.mp4

최신글/인기글

bandicam.2025-01-19.07-48-10-826.mp4

카테고리 대분류 / 필터적용

bandicam.2025-01-19.07-49-06-973.mp4

플로팅버튼

bandicam.2025-01-19.07-50-15-049.mp4

@Leeyoonji23 Leeyoonji23 self-assigned this Jan 17, 2025
@Leeyoonji23 Leeyoonji23 changed the title [Feat/#65] [Feat/#65] 커뮤니티 뷰/ 대분류 구현 Jan 17, 2025
@Leeyoonji23 Leeyoonji23 changed the title [Feat/#65] 커뮤니티 뷰/ 대분류 구현 [Feat/#65] 커뮤니티 뷰/ 대분류 구현 (아직 코리 금지) Jan 17, 2025
@Leeyoonji23 Leeyoonji23 requested review from ocahs9, minjeoong and yarimu and removed request for ocahs9 January 18, 2025 22:51
@Leeyoonji23 Leeyoonji23 added 🎨 design 사용자 UI 디자인 변경 - ex) CSS ✨ feat 기능 구현 ♻️ refactor 프로덕션 코드 리팩토링 labels Jan 18, 2025
@Leeyoonji23 Leeyoonji23 changed the title [Feat/#65] 커뮤니티 뷰/ 대분류 구현 (아직 코리 금지) [Feat/#65] 커뮤니티 뷰/ 대분류 구현 Jan 18, 2025
Copy link
Collaborator

@ocahs9 ocahs9 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

코드가 깔끔해지고 있는게 확실히 느껴진다 점점 발전하고 있네 고생했어!!
코멘트 한번만 확인한 뒤 반영해줘!

import FilterBottomSheet from "@shared/component/FilterBottomSheet/FilterBottomSheet";
import { useFilterStore } from "@store/filter";

const categoryMapping: { [key: string]: string } = {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) 오 객체 타입 정의까지 해주었네요? 혹시 그 이유가 뭔지 물어봐도 될까요?
아마 저런 타입으로 정의해두면 추후 카테고리가 확장될 때에는 좋을 것 같긴한데, 굳이 필요했나 싶긴 해서요!
(그렇다고 지울 필요는 전혀 없습니다. 작성하지 않아도 될텐데 작성한 이유가 궁금한거에요!)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이건 기획분들에게 여쭤봤을 때 추후 스프린트 때 대분류가 늘어날 가능성이 있을 수도 있다고 하셔서 공부하는 김에 써봤습니당...ㅎㅅㅎ

Comment on lines 7 to 19
export const fetchCategories = async (type: string): Promise<CategoryItem[]> => {
try {
const response = await fetch(`/api/categories?type=${type}`);
if (!response.ok) {
throw new Error("Failed to fetch categories");
}
const data = await response.json();
return data.data.categories.items;
} catch (error) {
console.error("Error fetching categories:", error);
return [];
}
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 이 함수는 어디에 사용하는건가요?
만약 사용하지 않는 함수라면 지워주세요! (추후 어디에 사용할거면 위에 주석이라도 간단히 달아주세요)

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

쿜ㅋㅋㅋ 이거 사실 API 붙이는 형식 연습해보려고 하다가 지운 줄 알았는데 들어갔네융.... 쿜... Category.tsx 파일 하나로 통합했습니다!

Comment on lines +30 to +36
// 유효하지 않은 타입 처리
if (!type || !validTypes.includes(type)) {
return (
<div>
<h1>해당 카테고리는 존재하지 않습니다.</h1>
</div>
);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p5) 예외처리 해두라고 말했는데 찰떡같이 알아들었구나.. 칭찬합니다

Comment on lines 83 to 89
{/* 코코스매거진이 아닐 때만 플로팅 버튼 표시 */}
{type !== "magazine" && (
<div className={styles.floatingBtnContainer}>
<FloatingBtn />
</div>
)}
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1) 코코스 매거진 아닐 때만 플로팅 버튼 표시하도록 하는 건 좋은데, 버튼에 기능이 들어가 있지 않은 것 같아요!
해당 버튼을 클릭할 시, 글 작성 페이지로 navigate 하는 로직이 필요할 것 같아요

(추가로, 그냥 navigate하는게 아니라 쿼리 파라미터를 보내면서 navigate를 하는게 좋을 것 같아요 - 어떤 타입의 쿼리 파라미터를 설정할 지는, 글 작성 페이지를 만든 민정이랑 상의해보는 게 좋을 듯!)

Comment on lines 17 to 19
const handleSearchClick = () => {
navigate(API_PATH.SEARCH);
};
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p2) API_PATH_SEARCH 가 아니라, 그냥 PATH.어쩌구 를 써야하는 게 아닌가요?
아마 api용 상수 path랑 저희 페이지용 상수 path를 헷갈린 것 같은데, 실수한 게 맞다면 수정 부탁드립니다~

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

아핳 ㅋㅎㅋㅎ 꺽 ... 넵

Comment on lines 38 to 40
<div className={styles.btnContainer}>
<FloatingBtn />
</div>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p1) 여기도 마찬가지로 버튼에 기능 붙여주세요~

아마 여기서 넘어가는 건 쿼리 파라미터 없이 넘어가서 글 작성 시 카테고리 선택 안된 상태가 되어야 할 것 같은데 이것도 민정이랑 얘기해보면 좋을 것 같아요!

import Content from "@common/component/Content/Content";

const PostList = () => {
const [isActive, setIsActive] = useState(true); // true: 최신글, false: 인기글
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 이거 네이밍만 살짝 바꿔보면 더 상태의 의미가 명확해질 것 같아요!
isActive 대신 isRecentPost 같은 건 어떤가요?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

너무 좋아요 ~

Copy link
Collaborator

@minjeoong minjeoong left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

확인했습니다.

commentCount={post.commentCount}
createdAt={isActive ? post.createdAt : post.updatedAt}
image={post.image}
onClick={() => navigate(`/post/${post.id}`)}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

p3) 요거 PATH 로 변경 해주세용

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

했어용 ~!

Copy link
Collaborator

@yarimu yarimu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!! 윤지업~

@Leeyoonji23 Leeyoonji23 merged commit b6b575d into develop Jan 21, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 design 사용자 UI 디자인 변경 - ex) CSS ✨ feat 기능 구현 ♻️ refactor 프로덕션 코드 리팩토링
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[ Feat ] 커뮤니티 뷰
4 participants