-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #66 from team-xquare/feat/feed-report
feat(feed): 피드 신고기능 추가 및 케밥메뉴 변경
- Loading branch information
Showing
7 changed files
with
79 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import useDeleteFeed from '../../main/hooks/useDeleteFeed'; | ||
import { useBridgeHandler, sendBridgeEvent } from '@shared/xbridge'; | ||
|
||
const useKebaButton = (navUrl: string, feedId: string, categoryId: string) => { | ||
const actionSheetMenu = ['삭제하기', '신고하기'] as const; | ||
const { mutate: deleteMutate } = useDeleteFeed(feedId, categoryId); | ||
|
||
const deleteConfirm = useBridgeHandler('confirm', (e) => e.detail.success && deleteMutate(), { | ||
message: '피드를 삭제하시겠습니까?', | ||
cancelText: '취소하기', | ||
confirmText: '삭제하기', | ||
}); | ||
|
||
const menuAction: Record<(typeof actionSheetMenu)[number], () => void> = { | ||
삭제하기: () => { | ||
categoryId && deleteConfirm(); | ||
}, | ||
신고하기: () => { | ||
sendBridgeEvent('navigate', { | ||
url: navUrl, | ||
title: '신고하기', | ||
rightButtonText: '제출', | ||
}); | ||
}, | ||
}; | ||
return { actionSheetMenu, menuAction }; | ||
}; | ||
|
||
export default useKebaButton; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import React from 'react'; | ||
import { sendBridgeEvent } from '@shared/xbridge/src/index'; | ||
import { useMutation } from '@tanstack/react-query'; | ||
import { postReportFeed } from '../apis'; | ||
|
||
const useReportFeed = () => { | ||
return useMutation(postReportFeed, { | ||
onError: () => { | ||
sendBridgeEvent('error', { | ||
message: '피드신고에 실패하였습니다.', | ||
}); | ||
}, | ||
}); | ||
}; | ||
|
||
export default useReportFeed; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters