lbry-desktop/src/renderer/component/fileActions/view.jsx
Daniel Dominguez 16c09a9ddd Move modals types constants to lbry-redux repository.
- Remove useless file modal types as is not referenced anymore in this repository.
  - Changed import statements to use lbry-redux to import modal types constants.
2018-05-05 16:04:47 -03:00

52 lines
1.5 KiB
JavaScript

// @flow
import React from 'react';
import Button from 'component/button';
import FileDownloadLink from 'component/fileDownloadLink';
import { MODALS } from 'lbry-redux';
import classnames from 'classnames';
import * as icons from 'constants/icons';
type FileInfo = {
claim_id: string,
};
type Props = {
uri: string,
openModal: ({ id: string }, { uri: string }) => void,
claimIsMine: boolean,
fileInfo: FileInfo,
vertical?: boolean, // should the buttons be stacked vertically?
};
class FileActions extends React.PureComponent<Props> {
render() {
const { fileInfo, uri, openModal, claimIsMine, vertical } = this.props;
const claimId = fileInfo ? fileInfo.claim_id : '';
const showDelete = fileInfo && Object.keys(fileInfo).length > 0;
return (
<section className={classnames('card__actions', { 'card__actions--vertical': vertical })}>
<FileDownloadLink uri={uri} />
{showDelete && (
<Button
className="btn--file-actions"
icon={icons.TRASH}
description={__('Delete')}
onClick={() => openModal({ id: MODALS.CONFIRM_FILE_REMOVE }, { uri })}
/>
)}
{!claimIsMine && (
<Button
className="btn--file-actions"
icon={icons.REPORT}
href={`https://lbry.io/dmca?claim_id=${claimId}`}
description={__('Report content')}
/>
)}
</section>
);
}
}
export default FileActions;