Allow adding tip to sticker chats

This commit is contained in:
Rafael 2022-02-07 10:13:21 -03:00 committed by Thomas Zarebczan
parent 9067a024ab
commit 83a535928d

View file

@ -156,8 +156,23 @@ export function CommentCreate(props: Props) {
function handleSelectTipComment(tab: string) { function handleSelectTipComment(tab: string) {
setActiveTab(tab); setActiveTab(tab);
if (isMobile) {
setTipModalOpen(true);
doOpenModal(MODALS.SEND_TIP, {
uri,
isTipOnly: true,
hasSelectedTab: tab,
customText: __('Preview Comment Tip'),
setAmount: (amount) => {
setTipAmount(amount);
setReviewingSupportComment(true);
},
});
} else {
setTipSelector(true); setTipSelector(true);
} }
}
function handleStickerComment() { function handleStickerComment() {
if (selectedSticker) setReviewingStickerComment(false); if (selectedSticker) setReviewingStickerComment(false);
@ -520,20 +535,7 @@ export function CommentCreate(props: Props) {
label={<FormChannelSelector isReply={Boolean(isReply)} isLivestream={Boolean(isLivestream)} />} label={<FormChannelSelector isReply={Boolean(isReply)} isLivestream={Boolean(isLivestream)} />}
name={isReply ? 'create__reply' : 'create__comment'} name={isReply ? 'create__reply' : 'create__comment'}
onChange={(e) => setCommentValue(SIMPLE_SITE || !advancedEditor || isReply ? e.target.value : e)} onChange={(e) => setCommentValue(SIMPLE_SITE || !advancedEditor || isReply ? e.target.value : e)}
handleTip={(isLBC) => { handleTip={(isLBC) => handleSelectTipComment(isLBC ? TAB_LBC : TAB_FIAT)}
setActiveTab(isLBC ? TAB_LBC : TAB_FIAT);
setTipModalOpen(true);
doOpenModal(MODALS.SEND_TIP, {
uri,
isTipOnly: true,
hasSelectedTab: isLBC ? TAB_LBC : TAB_FIAT,
customText: __('Preview Comment Tip'),
setAmount: (amount) => {
setTipAmount(amount);
setReviewingSupportComment(true);
},
});
}}
handleSubmit={handleCreateComment} handleSubmit={handleCreateComment}
slimInput={isMobile} slimInput={isMobile}
commentSelectorsProps={commentSelectorsProps} commentSelectorsProps={commentSelectorsProps}
@ -619,15 +621,15 @@ export function CommentCreate(props: Props) {
)} )}
{!isMobile && ( {!isMobile && (
<>
<StickerActionButton <StickerActionButton
{...actionButtonProps} {...actionButtonProps}
isReviewingStickerComment={isReviewingStickerComment} isReviewingStickerComment={isReviewingStickerComment}
icon={ICONS.STICKER} icon={ICONS.STICKER}
onClick={handleStickerComment} onClick={handleStickerComment}
/> />
)}
{!supportDisabled && ( {(!isMobile || isReviewingStickerComment) && !supportDisabled && (
<> <>
<TipActionButton {...tipButtonProps} name={__('Credits')} icon={ICONS.LBC} tab={TAB_LBC} /> <TipActionButton {...tipButtonProps} name={__('Credits')} icon={ICONS.LBC} tab={TAB_LBC} />
@ -636,8 +638,6 @@ export function CommentCreate(props: Props) {
)} )}
</> </>
)} )}
</>
)}
{tipSelectorOpen || isReviewingSupportComment ? ( {tipSelectorOpen || isReviewingSupportComment ? (
<Button {...cancelButtonProps} disabled={isSubmitting} onClick={handleCancelSupport} /> <Button {...cancelButtonProps} disabled={isSubmitting} onClick={handleCancelSupport} />