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-fe: 이메일 발송 내역 조회 #970

Merged
merged 34 commits into from
Feb 13, 2025
Merged

Conversation

github-actions[bot]
Copy link
Contributor

@github-actions github-actions bot commented Dec 19, 2024

목적

이메일 발송 내역을 조회하는 페이지를 추가합니다.

작업 세부사항

  • api 적용
  • 디자인
  • 이메일 발송 Form 컴포넌트 리팩토링 및 적용
  • 이메일 발송 후 내역 조회 쿼리 무효화

작업 결과

email_history

리팩토링 참고

기존 MessageForm 컴포넌트를 재사용하기 위해 Compound Pattern을 사용해 리팩토링했습니다.
이에 따라 아래 요소로 분리되었습니다. 오랜만에 리팩토링하니까 개운하고 재밌네요^^

image

구성 요소는 아래와 같습니다.

  • MessageForm(Base)
  • MessageForm.FloatingBody
  • MessageForm.Header
  • MessageForm.Form

아래의 별표줄 밑에 요구사항 ID만 작성해주세요. Prefix 금지!


EMAIL_01

closes #969

github-actions bot and others added 2 commits November 17, 2024 10:47
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeongwoo Park <[email protected]>
@github-actions github-actions bot added feature 새로운 기능 frontend 프론트엔드 labels Dec 19, 2024
@github-actions github-actions bot added this to the 스프린트 7.0 milestone Dec 19, 2024
github-actions bot and others added 17 commits December 20, 2024 12:16
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Seongjin Hong <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Seongjin Hong <[email protected]>
Copy link
Contributor Author

1736864820.768509

Copy link
Contributor Author

1736864823.314289

@llqqssttyy llqqssttyy removed the request for review from seongjinme January 15, 2025 13:08
github-actions bot and others added 6 commits January 22, 2025 14:15
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Jeongwoo Park <[email protected]>
Co-authored-by: Kim Da Eun <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Seongjin Hong <[email protected]>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Kim Da Eun <[email protected]>
@lurgi lurgi marked this pull request as ready for review February 6, 2025 09:26
Copy link
Contributor Author

github-actions bot commented Feb 6, 2025

1738834023.774879

Copy link
Contributor

@lurgi lurgi left a comment

Choose a reason for hiding this comment

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

3주간 발효된 PR도 맛있네요. 김치처럼
코멘트 확인 부탁드립니🙇‍♂️

Comment on lines 93 to 95
&:hover {
cursor: pointer;
}
Copy link
Contributor

Choose a reason for hiding this comment

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

해당 hover 이벤트가 잘못 적용되어있는 듯 해요.
메뉴 내부 각각의 요소에 들어가야 할 것 같습니다!

Comment on lines 13 to 16
const { data: { emailResponses: emailHistory } = { emailResponses: [] } } = useQuery({
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId],
queryFn: () => emailApis.history({ clubId, applicantId }),
});
Copy link
Contributor

Choose a reason for hiding this comment

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

초기값은 initalData 속성을 사용하는게 어떨까요?
조금 더 직관적으로 느껴지는데, 어떻게 생각하실까용

Suggested change
const { data: { emailResponses: emailHistory } = { emailResponses: [] } } = useQuery({
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId],
queryFn: () => emailApis.history({ clubId, applicantId }),
});
const {
data: { emailResponses: emailHistory },
} = useQuery({
queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantId],
initialData: { emailResponses: [] },
queryFn: () => emailApis.history({ clubId, applicantId }),
});

Copy link
Contributor

Choose a reason for hiding this comment

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

추가로 이메일 보냈을때 해당 응답에 대한 revalidate가 추가되면 좋겠어요!
혹은 refetch 요청 없이 캐싱값만 수정해도 되겠구용!

Copy link
Contributor

Choose a reason for hiding this comment

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

응답에 대한 revalidate가 어떤 건지 이해하지 못했어요. 어떤 케이스가 있는지 설명해주실 수 있을까용?

Copy link
Contributor

Choose a reason for hiding this comment

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

초기값은 initalData 속성을 사용하는게 어떨까요?

initialData 속성을 까먹고 있었네요. 반영하겠습니다~

@@ -32,6 +33,9 @@ const emailApis = {
path: '/verify-code',
body: { email, verificationCode },
}),

history: async (params: { clubId: string; applicantId: number }) =>
apiClient.get<{ emailResponses: Email[] }>({ path: `/${params.clubId}/${params.applicantId}` }),
Copy link
Contributor

Choose a reason for hiding this comment

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

응답값의 객체 이름은 emailHistoryResponses으로 변경되었나봐요!


const handleSubmit = (e: React.FormEvent) => {
e.preventDefault();
if (subject && content && !subjectError && !contentError) {
onSubmit({ subject, content });
}
if (!subject) setSubjectError('제목을 입력해주세요.');

if (!content) setContentError('내용을 입력해주세요.');
};
Copy link
Contributor

Choose a reason for hiding this comment

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

이곳에 email history에 대한 refetch 혹은 Optimistic Update로직이 들어가면 좋겠습니다 ☺️

Copy link
Contributor

Choose a reason for hiding this comment

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

cache invalidation을 해서 refetch를 해주고 있는데 새로운 정보로 업데이트가 안되고 있었네요.
서버에서 이메일을 보내고 사용자 정보 DB에 이메일 전송 내역을 업데이트하기까지 갭이 있어 그런 것 같습니다.
이를 다음과 같이 대응했습니다.

  1. 새로운 이메일 전송 내역을 '전송중' 표시하여 낙관적 업데이트 적용.
  2. 5초 뒤 cache invalidation을 실행해 실제 refetch를 이룸.

Copy link
Contributor

Choose a reason for hiding this comment

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

스바라시하게 업그레이드 되었네요..👍

Comment on lines +18 to +19
const formattedDate = new Date(createdDate).toLocaleDateString('ko-KR', { month: 'long', day: 'numeric' });
const formattedTime = new Date(createdDate).toLocaleTimeString('ko-KR', { hour: 'numeric', minute: 'numeric' });
Copy link
Contributor

Choose a reason for hiding this comment

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

로컬 설정까지 👍

Base automatically changed from fe/develop to fe/main February 10, 2025 07:33
@llqqssttyy
Copy link
Contributor

llqqssttyy commented Feb 12, 2025

@lurgi
작업할 땐 발견하지 못했던 문제가 많았네용! 스바라시한 리뷰 감사합니다~
변경된 내용은 아래와 같아요!

  • 이메일 전송 후 낙관적 업데이트 적용
  • 모달 메뉴의 마우스 오버 스타일 변경
  • emailResponses -> emailHistoryResponses로 변경
  • 전송 실패 시 토스트 노출 추가

Comment on lines 35 to 38
const FIVE_SECONDS = 5000;
setTimeout(() => {
queryClient.invalidateQueries({ queryKey: [QUERY_KEYS.EMAIL_HISTORY, clubId, applicantIds[0]] });
}, FIVE_SECONDS);
Copy link
Contributor

Choose a reason for hiding this comment

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

백엔드 코드 수정 요청후 변경되어야 하겠네용

Copy link
Contributor

@lurgi lurgi left a comment

Choose a reason for hiding this comment

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

아쌈

@llqqssttyy llqqssttyy changed the base branch from fe/main to fe/develop February 13, 2025 05:00
@llqqssttyy llqqssttyy enabled auto-merge (squash) February 13, 2025 06:28
@llqqssttyy llqqssttyy self-requested a review February 13, 2025 06:35
@llqqssttyy llqqssttyy disabled auto-merge February 13, 2025 07:01
@llqqssttyy llqqssttyy merged commit 82b304d into fe/develop Feb 13, 2025
14 of 15 checks passed
@llqqssttyy llqqssttyy deleted the 969-fe-EMAIL_01 branch February 13, 2025 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature 새로운 기능 frontend 프론트엔드
Projects
Status: 완료
Development

Successfully merging this pull request may close these issues.

2 participants