@remotion/studio
Version:
APIs for interacting with the Remotion Studio
36 lines (35 loc) • 1.96 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.RenderQueueDownloadItem = void 0;
const jsx_runtime_1 = require("react/jsx-runtime");
const react_1 = require("react");
const InlineAction_1 = require("../InlineAction");
const NotificationCenter_1 = require("../Notifications/NotificationCenter");
const ClientRenderQueueProcessor_1 = require("./ClientRenderQueueProcessor");
const RenderQueueDownloadItem = ({ job }) => {
const onClick = (0, react_1.useCallback)((e) => {
e.stopPropagation();
if (job.status !== 'done' || !job.getBlob) {
return;
}
job
.getBlob()
.then((blob) => {
(0, ClientRenderQueueProcessor_1.downloadBlob)(blob, job.outName);
})
.catch((err) => {
(0, NotificationCenter_1.showNotification)(`Could not download file: ${err.message}`, 2000);
});
}, [job]);
const icon = (0, react_1.useMemo)(() => {
return {
height: 12,
color: 'currentColor',
};
}, []);
const renderAction = (0, react_1.useCallback)((color) => {
return (jsx_runtime_1.jsx("svg", { style: icon, xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 512 512", children: jsx_runtime_1.jsx("path", { fill: color, d: "M288 32c0-17.7-14.3-32-32-32s-32 14.3-32 32l0 242.7-73.4-73.4c-12.5-12.5-32.8-12.5-45.3 0s-12.5 32.8 0 45.3l128 128c12.5 12.5 32.8 12.5 45.3 0l128-128c12.5-12.5 12.5-32.8 0-45.3s-32.8-12.5-45.3 0L288 274.7 288 32zM64 352c-35.3 0-64 28.7-64 64l0 32c0 35.3 28.7 64 64 64l384 0c35.3 0 64-28.7 64-64l0-32c0-35.3-28.7-64-64-64l-101.5 0-45.3 45.3c-25 25-65.5 25-90.5 0L165.5 352 64 352zm368 56a24 24 0 1 1 0 48 24 24 0 1 1 0-48z" }) }));
}, [icon]);
return (jsx_runtime_1.jsx(InlineAction_1.InlineAction, { renderAction: renderAction, onClick: onClick, title: "Download" }));
};
exports.RenderQueueDownloadItem = RenderQueueDownloadItem;