UNPKG

synapse-react-client

Version:

[![npm version](https://badge.fury.io/js/synapse-react-client.svg)](https://badge.fury.io/js/synapse-react-client) [![code style: prettier](https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square)](https://github.com/prettier/prettie

71 lines (70 loc) 2.35 kB
import { jsx as o, jsxs as a, Fragment as s } from "react/jsx-runtime"; import { Button as i, Box as m, Typography as p, FormControlLabel as u, Checkbox as d } from "@mui/material"; import { noop as C } from "lodash-es"; import h from "pluralize"; import { useState as g } from "react"; import { DialogBase as y } from "../DialogBase.js"; function N(t) { return t.type === "CONFIRM_NEW_VERSION" ? "Update existing file?" : ""; } function x(t) { return t.type === "CONFIRM_NEW_VERSION" ? `A file named "${t.fileName}" (${t.existingEntityId}) already exists in this location. Do you want to update the existing file and create a new version?` : ""; } function S(t) { const { activePrompts: e } = t, [r, c] = g(!1); if (e.length === 0) return null; const n = e.filter((l) => l.info.type === "CONFIRM_NEW_VERSION").length - 1; return /* @__PURE__ */ o( y, { title: N(e[0].info), open: !0, content: /* @__PURE__ */ a(s, { children: [ /* @__PURE__ */ o(p, { variant: "body1", gutterBottom: !0, children: x(e[0].info) }), e[0].info.type == "CONFIRM_NEW_VERSION" && n > 0 && /* @__PURE__ */ o( u, { control: /* @__PURE__ */ o(d, {}), value: r, onChange: (l, f) => c(f), label: `Also update ${n.toLocaleString()} other uploaded ${h( "file", n )} that already exist${n == 1 ? "s" : ""}` } ) ] }), onCancel: C, hasCloseButton: !1, actions: /* @__PURE__ */ a(s, { children: [ e[0].onCancelAll && /* @__PURE__ */ o( i, { variant: "text", color: "error", onClick: e[0].onCancelAll, children: "Cancel All Uploads" } ), /* @__PURE__ */ o(m, { sx: { flexGrow: 1 } }), e[0].onSkip && /* @__PURE__ */ o(i, { onClick: e[0].onSkip, children: "No" }), e[0].onConfirm && /* @__PURE__ */ o( i, { variant: "contained", color: "primary", onClick: () => { r ? e[0].onConfirmAll() : e[0].onConfirm(); }, children: "Yes" } ) ] }) } ); } export { S as EntityUploadPromptDialog }; //# sourceMappingURL=EntityUploadPromptDialog.js.map