-
Notifications
You must be signed in to change notification settings - Fork 1
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: 목표 생성, 목표 상세보기, 목표 삭제 후 현재 페이지 변경 로직 추가 #115
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
|
…github.com/depromeet/amazing3-fe into feat/home-position-after-goal-detail-saved
ec445cd
to
1102c96
Compare
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.
어메이징 류홍석 갓홍석 빛홍석 킹홍석 수고 많으셨으~~~ 💡✨👍
src/app/goal/detail/saved/page.tsx
Outdated
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.
이건 무슨 페이지죠...???? /goal/detail/saved
..?
세부 목표 페이지에서 더 들어가는 게 있었나요 ..???
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.
/goal/detail
레이아웃에 공통 부분이 있어서 같은 상위 directory에 위치하게 되었습니다. 나중에 리팩토링 대상인 페이지에요~ (두개의 링크가 달라질 필요가 없을 것 같아서..;;)
지금 구조는 /goal/detail/id
인 경우 목표 상세 페이지 출력, goal/detail/saved
인 경우에 저장된 목표 상세 페이지 출력합니다~
@@ -16,14 +17,15 @@ interface DeleteGoalButtomSheetProps { | |||
|
|||
export const DeleteGoalButtomSheet = ({ open, onClose, goalId }: DeleteGoalButtomSheetProps) => { |
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.
ButtonSheet !?! ㅋㅋㅋㅋㅋㅋㅋ
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.
에휴 리팩토링할 때까지 발견되지 않기를 바랐는데 걸려버렸다~~~ 바로 수정~~~
if (isSuccess) { | ||
onClose(); | ||
router.back(); | ||
router.push(`/home/${memberData?.username}`); |
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.
홍석넴 요거 onSuccess로 처리해줘도 될 거 같아영
// useDeleteGoal
...
export const useDeleteGoal = () => {
...
const router = useRouter();
return useMutation({
...
onSuccess: () => {
queryClient.invalidateQueries({ queryKey: ['goals'] });
const memberData = queryClient.getQueryData(['memberData']) as MemberProps;
router.push(`/home/${memberData.username}`);
},
});
};
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.
아 그리고 삭제 버튼을 누르면 pending 상태일 때 버튼에 스피너 넣는 게 좋을 거 같아용
잠깐 화면이 멈춰있는데 내가 안 누른건가 해서 한번더 눌러서 서버 에러 뜸요 😭
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.
아주 좋은 피드백 최고최고
@@ -104,8 +125,8 @@ export const LifeMapContent = ({ goalsData, memberData, downloadSectionRef, isPu | |||
) : ( | |||
<MapCardPositioner type="B" goals={goals} isLast={page === LAST_PAGE - 1} /> | |||
)} | |||
{position && currentPage === page && ( | |||
<CurrentPositionCover currentPosition={position % TOTAL_CURRENT_POSITIONS} /> | |||
{positionState.positionPage === page && positionState.position && ( |
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.
positionState.positionPage === page && positionState.position
이거 뭘 의미하는지 한번 상수로 만들어준 다음에 넣어주실 수 있나영 ? 나중에 여기 리팩터링 제가 맡으면 눈물 한번 흘리고 시작할 거 같아서 😭
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.
positionSate.position
체크 로직은 뒤의 컴포넌트 출력 시 null 체크를 먼저 하려고 추가된 거에요. 별도 함수로 빼서 로직을 생성하면 결국은 앞의 positionState.positionPage === page
만 남는데 이게 의미가 있을까~??
[도은 피드백 적용 후]
const isCurrentPage = (page: number) => {
return positionState.positionPage === page
};
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.
일단 나중에 도은이가 리팩토링 작업할 때 이해 안될 수도 있으니까 comment로 설명 적어뒀어요~~~~!
{/** 현재 위치에 별 위치 시키기 위해 1) 현재 날짜가 포함된 페이지를 찾아서, 2) 포지션 위치에 별을 출력함. */}
{positionState.positionPage === page && positionState.position && (
<CurrentPositionCover currentPosition={positionState.position} />
} | ||
}, [currentPosition]); | ||
|
||
export const MapSwiper = ({ currentPage, children }: MapSwiperProps) => { |
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.
홍석넴 이거 위에서 PropsWithChildren 상속 받기보다
export const MapSwiper = ({ currentPage, children }: MapSwiperProps) => { | |
export const MapSwiper = ({ currentPage, children }: PropsWithChildren<MapSwiperProps>) => { |
도 가능하답니다잇 (별건 아니여서 시간 있을 때 😉
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.
반영하긴 했는데 이렇게 하면 좋은 점이 있나요~?? 👀 잘모르겠어서 👀👀
export const usePrefetchGoals = (): void => { | ||
const queryClient = useQueryClient(); | ||
queryClient.prefetchQuery({ | ||
queryKey: ['goals'], | ||
queryFn: () => api.get<GoalResponse>('/life-map'), | ||
}); | ||
}; |
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.
리뷰가 늦어 죄송...
너무 고생했슴다~! 🫡
const [currentPage, setCurrentPage] = useState<number | null>(null); | ||
const paramId = Number(useSearchParams().get('id')); |
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.
크게 불편한건 아니지만 paramGoalId
같이 어떤 ID인지 넣어주면 좋을것 같아!
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.
반영 완~
🤔 해결하려는 문제가 무엇인가요?
Goal 신규 생성 및 Goal Detail 조회 후 홈 화면 이동 시 해당 위치로 point 잡기
🎉 어떻게 해결했나요?
Record_2024_01_13_03_52_02_13.mp4
📚 Attachment (Option)