2017-06-06 17:19:12 -04:00
|
|
|
import React from "react";
|
|
|
|
import Link from "component/link";
|
2017-09-07 23:15:05 -04:00
|
|
|
import FileDownloadLink from "component/fileDownloadLink";
|
2017-07-02 14:23:38 -04:00
|
|
|
import * as modals from "constants/modal_types";
|
2017-01-12 21:03:34 -05:00
|
|
|
|
2017-06-07 21:42:19 -07:00
|
|
|
class FileActions extends React.PureComponent {
|
2017-04-30 00:02:25 +07:00
|
|
|
render() {
|
2017-09-17 14:26:55 -04:00
|
|
|
const { fileInfo, uri, openModal, claimIsMine } = this.props;
|
2017-04-30 00:02:25 +07:00
|
|
|
|
2017-09-16 19:50:44 -06:00
|
|
|
const claimId = fileInfo ? fileInfo.claim_id : null,
|
2017-09-17 14:26:55 -04:00
|
|
|
showDelete = fileInfo && Object.keys(fileInfo).length > 0;
|
2017-04-30 00:02:25 +07:00
|
|
|
|
2017-01-12 21:03:34 -05:00
|
|
|
return (
|
2017-09-15 09:56:32 -04:00
|
|
|
<section className="card__actions">
|
|
|
|
{claimIsMine &&
|
|
|
|
<Link
|
|
|
|
button="text"
|
|
|
|
icon="icon-edit"
|
|
|
|
label={__("Edit")}
|
2017-09-17 14:26:55 -04:00
|
|
|
navigate="/publish"
|
|
|
|
navigateParams={{ id: claimId }}
|
2017-09-15 09:56:32 -04:00
|
|
|
/>}
|
2017-09-07 23:15:05 -04:00
|
|
|
<FileDownloadLink uri={uri} />
|
2017-08-25 23:33:33 +05:30
|
|
|
<Link
|
|
|
|
button="text"
|
|
|
|
icon="icon-gift"
|
2017-09-15 09:56:32 -04:00
|
|
|
label={__("Support")}
|
2017-09-17 14:26:55 -04:00
|
|
|
navigate="/show"
|
|
|
|
navigateParams={{ uri, tab: "tip" }}
|
2017-09-15 09:56:32 -04:00
|
|
|
/>
|
2017-09-17 14:26:55 -04:00
|
|
|
{showDelete &&
|
|
|
|
<Link
|
|
|
|
button="text"
|
|
|
|
icon="icon-trash"
|
|
|
|
label={__("Remove")}
|
|
|
|
className="card__action--right"
|
|
|
|
onClick={() => openModal(modals.CONFIRM_FILE_REMOVE, { uri })}
|
|
|
|
/>}
|
2017-05-14 23:50:59 -04:00
|
|
|
</section>
|
2017-01-12 21:03:34 -05:00
|
|
|
);
|
|
|
|
}
|
2017-04-30 00:02:25 +07:00
|
|
|
}
|
|
|
|
|
2017-06-05 21:21:55 -07:00
|
|
|
export default FileActions;
|