-
Notifications
You must be signed in to change notification settings - Fork 3
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: 게시글 신고 Toast mds로 변경 및 멤버 신고/차단 기능 추가 #1555
Changes from all commits
abfaa16
e8bcab1
6efe297
d51b5e4
0182393
1946950
48e0b67
0f01610
77b159f
44ee9cf
5f6104b
ccb3a67
6c57f72
2c8f951
cc20657
b3d21b8
2facec0
f925388
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { z } from 'zod'; | ||
|
||
import { createEndpoint } from '@/api/typedAxios'; | ||
|
||
interface RequestBody { | ||
blockedMemberId: number; | ||
} | ||
|
||
export const postBlockMember = createEndpoint({ | ||
request: (requestBody: RequestBody) => ({ | ||
method: 'PATCH', | ||
url: `api/v1/members/block/activate`, | ||
data: requestBody, | ||
}), | ||
serverResponseScheme: z.unknown(), | ||
}); | ||
|
||
export const usePostBlockMemberMutation = () => { | ||
return useMutation({ | ||
mutationFn: (requestBody: RequestBody) => postBlockMember.request(requestBody), | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { z } from 'zod'; | ||
|
||
import { createEndpoint } from '@/api/typedAxios'; | ||
|
||
interface RequestBody { | ||
reportMemberId: number; | ||
} | ||
|
||
export const postReportMember = createEndpoint({ | ||
request: (requestBody: RequestBody) => ({ | ||
method: 'POST', | ||
url: `api/v1/members/report`, | ||
data: requestBody, | ||
}), | ||
serverResponseScheme: z.unknown(), | ||
}); | ||
|
||
export const usePostReportMemberMutation = () => { | ||
return useMutation({ | ||
mutationFn: (requestBody: RequestBody) => postReportMember.request(requestBody), | ||
}); | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
import { useToast } from '@sopt-makers/ui'; | ||
import { useCallback } from 'react'; | ||
|
||
import { usePostReportPostMutation } from '@/api/endpoint/feed/postReportPost'; | ||
import useAlert from '@/components/common/Modal/useAlert'; | ||
import useConfirm from '@/components/common/Modal/useConfirm'; | ||
import usePopup from '@/components/common/Modal/usePopup'; | ||
import { zIndex } from '@/styles/zIndex'; | ||
|
||
interface Options { | ||
postId: string; | ||
|
@@ -12,36 +12,39 @@ interface Options { | |
|
||
export const useReportFeed = () => { | ||
const { confirm } = useConfirm(); | ||
const { alert } = useAlert(); | ||
const { mutate } = usePostReportPostMutation(); | ||
const { popup } = usePopup(); | ||
const { open } = useToast(); | ||
|
||
const handleReport = useCallback( | ||
async (options: Options) => { | ||
const result = await confirm({ | ||
title: '이 글을 신고하시겠습니까?', | ||
description: '글을 신고할 경우, 메이커스에서 검토를 거쳐 적절한 조치 및 게시자 제재를 취해요.', | ||
description: '글을 신고할 경우, 메이커스에서 검토를 거쳐 적절한 조치 및 게시자 제재를 취할 예정이에요.', | ||
okButtonText: '신고하기', | ||
cancelButtonText: '취소', | ||
maxWidth: 324, | ||
maxWidth: 400, | ||
zIndex: zIndex.헤더, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 여기 zIndex의 기준이 있을까요?! 번외로 저도 개발할때 똑같은 이슈가 있었는데, 한번 다같이 zIndex 기준을 정해야할 필요는 있어보입니다.. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. zIndex가 헤더보다 낮아서 헤더에 가려지더라구요,,, 그래서 일단 헤더와 같은 zIndex로 설정했습니다!
그리고 이 의견에 동의합니다! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. z-index 위계를 한 번 쭉 정의내릴 필요는 있어보여요...! 저도 맨날 하나씩 확인해서 올리고 그랬어서... |
||
}); | ||
|
||
if (result) { | ||
mutate(options.postId, { | ||
onSuccess: () => { | ||
popup({ | ||
icon: '/icons/check_box_field.svg', | ||
title: '신고해주셔서 감사해요', | ||
description: | ||
'메이커스에서 빠르게 검토 후 적절한 조치를 취할게요 :) 건전한 커뮤니티를 만드는데 기여해주셔서 감사해요!', | ||
maxWidth: 324, | ||
open({ | ||
icon: 'success', | ||
content: '신고가 완료되었어요.\n건전한 커뮤니티를 함께 만들어주셔서 감사해요!', | ||
style: { | ||
content: { | ||
whiteSpace: 'pre-wrap', | ||
}, | ||
}, | ||
}); | ||
|
||
options.onSuccess?.(); | ||
}, | ||
}); | ||
} | ||
}, | ||
[confirm, alert, mutate], | ||
[confirm, open, mutate], | ||
); | ||
|
||
return { handleReport }; | ||
|
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.
이 부분은 코드 리뷰보다는 질문에 가까운데.. 이번에는 피그마에 있는 Dialog 디자인을 따르는게 아닌 기존의 Confirm 공동 컴포넌트를 활용한거일까요?! 약간의 차이가 있어서 노티남깁니다(closed버튼 등등). 만약 맞다면 나중에 mds 도입때 같이 처리하면 될 것 같아요!
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.
mds를 사용하지는 않았어요! 추후 mds로 같이 마이그레이션 할 필요는 있어 보입니다!
그리고 어떤 부분에서 디자인이 다를까요? 다른 점을 잘 못찾겠어서요,,,
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.
앗 closed 버튼(x자 버튼 유무) 이나 line height같은게 조금 다른 부분이 저도 작업하다가 있더라고요!! mds를 사용하지 않았다면 나중에 같이 마이그레이션 하면 될 것 같아요 :)