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';
|
|
|
|
|
|
|
|
type Props = {
|
|
|
|
uri: string,
|
|
|
|
doOpenModal: (string, {}) => void,
|
2020-09-30 20:46:17 +02:00
|
|
|
fileAction?: boolean,
|
2020-10-27 20:54:36 +01:00
|
|
|
disableSupport: boolean,
|
2021-01-15 15:11:35 +01:00
|
|
|
claim: GenericClaim,
|
2020-02-12 19:59:48 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
export default function ClaimSupportButton(props: Props) {
|
2021-01-15 15:11:35 +01:00
|
|
|
const { doOpenModal, uri, fileAction, disableSupport, claim } = props;
|
|
|
|
const isRepost = claim && claim.repost_url;
|
2020-11-10 06:21:04 +01:00
|
|
|
|
2020-10-27 20:54:36 +01:00
|
|
|
if (disableSupport) {
|
|
|
|
return null;
|
|
|
|
}
|
2020-11-10 06:21:04 +01:00
|
|
|
|
2020-02-12 19:59:48 +01:00
|
|
|
return (
|
2020-11-17 20:10:14 +01:00
|
|
|
<Button
|
|
|
|
button={fileAction ? undefined : 'alt'}
|
|
|
|
className={classnames({ 'button--file-action': fileAction })}
|
|
|
|
icon={ICONS.LBC}
|
|
|
|
iconSize={fileAction ? 22 : undefined}
|
2021-01-20 11:43:46 +01:00
|
|
|
label={isRepost ? __('Support Repost') : __('Support --[button to support a claim]--')}
|
2020-11-17 20:10:14 +01:00
|
|
|
title={__('Support this claim')}
|
|
|
|
onClick={() => doOpenModal(MODALS.SEND_TIP, { uri, isSupport: true })}
|
|
|
|
/>
|
2020-02-12 19:59:48 +01:00
|
|
|
);
|
|
|
|
}
|