utopia-ui 3.0.100 → 3.0.101

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.
@@ -4,7 +4,7 @@ var jsxRuntime = require('react/jsx-runtime');
4
4
  var React = require('react');
5
5
  var reactRouterDom = require('react-router-dom');
6
6
  var reactToastify = require('react-toastify');
7
- var TagView = require('./TagView-Dj1DIwd9.js');
7
+ var TagView = require('./TagView-BMjJMd4R.js');
8
8
  var require$$0 = require('leaflet');
9
9
  var axios = require('axios');
10
10
  require('react-inlinesvg');
@@ -434,14 +434,24 @@ const CrowdfundingView = ({ item }) => {
434
434
  return (jsxRuntime.jsx("div", { className: 'tw:mx-6 tw:mb-6', children: jsxRuntime.jsxs("div", { className: 'tw:card tw:bg-base-200 tw:w-fit tw:max-w-full tw:shadow', children: [jsxRuntime.jsxs("div", { className: 'tw:stats tw:bg-base-200 tw:stats-horizontal tw:rounded-b-none', children: [jsxRuntime.jsxs("div", { className: 'tw:stat tw:p-3', children: [jsxRuntime.jsx("div", { className: 'tw:stat-title', children: "Current Balance" }), jsxRuntime.jsx("div", { className: 'tw:stat-value tw:text-xl lg:tw:text-3xl', children: formatCurrency(currentBalance, currency) })] }), jsxRuntime.jsxs("div", { className: 'tw:stat tw:p-3', children: [jsxRuntime.jsx("div", { className: 'tw:stat-title', children: "Received" }), jsxRuntime.jsx("div", { className: 'tw:stat-value tw:text-green-500 tw:text-xl lg:tw:text-3xl', children: formatCurrency(stats.totalAmountReceived.valueInCents, currency) })] }), jsxRuntime.jsxs("div", { className: 'tw:stat tw:p-3', children: [jsxRuntime.jsx("div", { className: 'tw:stat-title', children: "Spent" }), jsxRuntime.jsx("div", { className: 'tw:stat-value tw:text-red-500 tw:text-xl lg:tw:text-3xl', children: formatCurrency(stats.totalAmountReceived.valueInCents - currentBalance, currency) })] })] }), jsxRuntime.jsx("hr", { className: 'tw:border-1 tw:border-current/10 tw:border-dashed' }), jsxRuntime.jsxs("div", { className: 'tw:m-4 tw:items-center', children: [jsxRuntime.jsx("a", { href: `https://opencollective.com/${slug}/donate`, target: '_blank', rel: 'noreferrer', children: jsxRuntime.jsx("button", { className: 'tw:btn tw:btn-sm tw:btn-primary tw:float-right tw:ml-4', children: "Donate" }) }), jsxRuntime.jsxs("div", { className: 'tw:flex-1 tw:mr-4', children: ["Support", ' ', jsxRuntime.jsx("a", { className: 'tw:font-bold', href: `https://opencollective.com/${slug}`, target: '_blank', rel: 'noreferrer', children: data.account.name }), ' ', "on ", jsxRuntime.jsx("span", { className: 'tw:font-bold', children: "Open\u00A0Collective" })] })] })] }) }));
435
435
  };
436
436
 
437
+ const extensionMap = new Map([
438
+ ['image/jpeg', '.jpg'],
439
+ ['image/png', '.png'],
440
+ ]);
441
+ const getExtension = (type) => {
442
+ const extension = extensionMap.get(type);
443
+ if (extension)
444
+ return extension;
445
+ throw new Error(`Unsupported file type: ${type}`);
446
+ };
437
447
  const GalleryView = ({ item }) => {
438
448
  const [index, setIndex] = React.useState(-1);
439
449
  const appState = TagView.useAppState();
440
- const images = item.gallery?.map((i, j) => ({
441
- src: appState.assetsApi.url + `${i.directus_files_id.id}.jpg`,
442
- width: i.directus_files_id.width,
443
- height: i.directus_files_id.height,
444
- index: j,
450
+ const images = item.gallery?.map(({ directus_files_id: { id, type, width, height } }, index) => ({
451
+ src: `${appState.assetsApi.url}${id}${getExtension(type)}`,
452
+ width,
453
+ height,
454
+ index,
445
455
  })) ?? [];
446
456
  if (images.length > 0)
447
457
  return (jsxRuntime.jsxs("div", { className: 'tw:mx-6 tw:mb-6', children: [jsxRuntime.jsx(reactPhotoAlbum.RowsPhotoAlbum, { photos: images, targetRowHeight: 150, onClick: ({ index: current }) => setIndex(current) }), jsxRuntime.jsx(ReactLightbox, { index: index, slides: images, open: index >= 0, close: () => setIndex(-1) })] }));
@@ -4105,6 +4115,7 @@ const GalleryForm = ({ state, setState }) => {
4105
4115
  height,
4106
4116
  asset: await appState.assetsApi.upload(compressedFile, file.name),
4107
4117
  name: file.name,
4118
+ type: file.type,
4108
4119
  };
4109
4120
  });
4110
4121
  for await (const upload of uploads) {
@@ -4118,6 +4129,7 @@ const GalleryForm = ({ state, setState }) => {
4118
4129
  id: upload.asset.id,
4119
4130
  width: upload.width,
4120
4131
  height: upload.height,
4132
+ type: upload.type,
4121
4133
  },
4122
4134
  },
4123
4135
  ],
@@ -4129,6 +4141,7 @@ const GalleryForm = ({ state, setState }) => {
4129
4141
  onDrop: upload,
4130
4142
  accept: {
4131
4143
  'image/jpeg': [],
4144
+ 'image/png': [],
4132
4145
  },
4133
4146
  });
4134
4147
  const images = state.gallery