2020-02-12 19:59:48 +01:00
|
|
|
// @flow
|
|
|
|
import * as MODALS from 'constants/modal_types';
|
|
|
|
import * as ICONS from 'constants/icons';
|
|
|
|
import React from 'react';
|
2020-09-30 20:46:17 +02:00
|
|
|
import classnames from 'classnames';
|
2020-02-12 19:59:48 +01:00
|
|
|
import Button from 'component/button';
|
2022-02-01 21:08:27 +01:00
|
|
|
import Tooltip from 'component/common/tooltip';
|
2020-02-12 19:59:48 +01:00
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
2020-09-30 20:46:17 +02:00
|
|
|
fileAction?: boolean,
|
2022-02-01 21:08:27 +01:00
|
|
|
// redux
|
2020-10-27 20:54:36 +01:00
|
|
|
disableSupport: boolean,
|
2022-02-01 21:08:27 +01:00
|
|
|
isRepost?: boolean,
|
|
|
|
doOpenModal: (id: string, {}) => void,
|
2022-03-28 22:32:01 +02:00
|
|
|
preferredCurrency: ?string,
|
2020-02-12 19:59:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function ClaimSupportButton(props: Props) {
|
2022-03-28 22:32:01 +02:00
|
|
|
const { uri, fileAction, isRepost, disableSupport, doOpenModal, preferredCurrency } = props;
|
|
|
|
|
|
|
|
const currencyToUse = preferredCurrency;
|
|
|
|
|
|
|
|
const iconToUse = {
|
|
|
|
EUR: {
|
|
|
|
icon: ICONS.EURO,
|
|
|
|
iconSize: 16,
|
|
|
|
},
|
|
|
|
USD: {
|
|
|
|
icon: ICONS.FINANCE,
|
|
|
|
iconSize: fileAction ? 22 : undefined,
|
|
|
|
},
|
|
|
|
};
|
2020-11-10 06:21:04 +01:00
|
|
|
|
2022-02-01 21:08:27 +01:00
|
|
|
return disableSupport ? null : (
|
|
|
|
<Tooltip title={__('Support this claim')} arrow={false}>
|
|
|
|
<Button
|
2022-02-02 13:45:16 +01:00
|
|
|
button={!fileAction ? 'alt' : undefined}
|
2022-03-24 16:33:27 +01:00
|
|
|
className={classnames('support-claim-button', { 'button--file-action': fileAction })}
|
2022-03-28 22:32:01 +02:00
|
|
|
icon={iconToUse[currencyToUse].icon}
|
|
|
|
iconSize={iconToUse[currencyToUse].iconSize}
|
2022-02-01 21:08:27 +01:00
|
|
|
label={isRepost ? __('Support Repost') : __('Support --[button to support a claim]--')}
|
|
|
|
requiresAuth
|
|
|
|
onClick={() => doOpenModal(MODALS.SEND_TIP, { uri, isSupport: true })}
|
|
|
|
/>
|
|
|
|
</Tooltip>
|
2020-02-12 19:59:48 +01:00
|
|
|
);
|
|
|
|
}
|