2022-02-04 21:59:11 +01:00
|
|
|
// @flow
|
|
|
|
import 'scss/component/_comment-selectors.scss';
|
|
|
|
|
|
|
|
import Button from 'component/button';
|
|
|
|
import React from 'react';
|
|
|
|
import ChannelThumbnail from 'component/channelThumbnail';
|
|
|
|
import UriIndicator from 'component/uriIndicator';
|
|
|
|
import CreditAmount from 'component/common/credit-amount';
|
|
|
|
|
|
|
|
const TAB_FIAT = 'TabFiat';
|
|
|
|
const TAB_LBC = 'TabLBC';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
activeChannelUrl: string,
|
|
|
|
tipAmount: number,
|
|
|
|
activeTab: string,
|
|
|
|
message: string,
|
2022-02-07 20:30:42 +01:00
|
|
|
isReviewingStickerComment?: boolean,
|
|
|
|
stickerPreviewComponent?: any,
|
2022-02-04 21:59:11 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export const TipReviewBox = (props: Props) => {
|
2022-02-07 20:30:42 +01:00
|
|
|
const { activeChannelUrl, tipAmount, activeTab, message, isReviewingStickerComment, stickerPreviewComponent } = props;
|
2022-02-04 21:59:11 +01:00
|
|
|
|
|
|
|
return (
|
|
|
|
<div className="commentCreate__supportCommentPreview">
|
|
|
|
<CreditAmount
|
|
|
|
amount={tipAmount}
|
|
|
|
className="commentCreate__supportCommentPreviewAmount"
|
|
|
|
isFiat={activeTab === TAB_FIAT}
|
|
|
|
size={activeTab === TAB_LBC ? 18 : 2}
|
|
|
|
/>
|
|
|
|
|
2022-02-07 20:30:42 +01:00
|
|
|
{isReviewingStickerComment ? (
|
|
|
|
stickerPreviewComponent
|
|
|
|
) : (
|
|
|
|
<>
|
|
|
|
<ChannelThumbnail xsmall uri={activeChannelUrl} />
|
|
|
|
|
|
|
|
<div className="commentCreate__supportCommentBody">
|
2022-02-26 19:47:54 +01:00
|
|
|
<UriIndicator uri={activeChannelUrl} link showAtSign />
|
2022-02-07 20:30:42 +01:00
|
|
|
<div>{message}</div>
|
|
|
|
</div>
|
|
|
|
</>
|
|
|
|
)}
|
2022-02-04 21:59:11 +01:00
|
|
|
</div>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
|
|
|
type TipButtonProps = {
|
|
|
|
name: string,
|
|
|
|
tab: string,
|
|
|
|
activeTab: string,
|
|
|
|
tipSelectorOpen: boolean,
|
|
|
|
onClick: (tab: string) => void,
|
|
|
|
};
|
|
|
|
|
|
|
|
export const TipActionButton = (tipButtonProps: TipButtonProps) => {
|
|
|
|
const { name, tab, activeTab, tipSelectorOpen, onClick, ...buttonProps } = tipButtonProps;
|
|
|
|
|
|
|
|
return (
|
|
|
|
(!tipSelectorOpen || activeTab !== tab) && (
|
|
|
|
<Button
|
|
|
|
{...buttonProps}
|
|
|
|
title={name}
|
|
|
|
label={tipSelectorOpen ? __('Switch to %tip_method%', { tip_method: name }) : undefined}
|
|
|
|
onClick={() => onClick(tab)}
|
|
|
|
/>
|
|
|
|
)
|
|
|
|
);
|
|
|
|
};
|