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

[FE] feat: 꿀조합 댓글 기능 구현 #744

Merged
merged 22 commits into from
Oct 13, 2023
Merged

[FE] feat: 꿀조합 댓글 기능 구현 #744

merged 22 commits into from
Oct 13, 2023

Conversation

xodms0309
Copy link
Collaborator

Issue

✨ 구현한 기능

스크린샷 2023-10-12 오전 10 26 48
  • 꿀조합 댓글 기능 추가
  • Input 컴포넌트에 minWidth props추가

📢 논의하고 싶은 내용

x

🎸 기타

x

⏰ 일정

  • 추정 시간 : 2시간
  • 걸린 시간 : 2시간

@github-actions
Copy link

github-actions bot commented Oct 12, 2023

Test Results

2 tests   2 ✔️  0s ⏱️
1 suites  0 💤
1 files    0

Results for commit a08dd8e.

♻️ This comment has been updated with latest results.

@xodms0309 xodms0309 changed the title feat: 꿀조합 댓글 기능 구현 [FE] feat: 꿀조합 댓글 기능 구현 Oct 12, 2023
Copy link
Collaborator

@Leejin-Yang Leejin-Yang left a comment

Choose a reason for hiding this comment

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

타미 UI 깔끔하네요!
코멘트 확인해주세요.!

setCommentValue(e.target.value);
};

const handleSubmitComment: FormEventHandler<HTMLFormElement> = async (e) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

async 없어도 잘 동작하겠네요!

{
onSuccess: () => {
setCommentValue('');
toast.success('댓글이 등록되었습니다.');
Copy link
Collaborator

Choose a reason for hiding this comment

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

🥪

return (
<>
<CommentInputForm onSubmit={handleSubmitComment}>
<Input
Copy link
Collaborator

Choose a reason for hiding this comment

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

200자면 Input으로 했을 때 내용이 다 보이지 않을거 같아서 Textarea가 좋아보이는데 어떻게 생각하시나요??

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

좋아요 ~

</Heading>
<Spacing size={12} />
{recipeComments.map((comment) => (
<CommentItem key={comment.id} comment={comment} />
Copy link
Collaborator

Choose a reason for hiding this comment

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

List 컴포넌트를 만들어서 Suspense 적용하는건 어떻게 생각하시나요??

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

@hae-on hae-on left a comment

Choose a reason for hiding this comment

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

스크린샷 2023-10-12 오전 10 56 22

이 부분 선 두께를 다르게 하면 좋을 거 같아요!


스크린샷 2023-10-12 오전 10 57 42
그리고 본문 내용과 밑줄 사이에 여백이 더 많으면 좋을 거 같네요


스크린샷 2023-10-12 오전 10 58 04

여기도 Input과 글자수 사이에 여백 조금 넣어주세용
그리고 Input이 textarea로 바뀌면 제출 버튼을 아래로 내려야 할 거 같아요!

},
onError: (error) => {
if (error instanceof Error) {
alert(error.message);
Copy link
Collaborator

Choose a reason for hiding this comment

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

지워도 될 거 같네여

</SubmitButton>
</CommentInputForm>
<Text size="xs" color={theme.textColors.info} align="right">
{commentValue.length} / {MAX_COMMENT_LENGTH}
Copy link
Collaborator

Choose a reason for hiding this comment

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

스크린리더를 위해 '자'를 넣어주세요!
{commentValue.length}자 / {MAX_COMMENT_LENGTH}자

@xodms0309
Copy link
Collaborator Author

@hae-on @Leejin-Yang
스크린샷 2023-10-12 오후 1 41 28
리뷰 모두 반영했습니다!
코드에도 수정이 많으니 다시 읽어주세용

Copy link
Collaborator

@Leejin-Yang Leejin-Yang left a comment

Choose a reason for hiding this comment

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

파이팅 타미!


const MAX_COMMENT_LENGTH = 200;

const CommentForm = ({ recipeId }: CommentFormProps) => {
Copy link
Collaborator

Choose a reason for hiding this comment

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

👍

};

const useRecipeCommentQuery = (recipeId: number) => {
return useSuspendedQuery(['recipeComment', recipeId], () => fetchRecipeComments(recipeId));
Copy link
Collaborator

Choose a reason for hiding this comment

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

무한스크롤! 백엔드와 이야기해보세요~

Comment on lines 76 to 84
<Heading as="h3" size="lg">
댓글 ({recipeComments.length}개)
</Heading>
<Spacing size={12} />
<ErrorBoundary fallback={ErrorComponent} handleReset={reset}>
<Suspense fallback={<Loading />}>
<CommentList comments={recipeComments} />
</Suspense>
</ErrorBoundary>
Copy link
Collaborator

Choose a reason for hiding this comment

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

하나를 말해도 열을 아는 천재 타미
파이팅! 👍

@xodms0309
Copy link
Collaborator Author

@hae-on @Leejin-Yang
아예 새로운 코드가 되었으니 확인 부탁드립니다.

스크린샷 2023-10-12 오후 9 44 25
  • 댓글 무한스크롤 적용 (백엔드 측에서 totalElements
    보내주면 그대로 다시 query string에 실어서 보내주라고 해서 그부분 추가)
  • 댓글창을 fixed로 바꾸고 전송 버튼을 아이콘으로 변경 (아이콘 색을 primary로 할까 했는데 너무 연해서 기각했습니다.)

@xodms0309 xodms0309 requested a review from Leejin-Yang October 12, 2023 12:45
Copy link
Collaborator

@hae-on hae-on left a comment

Choose a reason for hiding this comment

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

스크린샷 2023-10-13 오전 1 35 03

타미! 코드에는 이상 없습니다~
다만 궁금한게 있는데요.
저 글자와 입력창 사이에 흰색 배경은 따로 없는거죠? (약간 글쓰기 버튼 뒤에 흰 배경 생각하면 됨)
만약 스크롤을 내려서 입력창이 댓글 글자 중간을 가리면 어떤 모습이 되나요?
코드 훑어봤을 때는 간격만 있는 거 같은데 그 간격때문에 괜찮으려나요??
말로 설명하려니까 어렵네요 ㅠ 무슨 말인지 모르겠으면 찾아와주세용~

@@ -27,7 +27,7 @@ type ToastStyleProps = Pick<ToastProps, 'isError'> & { isAnimating?: boolean };

const ToastWrapper = styled.div<ToastStyleProps>`
position: relative;
width: 100%;
width: calc(100% - 20px);
Copy link
Collaborator

Choose a reason for hiding this comment

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

짱👍

Copy link
Collaborator

@hae-on hae-on left a comment

Choose a reason for hiding this comment

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

굿굿 확인 완. 수고했어용~

Copy link
Collaborator

@Leejin-Yang Leejin-Yang left a comment

Choose a reason for hiding this comment

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

고생했어요 타미 👍

Comment on lines +16 to +17
const { fetchNextPage, hasNextPage, data } = useInfiniteRecipeCommentQuery(Number(recipeId));
useIntersectionObserver<HTMLDivElement>(fetchNextPage, scrollRef, hasNextPage);
Copy link
Collaborator

Choose a reason for hiding this comment

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

♾️👍


import { SvgIcon } from '@/components/Common';
import { useToastActionContext } from '@/hooks/context';
import useRecipeCommentMutation from '@/hooks/queries/recipe/useRecipeCommentMutation';
Copy link
Collaborator

Choose a reason for hiding this comment

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

index에 추가해주세요.!

Comment on lines +26 to +30
getNextPageParam: (prevResponse: CommentResponse) => {
const lastId = prevResponse.comments[prevResponse.comments.length - 1].id;
const totalElements = prevResponse.totalElements;
const lastCursor = { lastId: lastId, totalElements: totalElements };
return prevResponse.hasNext ? lastCursor : undefined;
Copy link
Collaborator

Choose a reason for hiding this comment

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

대박..👍

@xodms0309 xodms0309 merged commit 3a950c2 into develop Oct 13, 2023
3 checks passed
@xodms0309 xodms0309 deleted the feat/issue-738 branch October 13, 2023 05:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[FE] 꿀조합 댓글 기능 구현
3 participants