-
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.
- Loading branch information
1 parent
8d76631
commit 1c7985a
Showing
4 changed files
with
49 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