-
Notifications
You must be signed in to change notification settings - Fork 4
✨ feat: 포스트 필터링 및 추천 포스트 구현 #376
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
고생 많으셨습니다 !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P5) filter와 filters의 차이는 어떤걸까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Filter는 전체 필터를 감싸는 최상위 컴포넌트고, Filters는 여러개의 필터 옵션을 받고 렌더링하는 하위 컴포넌트입니다.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P3) filter 구조가 잘 이해되지 않아서 그런데, categories_key에 있는 것들이 categories_map에 매핑되어 그게 categories에 각각 하나씩 매핑되는걸까요?
구조 자체는 작동하긴 하지만, 인덱스 기반 접근보다는 키-값 형태의 단순 객체로 관리하는 쪽이 더 명확하지 않을까 생각이 들어요.
혹시 이 구조가 필요한 이유나 다른 맥락이 있을까요?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
카테고리 구조는 크게 3가지로 나눠서 구현했습니다.
CATEGORIES_KEY
- 화면에 보여질 대분류 문자열들의 배열
CATEGORIES_MAP
- 키와 CATEGORIES 배열 내 인덱스 매핑
CATEGORIES
- 각 인덱스별 세부분류 문자열 배열
현재 저희 필터가 별도의 아이콘이나 설명등이 필요없는 구조이므로 별도의 객체 리터럴로 관리하기보다 인덱스 기반구조가 더 단순하고 직관적이라고 생각했습니다.
또한 배열에 적힌 각 필터들은 절대 삭제되지 않고 추가될 때도 항상 배열 끝에만 붙기 때문에 index를 통한 key값 관리가 가능해지며 고유한 ID를 따로 생성할 필요가 없어 더 단순한 구현이 가능해지기 때문에 위와같은 구조로 구현했습니다
activeCategory: string; | ||
onCategoryChange: (category: string) => void; | ||
}) { | ||
const { filters: pickedFilter, addFilter, removeFilter } = useFilterStore(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
P4) 여기도 filters가 있군요 ..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
여기서 filters는 useFilterStore에서 받아온 “현재 선택된 필터” 배열을 가리킵니다.
변수명이 컴포넌트 내부의 다른 filters(props)와 겹치기 때문에,
구조 분해 할당 시 filters: pickedFilter 형태로 별칭(alias) pickedFilter를 부여한 것입니다.
🔨 테스크
Issue
필터링 UI 수정
클라이언트 딴에서의 추천 시스템
📋 작업 내용
📷 스크린 샷