lbry-desktop/src/renderer/component/fileActions/view.jsx

58 lines
1.6 KiB
React
Raw Normal View History

2017-06-06 23:19:12 +02:00
import React from "react";
import Link from "component/link";
2017-09-08 05:15:05 +02:00
import FileDownloadLink from "component/fileDownloadLink";
2017-07-02 20:23:38 +02:00
import * as modals from "constants/modal_types";
2017-06-08 06:42:19 +02:00
class FileActions extends React.PureComponent {
render() {
2017-09-17 20:26:55 +02:00
const { fileInfo, uri, openModal, claimIsMine } = this.props;
const claimId = fileInfo ? fileInfo.claim_id : null,
showDelete = fileInfo && Object.keys(fileInfo).length > 0;
return (
<section className="card__actions">
2017-09-08 05:15:05 +02:00
<FileDownloadLink uri={uri} />
2017-11-24 15:31:05 +01:00
{showDelete && (
2017-09-17 20:26:55 +02:00
<Link
button="text"
icon="icon-trash"
label={__("Remove")}
className="no-underline"
2017-09-17 20:26:55 +02:00
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
2017-11-24 15:31:05 +01:00
/>
)}
{!claimIsMine && (
<Link
button="text"
icon="icon-flag"
href={`https://lbry.io/dmca?claim_id=${claimId}`}
className="no-underline"
label={__("report")}
2017-11-24 15:31:05 +01:00
/>
)}
<Link
button="primary"
icon="icon-gift"
label={__("Support")}
navigate="/show"
2017-10-10 03:39:41 +02:00
className="card__action--right"
navigateParams={{ uri, tab: "tip" }}
/>
2017-11-24 15:31:05 +01:00
{claimIsMine && (
2017-10-10 03:39:41 +02:00
<Link
button="alt"
icon="icon-edit"
label={__("Edit")}
navigate="/publish"
className="card__action--right"
navigateParams={{ id: claimId }}
2017-11-24 15:31:05 +01:00
/>
)}
2017-05-15 05:50:59 +02:00
</section>
);
}
}
2017-06-06 06:21:55 +02:00
export default FileActions;