spee.ch/client/build/containers/AssetInfo/view.js

135 lines
7 KiB
JavaScript
Raw Normal View History

2018-05-23 04:06:37 +02:00
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
var _react = _interopRequireDefault(require("react"));
var _reactRouterDom = require("react-router-dom");
2018-06-08 17:50:25 +02:00
var _Label = _interopRequireDefault(require("@components/Label"));
var _RowLabeled = _interopRequireDefault(require("@components/RowLabeled"));
var _Row = _interopRequireDefault(require("@components/Row"));
var _SpaceBetween = _interopRequireDefault(require("@components/SpaceBetween"));
2018-07-03 19:48:37 +02:00
var _AssetShareButtons = _interopRequireDefault(require("@components/AssetShareButtons"));
2018-07-03 19:56:00 +02:00
var _ClickToCopy = _interopRequireDefault(require("@components/ClickToCopy"));
2018-05-23 04:06:37 +02:00
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } _setPrototypeOf(subClass.prototype, superClass && superClass.prototype); if (superClass) _setPrototypeOf(subClass, superClass); }
function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); }
function _getPrototypeOf(o) { _getPrototypeOf = Object.getPrototypeOf || function _getPrototypeOf(o) { return o.__proto__; }; return _getPrototypeOf(o); }
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
var AssetInfo =
/*#__PURE__*/
function (_React$Component) {
function AssetInfo(props) {
var _this;
_classCallCheck(this, AssetInfo);
_this = _possibleConstructorReturn(this, _getPrototypeOf(AssetInfo).call(this, props));
_this.copyToClipboard = _this.copyToClipboard.bind(_assertThisInitialized(_assertThisInitialized(_this)));
return _this;
}
_createClass(AssetInfo, [{
key: "render",
value: function render() {
var _this$props$asset = this.props.asset,
shortId = _this$props$asset.shortId,
_this$props$asset$cla = _this$props$asset.claimData,
channelName = _this$props$asset$cla.channelName,
certificateId = _this$props$asset$cla.certificateId,
description = _this$props$asset$cla.description,
name = _this$props$asset$cla.name,
claimId = _this$props$asset$cla.claimId,
fileExt = _this$props$asset$cla.fileExt,
contentType = _this$props$asset$cla.contentType,
thumbnail = _this$props$asset$cla.thumbnail,
host = _this$props$asset$cla.host;
2018-06-08 17:50:25 +02:00
return _react.default.createElement("div", null, channelName && _react.default.createElement(_Row.default, null, _react.default.createElement(_RowLabeled.default, {
label: _react.default.createElement(_Label.default, {
value: 'Channel:'
}),
content: _react.default.createElement("span", {
className: "text"
}, _react.default.createElement(_reactRouterDom.Link, {
to: "/".concat(channelName, ":").concat(certificateId)
}, channelName))
})), _react.default.createElement(_Row.default, null, _react.default.createElement(_RowLabeled.default, {
label: _react.default.createElement(_Label.default, {
value: 'Share:'
}),
2018-07-03 19:48:37 +02:00
content: _react.default.createElement(_AssetShareButtons.default, {
2018-06-08 17:50:25 +02:00
host: host,
name: name,
2018-06-08 17:50:25 +02:00
shortId: shortId
})
})), _react.default.createElement(_Row.default, null, _react.default.createElement(_RowLabeled.default, {
label: _react.default.createElement(_Label.default, {
value: 'Link:'
}),
2018-07-03 19:56:00 +02:00
content: _react.default.createElement(_ClickToCopy.default, {
2018-06-08 17:50:25 +02:00
id: 'short-link',
2018-07-03 19:56:00 +02:00
value: "".concat(host, "/").concat(shortId, "/").concat(name, ".").concat(fileExt)
2018-06-08 17:50:25 +02:00
})
})), _react.default.createElement(_Row.default, null, _react.default.createElement(_RowLabeled.default, {
label: _react.default.createElement(_Label.default, {
value: 'Embed:'
}),
2018-07-03 19:56:00 +02:00
content: _react.default.createElement("div", null, contentType === 'video/mp4' ? _react.default.createElement(_ClickToCopy.default, {
2018-06-08 17:50:25 +02:00
id: 'embed-text-video',
2018-07-03 19:56:00 +02:00
value: "<video width=\"100%\" controls poster=\"".concat(thumbnail, "\" src=\"").concat(host, "/").concat(claimId, "/").concat(name, ".").concat(fileExt, "\"/></video>")
}) : _react.default.createElement(_ClickToCopy.default, {
2018-06-08 17:50:25 +02:00
id: 'embed-text-image',
2018-07-03 19:56:00 +02:00
value: "<img src=\"".concat(host, "/").concat(claimId, "/").concat(name, ".").concat(fileExt, "\"/>")
2018-06-08 17:50:25 +02:00
}))
})), _react.default.createElement(_Row.default, null, _react.default.createElement(_SpaceBetween.default, null, _react.default.createElement(_reactRouterDom.Link, {
2018-05-23 04:06:37 +02:00
className: "link--primary",
to: "/".concat(shortId, "/").concat(name, ".").concat(fileExt)
2018-06-08 17:50:25 +02:00
}, "Direct Link"), _react.default.createElement("a", {
className: 'link--primary',
2018-05-23 04:06:37 +02:00
href: "".concat(host, "/").concat(claimId, "/").concat(name, ".").concat(fileExt),
download: name
}, "Download"), _react.default.createElement("a", {
2018-06-08 17:50:25 +02:00
className: 'link--primary',
2018-05-23 04:06:37 +02:00
target: "_blank",
href: "https://lbry.io/dmca"
2018-06-08 17:50:25 +02:00
}, "Report"))), description && _react.default.createElement(_Row.default, null, _react.default.createElement("p", null, description)), _react.default.createElement(_Row.default, null, _react.default.createElement("p", null, "Hosted via the ", _react.default.createElement("a", {
className: 'link--primary',
href: 'https://lbry.io/get',
target: '_blank'
2018-06-08 17:50:25 +02:00
}, "LBRY"), " blockchain")));
2018-05-23 04:06:37 +02:00
}
}]);
_inherits(AssetInfo, _React$Component);
return AssetInfo;
}(_react.default.Component);
;
var _default = AssetInfo;
exports.default = _default;