sanity-plugin-r2-video 0.1.4 → 0.1.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -210,22 +210,6 @@ var formatBitrate = (bytes, seconds) => {
210
210
  }
211
211
  return `${(bytes * 8 / seconds / 1e6).toFixed(2)} Mbps`;
212
212
  };
213
- var OVERLAY_STYLE = {
214
- alignItems: "center",
215
- background: "rgba(0, 0, 0, 0.75)",
216
- color: "#fff",
217
- display: "flex",
218
- height: "100%",
219
- justifyContent: "center",
220
- position: "absolute",
221
- right: 0,
222
- top: 0,
223
- width: "100%",
224
- zIndex: 3
225
- };
226
- var DragOverlay = () => {
227
- return /* @__PURE__ */ jsx(Flex, { style: OVERLAY_STYLE, children: /* @__PURE__ */ jsx(Text, { size: 3, style: { color: "inherit" }, children: "Drop files to upload" }) });
228
- };
229
213
  var hasVideoFile = (transfer) => {
230
214
  return Array.from(transfer.items).some((item) => {
231
215
  if (item.kind !== "file") {
@@ -801,7 +785,7 @@ var DialogUpload = ({
801
785
  const stage = (files) => {
802
786
  setItems((existing) => [...existing, ...files.map(toItem)]);
803
787
  };
804
- const { isDragging, dropProps } = useFileDrop({
788
+ const { isDragging, isRejected, dropProps } = useFileDrop({
805
789
  isEnabled: !isBusy && canEncode !== false,
806
790
  onDrop: stage
807
791
  });
@@ -878,7 +862,7 @@ var DialogUpload = ({
878
862
  tone: "transparent",
879
863
  ...dropProps,
880
864
  children: [
881
- isDragging && /* @__PURE__ */ jsx(DragOverlay, {}),
865
+ isDragging && /* @__PURE__ */ jsx(DropToUpload, { isRejected }),
882
866
  /* @__PURE__ */ jsxs(Stack, { gap: 4, children: [
883
867
  /* @__PURE__ */ jsxs(Stack, { gap: 3, children: [
884
868
  /* @__PURE__ */ jsx(Flex, { justify: "center", children: /* @__PURE__ */ jsx(Text, { muted: true, size: 3, children: /* @__PURE__ */ jsx(UploadIcon, {}) }) }),
@@ -1448,7 +1432,7 @@ var DialogDetails = ({
1448
1432
  return /* @__PURE__ */ jsx(
1449
1433
  Dialog,
1450
1434
  {
1451
- header: asset.filename,
1435
+ header: asset.filename || "Untitled video",
1452
1436
  id: "r2-video-details",
1453
1437
  width: 1,
1454
1438
  onClose: isSaving ? void 0 : onClose,
@@ -1724,14 +1708,11 @@ var FolderSidebar = ({
1724
1708
  var QUERY_ASSETS = `*[_type == "r2Video.asset"] | order(uploadedAt desc){
1725
1709
  _id,
1726
1710
  _type,
1727
- filename,
1711
+ "filename": coalesce(filename, ""),
1728
1712
  folder,
1729
1713
  poster,
1730
- duration,
1731
- hasAudio,
1732
-
1733
- // A document the pipeline never finished - Sanity's own create button made
1734
- // these before the reference field disabled it - has no renditions at all
1714
+ "duration": coalesce(duration, 0),
1715
+ "hasAudio": coalesce(hasAudio, false),
1735
1716
  "renditions": coalesce(renditions, []),
1736
1717
  uploadedAt,
1737
1718
  "posterUrl": poster.asset->url,
@@ -1782,7 +1763,7 @@ var ToolVideoLibrary = () => {
1782
1763
  const paths = resolveFolderPaths(folders).filter((entry) => {
1783
1764
  return counts.has(entry.id);
1784
1765
  });
1785
- const { isDragging, dropProps } = useFileDrop({
1766
+ const { isDragging, isRejected, dropProps } = useFileDrop({
1786
1767
  isEnabled: !isUploadOpen,
1787
1768
  onDrop: (files) => {
1788
1769
  setDroppedFiles(files);
@@ -1884,7 +1865,7 @@ var ToolVideoLibrary = () => {
1884
1865
  asset._id
1885
1866
  )) })
1886
1867
  ] }) }) }),
1887
- isDragging && /* @__PURE__ */ jsx(DragOverlay, {}),
1868
+ isDragging && /* @__PURE__ */ jsx(DropToUpload, { isRejected }),
1888
1869
  isUploadOpen && /* @__PURE__ */ jsx(
1889
1870
  DialogUpload,
1890
1871
  {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sanity-plugin-r2-video",
3
- "version": "0.1.4",
3
+ "version": "0.1.6",
4
4
  "description": "Video for Sanity Studio, encoded in the browser and stored in Cloudflare R2 as a ladder of plain MP4s.",
5
5
  "keywords": [
6
6
  "sanity",